Skip to content

Commit

Permalink
Rjurney master docs update (#7426)
Browse files Browse the repository at this point in the history
* resolved conflict

* Docs updated re: Anaconda/certifi issue re #7373

* Removed --console-log "not working" note

* A note about Anaconda virtualenvs

* Make anaconda comment fit on page

* Added README to docker directory

* Added install doc reference to master copy of contrib/docker/README.md

* merged master, removed mysqlclient

* Removed mysql dependency, Anaconda and --console-log references

* Add cypress install command to cypress test instructions

* Fixed cypress instructions re: port 8081

* Removed anaconda reference, runserver references

* Remove anaconda reference

* Added back a self-contained version of mysqlclient to dev requirements

* Added ASF license to docker README.md
  • Loading branch information
rjurney authored and mistercrunch committed May 21, 2019
1 parent 1fdc96a commit 023faf3
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 16 deletions.
42 changes: 34 additions & 8 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,11 +330,10 @@ 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
Expand Down Expand Up @@ -355,7 +365,14 @@ app.logger.info(form_data)

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.
#### nvm and node

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:

```bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
nvm install node
```

#### Prerequisite

Expand Down Expand Up @@ -396,6 +413,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 @@ -517,14 +540,15 @@ 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

# run tests from a specific file
Expand All @@ -534,6 +558,8 @@ npm run cypress run -- --spec cypress/integration/explore/link.test.js
npm run cypress run -- --spec cypress/integration/dashboard/index.test.js --config video=true
```

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
58 changes: 58 additions & 0 deletions contrib/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# Getting Start with Superset using Docker

Docker is an easy 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)
19 changes: 12 additions & 7 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 @@ -184,8 +192,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
flask run -p 8080 --with-threads --reload --debugger

superset run -p 8080 --with-threads --reload --debugger

After installation, you should be able to point your browser to the right
hostname:port `http://localhost:8088 <http://localhost:8088>`_, login using
Expand Down Expand Up @@ -219,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 @@ -23,7 +23,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

0 comments on commit 023faf3

Please sign in to comment.