Superset can't access non-development environments
Bug description
When I use docker compose -f docker-compose-non-dev.yml up to start superset, it enters the development environment, and using docker compose up also enters the development environment, not the production environment.
How to reproduce the bug
-
git clone https://github.com/apache/superset.git - Go to the superset directory
- Execute the command:
docker compose -f docker-compose-non-dev.yml up
Screenshots/recordings
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
Without making any project modifications, the command is executed directly after fetching the project from github
Checklist
- [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [X] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Hey @kainchow, I'm here to help you out with this Superset issue! I'm a bot that can assist with bug solving, answer questions, and help you become a contributor. Let's tackle this bug together! 🤖
To ensure that Superset starts in the production environment using Docker Compose, you should use the docker-compose-non-dev.yml file provided. Here are the steps to follow:
-
Create a Docker environment file: Make sure you have a
docker/.envfile with your own unique random secure passwords andSECRET_KEY. -
Run the Docker Compose command: Use the following command to start Superset in the production environment:
docker-compose -f docker-compose-non-dev.yml up -d
Ensure that the docker/.env file is correctly set up before running the command. The docker-compose-non-dev.yml file is configured for a non-development environment and should not default to development if the environment variables are correctly set.
Here is a snippet of the docker-compose-non-dev.yml file for reference:
version: "4.0"
services:
redis:
image: redis:7
container_name: superset_cache
restart: unless-stopped
volumes:
- redis:/data
db:
env_file:
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
image: postgres:15
container_name: superset_db
restart: unless-stopped
volumes:
- db_home:/var/lib/postgresql/data
- ./docker/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
superset:
env_file:
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
build:
<<: *common-build
container_name: superset_app
command: ["/app/docker/docker-bootstrap.sh", "app-gunicorn"]
user: "root"
restart: unless-stopped
ports:
- 8088:8088
depends_on: *superset-depends-on
volumes: *superset-volumes
superset-init:
container_name: superset_init
build:
<<: *common-build
command: ["/app/docker/docker-init.sh"]
env_file:
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
depends_on: *superset-depends-on
user: "root"
volumes: *superset-volumes
healthcheck:
disable: true
superset-worker:
build:
<<: *common-build
container_name: superset_worker
command: ["/app/docker/docker-bootstrap.sh", "worker"]
env_file:
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
restart: unless-stopped
depends_on: *superset-depends-on
user: "root"
volumes: *superset-volumes
healthcheck:
test:
[
"CMD-SHELL",
"celery -A superset.tasks.celery_app:app inspect ping -d celery@$$HOSTNAME",
]
superset-worker-beat:
build:
<<: *common-build
container_name: superset_worker_beat
command: ["/app/docker/docker-bootstrap.sh", "beat"]
env_file:
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
restart: unless-stopped
depends_on: *superset-depends-on
user: "root"
volumes: *superset-volumes
healthcheck:
disable: true
volumes:
superset_home:
external: false
db_home:
external: false
redis:
external: false
For more advanced configurations, you can refer to the docker/README.md file in the Superset repository [1][2].
Details
About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
I created a new superset_config_docker.py file in the docker/pythonpath_dev directory and added SECRET_KEY, but it still enters the development environment when executing docker compose -f docker-compose-non-dev up, here is superset_config_docker.py:
import os
from superset.utils import core as utils
FEATURE_FLAGS = {
"ENABLE_TEMPLATE_PROCESSING": True,
}
ENABLE_PROXY_FIX = True
SECRET_KEY = "jwoxth9akQkkzTnen2P4BRQgTRoT8fsv8f3XTKalqE2Ur2ZHQ1NeZxdVxU70Uake"
BABEL_DEFAULT_LOCALE='zh'
BABEL_DEFAULT_FOLDER = 'superset/translations'
LANGUAGES = {
'zh': {'flag': 'cn', 'name': '简体中文'},
'en': {'flag': 'us', 'name': 'English'}
}
WTF_CSRF_ENABLED = False
TALISMAN_ENABLED = utils.cast_to_boolean(os.environ.get("TALISMAN_ENABLED", False))
# Maximum number of rows returned for any analytical database query
SQL_MAX_ROW = 10000000
# default row limit when requesting chart data
# ROW_LIMIT = 10000000
FAVICONS = [{"href": "/static/assets/images/superset-mz-black.png"}]
By the way, BABEL_DEFAULT_LOCALE and LANGUAGES are effective.
When I use tag=3.1.3, superset works fine for production, but the latest version, 4.0.1rc, doesn't work!
tag=4.0.1 worked for me, but master branch error
@kainchow it doesn't seem to be solved with the new release (4.1.0), right?