From bff9628dea4ba7e95a08c0c16cc73b68f73fb1b6 Mon Sep 17 00:00:00 2001 From: Elijah Hopp Date: Wed, 31 Jan 2024 21:04:20 +0000 Subject: [PATCH] Add files. --- README.md | 27 ++++++++++++++++++++++++++- docker-compose.yml | 32 ++++++++++++++++++++++++++++++++ setup.sh | 9 +++++++++ superset/Dockerfile | 9 +++++++++ superset/superset_config.py | 4 ++++ 5 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 docker-compose.yml create mode 100755 setup.sh create mode 100644 superset/Dockerfile create mode 100644 superset/superset_config.py diff --git a/README.md b/README.md index a98a613..586b8b9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,27 @@ # simple-superset-compose -A super-minimal Docker Compose template for Apache Superset. + +This is a minimal [Superset](https://superset.apache.org/) + Docker Compose set up. It's intended to simplify the process of trying out Superset. + +:warning: This is not intended for production use. There are unsafe defaults enabled in `superset/superset_config.py`. + +## Usage + +1. Determine if you need to make any changes to `superset_config.py` (more info [here](https://superset.apache.org/docs/installation/configuring-superset)). If you ever make any changes to `superset_config.py`, make sure to rebuild the docker images (`docker compose build`). + +2. Run `docker compose up`. + +3. Run the `setup.sh` file, which initializes an account named `admin` with the password `secret`. + +4. Visit [https://localhost:8080](https://localhost:8080). + +5. [Connect the running PostgreSQL to Superset](https://superset.apache.org/docs/databases/db-connection-ui), if necessary. + +6. Insert data into the database via the exposed port (`5000` by default), or [via the Superset UI](https://superset.apache.org/docs/creating-charts-dashboards/exploring-data/). + +7. Try Superset. + +8. Profit! + +## Notes + +Apache Superset comes with a default Docker Compose setup, but it is not very condusive to trying out the basic functionality of Superset in your local env. This little compose file is the (impercise, quick-n-dirty) product of me wanting to trying out Superset, but shying away from the intensive setup process. It's simple nature lends itself well to use as a little offline anylitics app/SQL exploration lab with fancy graphs/a workspace to safely try out Superset development. Enjoy! \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..dd42d39 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +version: '3' + +services: + superset: + init: true + build: + context: ./superset + dockerfile: Dockerfile + container_name: superset + volumes: + - ./superset_home:/app/superset_home + environment: + - DATABASE_DB=superset + - DATABASE_HOST=db + - DATABASE_PASSWORD=superset + - DATABASE_USER=superset + - DATABASE_PORT=5432 + ports: + - '8080:8088' + + database: + init: true + image: postgres:alpine + container_name: superset_db + volumes: + - ./postgres_data:/var/lib/postgresql/data + environment: + - POSTGRES_DB=superset + - POSTGRES_USER=superset + - POSTGRES_PASSWORD=secretsecret + ports: + - '5000:5432' \ No newline at end of file diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..cd9d48c --- /dev/null +++ b/setup.sh @@ -0,0 +1,9 @@ +docker exec -it superset superset fab create-admin \ + --username admin \ + --firstname Superset \ + --lastname Admin \ + --email admin@localhost \ + --password secret + +docker exec -it superset superset db upgrade && + docker exec -it superset superset init diff --git a/superset/Dockerfile b/superset/Dockerfile new file mode 100644 index 0000000..a90144a --- /dev/null +++ b/superset/Dockerfile @@ -0,0 +1,9 @@ +FROM apache/superset:3.0.2 + +USER root + +COPY --chmod=777 superset_config.py /app/ +ENV SUPERSET_CONFIG_PATH /app/superset_config.py + +USER superset +ENTRYPOINT [ "/usr/bin/run-server.sh" ] \ No newline at end of file diff --git a/superset/superset_config.py b/superset/superset_config.py new file mode 100644 index 0000000..6350fb1 --- /dev/null +++ b/superset/superset_config.py @@ -0,0 +1,4 @@ +ENABLE_PROXY_FIX = True +SECRET_KEY = "MyVerySecretKey" +PREVENT_UNSAFE_DB_CONNECTIONS = False +TALISMAN_ENABLED = False \ No newline at end of file