Skip to content

Commit 365b4d1

Browse files
committed
Set up working configuration for superset startup process
1 parent 1b2309d commit 365b4d1

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

Dockerfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ WORKDIR ${FOLDER}
77
USER root
88

99
ENV SUPERSET_CONFIG_PATH='./superset_config.py'
10-
ENV FLASK_ENV=production
11-
ENV FLASK_DEBUG=0
10+
ENV PYTHONPATH=/app
11+
ENV FLASK_APP=app:create_app()
1212
ENV PYTHONUNBUFFERED=1
1313

14-
# Install system dependencies required to build PostgreSQL client bindings
15-
# (pkg-config, C build tools, and libpq headers) and then install the Python
16-
# package. Assumes Debian/Ubuntu base image. If using Alpine, replace with the
17-
# appropriate `apk add` packages (postgresql-dev, build-base, pkgconfig).
1814
RUN apt-get update \
1915
&& apt-get install -y --no-install-recommends \
2016
build-essential \
@@ -25,7 +21,7 @@ RUN apt-get update \
2521
&& apt-get autoremove -y \
2622
&& rm -rf /var/lib/apt/lists/* \
2723
&& pip install --upgrade pip \
28-
&& pip install psycopg2-binary psycopg2
24+
&& pip install psycopg2-binary psycopg2 pillow
2925

3026
# Install psycopg2 in the user's environment as well
3127
RUN su - superset -c "pip install psycopg2-binary psycopg2"

superset-init.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
#!/bin/bash
22

3-
# create Admin user, you can read these values from env or anywhere else possible
4-
superset fab create-admin --username "$ADMIN_USERNAME" --firstname Superset --lastname Admin --email "$ADMIN_EMAIL" --password "$ADMIN_PASSWORD"
3+
echo "Starting superset-init.sh"
54

6-
# Upgrading Superset metastore
5+
# Ensure database is initialized first
6+
echo "Initializing database..."
77
superset db upgrade
88

9-
# setup roles and permissions
10-
superset superset init
9+
# Setup roles and permissions
10+
echo "Initializing roles and permissions..."
11+
superset init
12+
13+
# Create Admin user, you can read these values from env or anywhere else possible
14+
echo "Creating admin user..."
15+
superset fab create-admin --username "$ADMIN_USERNAME" --firstname Superset --lastname Admin --email "$ADMIN_EMAIL" --password "$ADMIN_PASSWORD" || true
1116

1217
# Starting server
18+
echo "Starting Superset server..."
1319
/bin/sh -c /usr/bin/run-server.sh

superset_config.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
import os
2+
3+
# Feature flags
14
FEATURE_FLAGS = {
25
"ENABLE_TEMPLATE_PROCESSING": True,
36
}
47

8+
# Flask configuration
59
ENABLE_PROXY_FIX = True
6-
SECRET_KEY = "YOUR_OWN_RANDOM_GENERATED_STRING"
10+
SECRET_KEY = "YOUR_OWN_RANDOM_GENERATED_STRING"
11+
12+
# Ensure logs are initialized
13+
STORE_LOGS_REMOTELY = True

0 commit comments

Comments
 (0)