Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rjurney master docs update #7426

Merged
merged 17 commits into from
May 21, 2019
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 33 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,17 @@ python setup.py build_sphinx

### Flask server

Make sure your machine meets the [OS dependencies](https://superset.incubator.apache.org/installation.html#os-dependencies) before following these steps.
#### OS Dependencies

Make sure your machine meets the [OS dependencies](https://superset.incubator.apache.org/installation.html#os-dependencies) before following these steps.

Developers should use a virtualenv.

```
pip install virtualenv
```

Then proceed with:

```bash
# Create a virtual environemnt and activate it (recommended)
Expand All @@ -304,10 +314,11 @@ source venv/bin/activate
# Install external dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt

# Install Superset in editable (development) mode
pip install -e .

# Create an admin user
# Create an admin user in your metadata database
fabmanager create-admin --app superset

# Initialize the database
Expand All @@ -319,35 +330,25 @@ superset init
# Load some data to play with
superset load_examples

# Start the Flask dev web server from inside the `superset` dir at port 8088
# Start the Flask dev web server from inside your virtualenv.
# Note that your page may not have css at this point.
# See instructions below how to build the front-end assets.
cd superset
FLASK_ENV=development flask run -p 8088 --with-threads --reload --debugger
FLASK_ENV=development superset run -p 8088 --with-threads --reload --debugger
```

#### Logging to the browser console
### Frontend Assets

This feature is only available on Python 3. When debugging your application, you can have the server logs sent directly to the browser console:
Frontend assets (JavaScript, CSS, and images) must be compiled in order to properly display the web UI. The `superset/assets` directory contains all NPM-managed front end assets. Note that there are additional frontend assets bundled with Flask-Appbuilder (e.g. jQuery and bootstrap); these are not managed by NPM, and may be phased out in the future.

```bash
FLASK_ENV=development flask run -p 8088 --with-threads --reload --debugger --console-log
```
#### nvm and node

You can log anything to the browser console, including objects:
First, be sure you are using recent versions of NodeJS and npm. Using [nvm](https://github.com/creationix/nvm) to manage them is recommended. Check the docs at the link to be sure, but at the time of writing the following would install nvm and node:

```python
from superset import app
app.logger.error('An exception occurred!')
app.logger.info(form_data)
```bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
nvm install node
```

### Frontend Assets

Frontend assets (JavaScript, CSS, and images) must be compiled in order to properly display the web UI. The `superset/assets` directory contains all NPM-managed front end assets. Note that there are additional frontend assets bundled with Flask-Appbuilder (e.g. jQuery and bootstrap); these are not managed by NPM, and may be phased out in the future.

First, be sure you are using recent versions of NodeJS and npm. Using [nvm](https://github.com/creationix/nvm) to manage them is recommended.

#### Prerequisite

#### Installing Dependencies
Expand Down Expand Up @@ -387,6 +388,12 @@ npm run dev
npm run prod
```

If you run this service from somewhere other than your local machine, you may need to add hostname value to webpack.config.js at .devServer.public specifying the endpoint at which you will access the app. For example: myhost:9001. For convenience you may want to install webpack, webpack-cli and webpack-dev-server globally so that you can run them directly:

```bash
npm install --global webpack webpack-cli webpack-dev-server
```

#### Updating NPM packages

Use npm in the prescribed way, making sure that
Expand Down Expand Up @@ -508,17 +515,20 @@ superset db upgrade
superset init
superset load_test_users
superset load_examples
superset runserver
superset run --port 8081
```

Run Cypress tests:

```bash
cd /superset/superset/assets
cd superset/assets
npm run build
npm run install-cypress
npm run cypress run
```

See [`superset/assets/cypress_build.sh`](https://github.com/apache/incubator-superset/blob/master/superset/assets/cypress_build.sh).

## Translating

We use [Babel](http://babel.pocoo.org/en/latest/) to translate Superset. In Python files, we import the magic `_` function using:
Expand Down
39 changes: 39 additions & 0 deletions contrib/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Getting Start with Superset using Docker
rjurney marked this conversation as resolved.
Show resolved Hide resolved

Docker is the recommended way to get stated with Superset.

## Initializing Database

To initialize the database with a user and example charts, dashboards and datasets run:

```bash
SUPERSET_LOAD_EXAMPLES=yes docker-compose run --rm superset ./docker-init.sh
```

This may take a minute.

## Normal Operation

To run the container, simply run:

```bash
docker-compose up
```

After several minutes for superset initialization to finish, you can open a browser and view [`http://localhost:8088`](http://localhost:8088)
to start your journey.

## Developing

While running, the container server will reload on modification of the superset python and javascript source code.
Don't forget to reload the page to take the new frontend into account though.

## Production

It is also possible to run Superset in non-development mode: in the `docker-compose.yml` file remove
the volumes needed for development and change the variable `SUPERSET_ENV` to `production`.

## Resource Constraints

If you are attempting to build on a Mac and it exits with 137 you need to increase your docker resources.
OSX instructions: https://docs.docker.com/docker-for-mac/#advanced (Search for memory)
18 changes: 12 additions & 6 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ OSX instructions: https://docs.docker.com/docker-for-mac/#advanced (Search for m

Or if you're curious and want to install superset from bottom up, then go ahead.

See also `contrib/docker/README.md <https://github.com/apache/incubator-superset/blob/master/contrib/docker/README.md>`_

OS dependencies
---------------

Expand Down Expand Up @@ -121,7 +123,13 @@ that the required dependencies are installed: ::
sudo yum upgrade python-setuptools
sudo yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel

**OSX**, system python is not recommended. brew's python also ships with pip ::
**Mac OS X** If possible, you should upgrade to the latest version of OS X as issues are more likely to be resolved for that version.
You *will likely need* the latest version of XCode available for your installed version of OS X. You should also install
the XCode command line tools: ::

xcode-select --install

System python is not recommended. Homebrew's python also ships with pip: ::

brew install pkg-config libffi openssl python
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography==2.4.2
Expand Down Expand Up @@ -183,7 +191,7 @@ Follow these few simple steps to install Superset.::
superset init

# To start a development web server on port 8088, use -p to bind to another port
superset runserver -d
superset run


After installation, you should be able to point your browser to the right
Expand Down Expand Up @@ -218,10 +226,8 @@ Refer to the
`Gunicorn documentation <https://docs.gunicorn.org/en/stable/design.html>`_
for more information.

Note that *gunicorn* does not
work on Windows so the `superset runserver` command is not expected to work
in that context. Also, note that the development web
server (`superset runserver -d`) is not intended for production use.
Note that the development web
server (`superset run` or `flask run`) is not intended for production use.

If not using gunicorn, you may want to disable the use of flask-compress
by setting `ENABLE_FLASK_COMPRESS = False` in your `superset_config.py`
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ flake8==3.6.0
flask-cors==3.0.6
ipdb==0.11
mypy==0.670
mysqlclient==1.3.13
mysqlclient==1.4.2.post1
nose==1.3.7
pip-tools==3.5.0
psycopg2-binary==2.7.5
Expand Down