mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor(template): use dokploy mount volume for superset_config.py
This commit is contained in:
@@ -1,32 +1,6 @@
|
|||||||
# Note: this is an UNOFFICIAL production docker image build for Superset:
|
# Note: this is an UNOFFICIAL production docker image build for Superset:
|
||||||
# - https://github.com/amancevice/docker-superset
|
# - https://github.com/amancevice/docker-superset
|
||||||
#
|
#
|
||||||
# Before deploying, you must mount your `superset_config.py` file to
|
|
||||||
# the superset container. An example config is:
|
|
||||||
#
|
|
||||||
# ```python
|
|
||||||
# import os
|
|
||||||
#
|
|
||||||
# SECRET_KEY = os.getenv("SECRET_KEY")
|
|
||||||
# MAPBOX_API_KEY = os.getenv("MAPBOX_API_KEY", "")
|
|
||||||
#
|
|
||||||
# CACHE_CONFIG = {
|
|
||||||
# "CACHE_TYPE": "RedisCache",
|
|
||||||
# "CACHE_DEFAULT_TIMEOUT": 300,
|
|
||||||
# "CACHE_KEY_PREFIX": "superset_",
|
|
||||||
# "CACHE_REDIS_HOST": "redis",
|
|
||||||
# "CACHE_REDIS_PORT": 6379,
|
|
||||||
# "CACHE_REDIS_DB": 1,
|
|
||||||
# "CACHE_REDIS_URL": f"redis://:{os.getenv('REDIS_PASSWORD')}@redis:6379/1",
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# FILTER_STATE_CACHE_CONFIG = {**CACHE_CONFIG, "CACHE_KEY_PREFIX": "superset_filter_"}
|
|
||||||
# EXPLORE_FORM_DATA_CACHE_CONFIG = {**CACHE_CONFIG, "CACHE_KEY_PREFIX": "superset_explore_form_"}
|
|
||||||
#
|
|
||||||
# SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{os.getenv('POSTGRES_USER')}:{os.getenv('POSTGRES_PASSWORD')}@db:5432/{os.getenv('POSTGRES_DB')}"
|
|
||||||
# SQLALCHEMY_TRACK_MODIFICATIONS = True
|
|
||||||
# ```
|
|
||||||
#
|
|
||||||
# After deploying this image, you will need to run one of the two
|
# After deploying this image, you will need to run one of the two
|
||||||
# commands below in a terminal within the superset container:
|
# commands below in a terminal within the superset container:
|
||||||
# $ superset-demo # Initialise database + load demo charts/datasets
|
# $ superset-demo # Initialise database + load demo charts/datasets
|
||||||
@@ -49,9 +23,8 @@ services:
|
|||||||
POSTGRES_DB: ${POSTGRES_DB}
|
POSTGRES_DB: ${POSTGRES_DB}
|
||||||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||||
volumes:
|
volumes:
|
||||||
# NOTE: ensure `/opt/superset/superset_config.py` exists on your
|
# Note: superset_config.py can be edited in Dokploy's UI Volume Mount
|
||||||
# host machine (or change the path as appropriate)
|
- ../files/superset/superset_config.py:/etc/superset/superset_config.py
|
||||||
- /opt/superset/superset_config.py:/etc/superset/superset_config.py
|
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres
|
image: postgres
|
||||||
|
|||||||
@@ -31,8 +31,37 @@ export function generate(schema: Schema): Template {
|
|||||||
`REDIS_PASSWORD=${redisPassword}`,
|
`REDIS_PASSWORD=${redisPassword}`,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const mounts: Template["mounts"] = [
|
||||||
|
{
|
||||||
|
filePath: "./superset/superset_config.py",
|
||||||
|
content: `
|
||||||
|
import os
|
||||||
|
|
||||||
|
SECRET_KEY = os.getenv("SECRET_KEY")
|
||||||
|
MAPBOX_API_KEY = os.getenv("MAPBOX_API_KEY", "")
|
||||||
|
|
||||||
|
CACHE_CONFIG = {
|
||||||
|
"CACHE_TYPE": "RedisCache",
|
||||||
|
"CACHE_DEFAULT_TIMEOUT": 300,
|
||||||
|
"CACHE_KEY_PREFIX": "superset_",
|
||||||
|
"CACHE_REDIS_HOST": "redis",
|
||||||
|
"CACHE_REDIS_PORT": 6379,
|
||||||
|
"CACHE_REDIS_DB": 1,
|
||||||
|
"CACHE_REDIS_URL": f"redis://:{os.getenv('REDIS_PASSWORD')}@redis:6379/1",
|
||||||
|
}
|
||||||
|
|
||||||
|
FILTER_STATE_CACHE_CONFIG = {**CACHE_CONFIG, "CACHE_KEY_PREFIX": "superset_filter_"}
|
||||||
|
EXPLORE_FORM_DATA_CACHE_CONFIG = {**CACHE_CONFIG, "CACHE_KEY_PREFIX": "superset_explore_form_"}
|
||||||
|
|
||||||
|
SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{os.getenv('POSTGRES_USER')}:{os.getenv('POSTGRES_PASSWORD')}@db:5432/{os.getenv('POSTGRES_DB')}"
|
||||||
|
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
||||||
|
`.trim(),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
envs,
|
envs,
|
||||||
domains,
|
domains,
|
||||||
|
mounts,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user