feat: Superset BI funcional — psycopg2, EMBEDDED_SUPERSET, gunicorn
This commit is contained in:
parent
64c413d131
commit
98b79be03d
|
|
@ -234,27 +234,22 @@ services:
|
||||||
|
|
||||||
# ── Superset BI ───────────────────────────────────────────────────────────────
|
# ── Superset BI ───────────────────────────────────────────────────────────────
|
||||||
superset:
|
superset:
|
||||||
image: apache/superset:latest
|
build:
|
||||||
|
context: ./docker/superset
|
||||||
|
dockerfile: Dockerfile
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
SUPERSET_SECRET_KEY: ${SUPERSET_SECRET_KEY}
|
SUPERSET_SECRET_KEY: ${SUPERSET_SECRET_KEY}
|
||||||
SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://${PGUSER:-arcadia}:${PGPASSWORD}@db:5432/superset
|
SQLALCHEMY_DATABASE_URI: postgresql://${PGUSER:-arcadia}:${PGPASSWORD}@db:5432/superset
|
||||||
SUPERSET_LOAD_EXAMPLES: "no"
|
PYTHONPATH: /app/pythonpath
|
||||||
SUPERSET_ADMIN_USERNAME: ${SUPERSET_ADMIN_USERNAME:-admin}
|
SUPERSET_ADMIN_USERNAME: ${SUPERSET_ADMIN_USERNAME:-admin}
|
||||||
SUPERSET_ADMIN_PASSWORD: ${SUPERSET_ADMIN_PASSWORD}
|
SUPERSET_ADMIN_PASSWORD: ${SUPERSET_ADMIN_PASSWORD}
|
||||||
SUPERSET_ADMIN_EMAIL: ${SUPERSET_ADMIN_EMAIL:-admin@onboardbi.com.br}
|
SUPERSET_ADMIN_EMAIL: ${SUPERSET_ADMIN_EMAIL:-admin@onboardbi.com.br}
|
||||||
command: >
|
ARCADIA_DATABASE_URL: postgresql+psycopg2://${PGUSER:-arcadia}:${PGPASSWORD}@db:5432/${PGDATABASE:-arcadia}
|
||||||
/bin/sh -c "
|
command: ["/bin/bash", "/app/docker/init.sh"]
|
||||||
superset db upgrade &&
|
|
||||||
superset fab create-admin
|
|
||||||
--username \"$$SUPERSET_ADMIN_USERNAME\"
|
|
||||||
--firstname Arcadia --lastname Admin
|
|
||||||
--email \"$$SUPERSET_ADMIN_EMAIL\"
|
|
||||||
--password \"$$SUPERSET_ADMIN_PASSWORD\" || true &&
|
|
||||||
superset init &&
|
|
||||||
gunicorn --bind 0.0.0.0:8088 --workers 2 --timeout 120 'superset.app:create_app()'
|
|
||||||
"
|
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./docker/superset/superset_config.py:/app/pythonpath/superset_config.py:ro
|
||||||
|
- ./docker/superset/init.sh:/app/docker/init.sh:ro
|
||||||
- superset_home:/app/superset_home
|
- superset_home:/app/superset_home
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
FROM apache/superset:latest
|
||||||
|
USER root
|
||||||
|
RUN pip install psycopg2-binary && \
|
||||||
|
sed -i 's/include-system-site-packages = false/include-system-site-packages = true/' /app/.venv/pyvenv.cfg
|
||||||
|
USER superset
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "[Superset Init] Iniciando configuracao..."
|
||||||
|
superset db upgrade
|
||||||
|
|
||||||
|
superset fab create-admin \
|
||||||
|
--username "${SUPERSET_ADMIN_USERNAME:-admin}" \
|
||||||
|
--firstname "Arcadia" \
|
||||||
|
--lastname "Admin" \
|
||||||
|
--email "${SUPERSET_ADMIN_EMAIL:-admin@onboardbi.com.br}" \
|
||||||
|
--password "${SUPERSET_ADMIN_PASSWORD:-arcadia1337}" 2>/dev/null || true
|
||||||
|
|
||||||
|
superset init
|
||||||
|
|
||||||
|
echo "[Superset Init] Iniciando servidor..."
|
||||||
|
gunicorn \
|
||||||
|
--bind "0.0.0.0:8088" \
|
||||||
|
--access-logfile "-" \
|
||||||
|
--error-logfile "-" \
|
||||||
|
--workers 2 \
|
||||||
|
--timeout 120 \
|
||||||
|
"superset.app:create_app()"
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
SECRET_KEY = os.environ.get("SUPERSET_SECRET_KEY", "change-in-production")
|
||||||
|
|
||||||
|
SQLALCHEMY_DATABASE_URI = os.environ.get(
|
||||||
|
"SQLALCHEMY_DATABASE_URI",
|
||||||
|
"postgresql://arcadia:arcadia123@db:5432/superset"
|
||||||
|
)
|
||||||
|
|
||||||
|
ENABLE_CORS = True
|
||||||
|
CORS_OPTIONS = {
|
||||||
|
"supports_credentials": True,
|
||||||
|
"allow_headers": ["*"],
|
||||||
|
"resources": {r"/api/*": {"origins": "*"}},
|
||||||
|
}
|
||||||
|
|
||||||
|
FEATURE_FLAGS = {
|
||||||
|
"EMBEDDED_SUPERSET": True,
|
||||||
|
"ENABLE_TEMPLATE_PROCESSING": True,
|
||||||
|
"ALERT_REPORTS": True,
|
||||||
|
"DRILL_TO_DETAIL": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
SUPERSET_WEBSERVER_TIMEOUT = 300
|
||||||
|
|
||||||
|
CACHE_CONFIG = {
|
||||||
|
"CACHE_TYPE": "SimpleCache",
|
||||||
|
"CACHE_DEFAULT_TIMEOUT": 300,
|
||||||
|
}
|
||||||
|
|
||||||
|
APP_NAME = "Arcadia Insights"
|
||||||
Loading…
Reference in New Issue