mirror of
https://github.com/apache/superset.git
synced 2026-05-12 03:15:55 +00:00
chore: isolate examples database by default (#25003)
(cherry picked from commit 269c99293f)
This commit is contained in:
committed by
Michael S. Molina
parent
ea27cf13d3
commit
c2c5f232c8
@@ -22,6 +22,12 @@ DATABASE_HOST=db
|
||||
DATABASE_PASSWORD=superset
|
||||
DATABASE_USER=superset
|
||||
|
||||
EXAMPLES_DB=examples
|
||||
EXAMPLES_HOST=db
|
||||
EXAMPLES_USER=examples
|
||||
EXAMPLES_PASSWORD=examples
|
||||
EXAMPLES_PORT=5432
|
||||
|
||||
# database engine specific environment variables
|
||||
# change the below if you prefer another database engine
|
||||
DATABASE_PORT=5432
|
||||
|
||||
15
docker/docker-entrypoint-initdb.d/examples-init.sh
Executable file
15
docker/docker-entrypoint-initdb.d/examples-init.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
# ------------------------------------------------------------------------
|
||||
# Creates the examples database and repective user. This database location
|
||||
# and access credentials are defined on the environment variables
|
||||
# ------------------------------------------------------------------------
|
||||
set -e
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "${POSTGRES_USER}" <<-EOSQL
|
||||
CREATE USER ${EXAMPLES_USER} WITH PASSWORD '${EXAMPLES_PASSWORD}';
|
||||
CREATE DATABASE ${EXAMPLES_DB};
|
||||
GRANT ALL PRIVILEGES ON DATABASE ${EXAMPLES_DB} TO ${EXAMPLES_USER};
|
||||
EOSQL
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "${POSTGRES_USER}" -d "${EXAMPLES_DB}" <<-EOSQL
|
||||
GRANT ALL ON SCHEMA public TO ${EXAMPLES_USER};
|
||||
EOSQL
|
||||
@@ -51,14 +51,24 @@ DATABASE_HOST = get_env_variable("DATABASE_HOST")
|
||||
DATABASE_PORT = get_env_variable("DATABASE_PORT")
|
||||
DATABASE_DB = get_env_variable("DATABASE_DB")
|
||||
|
||||
EXAMPLES_USER = get_env_variable("EXAMPLES_USER")
|
||||
EXAMPLES_PASSWORD = get_env_variable("EXAMPLES_PASSWORD")
|
||||
EXAMPLES_HOST = get_env_variable("EXAMPLES_HOST")
|
||||
EXAMPLES_PORT = get_env_variable("EXAMPLES_PORT")
|
||||
EXAMPLES_DB = get_env_variable("EXAMPLES_DB")
|
||||
|
||||
|
||||
# The SQLAlchemy connection string.
|
||||
SQLALCHEMY_DATABASE_URI = "{}://{}:{}@{}:{}/{}".format(
|
||||
DATABASE_DIALECT,
|
||||
DATABASE_USER,
|
||||
DATABASE_PASSWORD,
|
||||
DATABASE_HOST,
|
||||
DATABASE_PORT,
|
||||
DATABASE_DB,
|
||||
SQLALCHEMY_DATABASE_URI = (
|
||||
f"{DATABASE_DIALECT}://"
|
||||
f"{DATABASE_USER}:{DATABASE_PASSWORD}@"
|
||||
f"{DATABASE_HOST}:{DATABASE_PORT}/{DATABASE_DB}"
|
||||
)
|
||||
|
||||
SQLALCHEMY_EXAMPLES_URI = (
|
||||
f"{DATABASE_DIALECT}://"
|
||||
f"{EXAMPLES_USER}:{EXAMPLES_PASSWORD}@"
|
||||
f"{EXAMPLES_HOST}:{EXAMPLES_PORT}/{EXAMPLES_DB}"
|
||||
)
|
||||
|
||||
REDIS_HOST = get_env_variable("REDIS_HOST")
|
||||
|
||||
Reference in New Issue
Block a user