Superset

Use your own database

1. Pull items

/ / create a directory to hold the project mkdir -p/MNT/superset CD/MNT/superset git clone https://github.com/amancevice/superset.gitCopy the code

2. Configure the database

By default, you have created your own empty database and a user who has read and write permission to the database. The following initialization will automatically create a table structure in your database for importing your data. If not, use the demo database that comes with the project

Go to the project directory CD/MNT /superset/superset and fill in the configuration information according to the documents on the official websiteCopy the code
  • superset_config.pylink
ROW_LIMIT = 5000

SUPERSET_WEBSERVER_PORT = 8088

SECRET_KEY = 'set_your_own_key'

SQLALCHEMY_DATABASE_URI = 'mysql://user:pass@host:port/db'


# Flask-WTF flag for CSRF
WTF_CSRF_ENABLED = True
# Add endpoints that need to be exempt from CSRF protection
WTF_CSRF_EXEMPT_LIST = []
# A CSRF token that expires in 1 year
WTF_CSRF_TIME_LIMIT = 60 * 60 * 24 * 365

# Set this API key to enable Mapbox visualizations
MAPBOX_API_KEY = ''
Copy the code

3. Start the container

Note:

  1. Py or /home/superset/superset_config.py must be mounted to /etc/superset/superset_config.py or /home/superset/superset_config.py because these two environment variables are used in the container.
  2. SECRET_KEY must be the same as superset_config.py
  3. Fill in your own database connection information
docker run -d --name superset_name \
    --env SECRET_KEY="set_your_own_key" \
    --env SQLALCHEMY_DATABASE_URI="mysql://user:pass@host:port/db" \
    -p 8089:8088 \
    amancevice/superset
Copy the code

4. Initialize the container

Into the CD/MNT/superset superset - init file directory/superset superset initialization, if use ali cloud RDS need not initialize the first use of, Docker exec -it superset_name superset-init admin User first name [admin]: vickey User last name [user]: vickey password: mypassword repeat passwd: Mypassword starts initialization after inputCopy the code

5. Front-end access

http://ip:8088/
Copy the code

2. Use the project Demo database

Start the container (assuming that we created the/MNT/superset) CD/MNT/superset/git clone https://github.com/amancevice/superset.git CD superset Docker-compose up -d docker-compose exec superset Demo access http://ip:8088/Copy the code

3. Reference links

  • Project Tutorial Link
  • Profile link
  • Links to other tutorials
  • Latest official documents

Using source code installation has 2 pits

  1. Docker-compose is installed in the development environment by default, so NPM error will be reported if you follow the documentation. We need to modify the environment to the production environment according to the following instructions.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.
  2. Because of the wall problem, dockerfile will time out when installing nodeJS, so we need to use Hong Kong or foreign server to pull dependencies.

solution

Nodejs_10.15.0-1nodesource1_amd64. deb curl -sLO https://deb.nodesource.com/node_10.x/pool/main/n/nodejs/nodejs_10.15.0-1nodesource1_amd64.deb docker cp Nodejs_10. 15.0 1 nodesource1_amd64. Deb test - super: / var/cache/apt/archives /Copy the code