Skip to content
pgalko edited this page Nov 13, 2022 · 8 revisions

Running the App as a docker container

.
+-- docker-compose.yml
+-- nginx
    +-- nginx.conf
+-- sql
|   +-- 1_create_superset_db.sql
|   +-- 2_superset_dump.sql
+-- ssl
+-- superset
|   +-- custom_security.py
|   +-- superset_config.py  
+-- work_dir
    +-- config
    |    +--settings.ini
    +-- data
    +-- db
    +-- logs
    +-- temp
  • cd to the location from the previous step

  • Modify work_dir/config/settings.ini to reflect your environment and use scenario (If you leave settings.ini as is, the app will still be functional and will use the pre-populated default options). Sensitive information in the .ini file will get encrypted upon the apps first execution, new encrypted_settings.ini file will be created and the original clear text settings.ini will be deleted. Detailed description of the process can be found here: https://github.com/pgalko/athlete_data_warehouse/wiki/Settings-Encryption. Please note that to be able to authenticate with Dropbox, Oura and Strava you will need to setup accounts with them and register this API application under your account. The process and steps described in the wiki API section.

  • Review the docker-compose.yml file, and make sure that you are happy with the default options, or modify if not.

version: "3"
services:
  db:
    image: postgres:13.5
    container_name: db
    command: postgres -c max_prepared_transactions=100 -c log_line_prefix='%h %m [%p] %q%u@%d'
    environment:
      - POSTGRES_PASSWORD=postgres
    ports:
      - 5432:5432
    volumes:
      - ./work_dir/db:/var/lib/postgresql/data
      - ./sql/:/docker-entrypoint-initdb.d
  app:
    image: pgalko/athlete_data_warehouse
    container_name: athlete_data_warehouse
    command: waitress-serve --port 5000 --call "web_app_loader_flask:load_apps" 
    depends_on:
      - db
    environment:
      - ENCR_PASS=12345
      - PYTHONPATH=/usr/src/athletedataapp/superset
      - TZ=Australia/Melbourne
      - OAUTHLIB_INSECURE_TRANSPORT=1
    volumes:
      - ./work_dir:/usr/src/athletedataapp/work_dir
      - ./superset:/usr/src/athletedataapp/superset
  pgweb:
    image: sosedoff/pgweb
    container_name: pgweb
    restart: always
    links: 
      - db:db 
    environment:
      - DATABASE_URL=postgres://postgres:postgres@db:5432/postgres?sslmode=disable
    ports:
      - 8081:8081
    depends_on:
      - db
  superset:
    image: amancevice/superset:1.4.1
    container_name: superset
    restart: always
    volumes: 
      - ./superset:/etc/superset
    depends_on:
      - db
    ports:
      - 8088:8088
  nginx:
    image: nginx:latest
    container_name: webserver
    restart: unless-stopped
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./ssl:/ssl/
    ports:
      - 80:80
    links:
      - app:app
      - pgweb:pgweb
      - superset:superset
  • Run
docker-compose up
  • Browse to http://localhost, create username and password and you should be able to start experimenting with different download options and settings.

  • Upon first submit the user data DB and user role will be created. All data and settings are persistent and will be located in work_dir/db folder. The DB will be accessible using the usual DB management tools like "pgAdmin" or the included "pgWeb".
    The DB role and password for user's DB are derived from user's logon username and password. If username = johndoe@gmail.com and password = pass123, the DB role will be created as johndoe with password pass123.

The default encryption passphrase is 12345 and can be changed in the "docker-compose.yml" file.
The default postgres credentials: postgres/postgres and can be changed in "the docker-compose.yml" file
The default superset credentials: admin/admin
Clone this wiki locally