elijahfhopp / simple-superset-compose

A super-minimal Docker Compose template for Apache Superset.
The Unlicense
3 stars 0 forks source link

My own variation #1

Open VincentSC opened 2 weeks ago

VincentSC commented 2 weeks ago

Hi Elijah,

Thanks for sharing your docker-compose! I have no idea why Superset does not invest in understanding how Docker Compose works, and keeps on using their over-complicated, unreadable version. :( But luckily you did the work!

I'd like to share my changes.

I just created an init.sh that needs a ADMIN_EMAIL and ADMIN_INITIAL_PASSWORD in the .env. Specially for this issue, I made it more generic with handling the variables :)

set -a && source .env && set +a

DOCKER=`docker compose images | grep "apache/superset" | sed 's/ .*//'`

sudo chmod 777 ./volumes/superset

docker exec -it $DOCKER superset fab create-admin \
              --username admin \
              --firstname Superset \
              --lastname Admin \
              --email $ADMIN_EMAIL \
              --password $ADMIN_INITIAL_PASSWORD

docker exec -it $DOCKER superset db upgrade
docker exec -it $DOCKER superset init

The compose.yml I changed the variables (moved to the .env) and added some variables that I found in the original. I'm still experimenting, so probably not final.

As I want other dockers to use the database to send their data to, I chose to have an external network dashboard-network. I added the command to create the network in a comment.

services:
  app:
    image: apache/superset:latest
    volumes:
      - ./volumes/superset:/app/superset_home
    environment:
      VIRTUAL_PORT: 8088
      SUPERSET_PORT: 8088
      VIRTUAL_HOST: ${DOMAIN}
      LETSENCRYPT_HOST: ${DOMAIN}

      DATABASE_DB: ${DB_DATABASE}
      DATABASE_HOST: dashboard-db
      DATABASE_PASSWORD: ${DB_PASSWORD}
      DATABASE_USER: ${DB_USERNAME}
      DATABASE_PORT: 5432
      DATABASE_DIALECT: postgresql
      SECRET_KEY: ${SECRET_KEY}
      SUPERSET_SECRET_KEY: ${SECRET_KEY}
      BUILD_SUPERSET_FRONTEND_IN_DOCKER: "true"
      CYPRESS_CONFIG: ""
      ENABLE_PLAYWRIGHT: "false"
      EXAMPLES_DB: examples
      EXAMPLES_HOST: dashboard-db
      EXAMPLES_PASSWORD: examples
      EXAMPLES_PORT: 5432
      EXAMPLES_USER: examples
      FLASK_DEBUG: "true"
#      MAPBOX_API_KEY: ""
      PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
      PYTHONPATH: /app/pythonpath:/app/docker/pythonpath_dev
#      REDIS_HOST: redis
#      REDIS_PORT: "6379"
      SUPERSET_ENV: development
      SUPERSET_LOAD_EXAMPLES: "yes"
    networks:
      - default
      - nginx-proxy

  dashboard-db:
    image: postgres:alpine
    volumes:
      - ./volumes/postgres:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: ${DB_DATABASE}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_PASSWORD: ${DB_PASSWORD}
    networks:
      - default
      - dashboard-network

networks:
  default:
    driver: "bridge"
  nginx-proxy:
    external: true
    name: nginx-proxy
  dashboard-network:
    external: true
    name: dashboard-network

# docker network create dashboard-network

And here's my (emptied) .env:

COMPOSE_PROJECT_NAME=superset
DOMAIN=
DB_DATABASE=superset
DB_USERNAME=superset
DB_PASSWORD=
SECRET_KEY=
ADMIN_EMAIL=
ADMIN_INITIAL_PASSWORD=
elijahfhopp commented 1 week ago

Hey, thanks for opening this issue. I appreciate you taking time to document your changes. I am going to leave this un-read and circle back around to it soon. From a brief reading I think there are some modifications which could be very welcome. Have a wonderful day, @VincentSC.