diff --git a/apps/superset/.env b/apps/superset/.env index 0c4d2c01e..b2d343862 100644 --- a/apps/superset/.env +++ b/apps/superset/.env @@ -5,7 +5,7 @@ W9_DIST=community W9_REPO=apache/superset # latest is not stable version -W9_VERSION=2.1.0 +W9_VERSION=4.1.1 W9_POWER_PASSWORD=uQ8E1wVTzG8SOk3! #### -- Not allowed to edit below environments when recreate app based on existing data -- #### @@ -13,7 +13,7 @@ W9_ID=superset W9_HTTP_PORT=8088 W9_HTTP_PORT_SET=9001 W9_LOGIN_USER=admin -W9_LOGIN_PASSWORD=$W9_POWER_PASSWORD +W9_LOGIN_PASSWORD=admin W9_URL_REPLACE=false W9_URL=appname.example.com W9_DB_EXPOSE="postgresql" diff --git a/apps/superset/src/docker/.env b/apps/superset/src/docker/.env old mode 100644 new mode 100755 index 25bdac0ab..57575da76 --- a/apps/superset/src/docker/.env +++ b/apps/superset/src/docker/.env @@ -14,17 +14,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # + + COMPOSE_PROJECT_NAME=superset # database configurations (do not modify) DATABASE_DB=superset DATABASE_HOST=db +# Make sure you set this to a unique secure random value on production DATABASE_PASSWORD=superset DATABASE_USER=superset EXAMPLES_DB=examples EXAMPLES_HOST=db EXAMPLES_USER=examples +# Make sure you set this to a unique secure random value on production EXAMPLES_PASSWORD=examples EXAMPLES_PORT=5432 @@ -34,6 +38,7 @@ DATABASE_PORT=5432 DATABASE_DIALECT=postgresql POSTGRES_DB=superset POSTGRES_USER=superset +# Make sure you set this to a unique secure random value on production POSTGRES_PASSWORD=superset #MYSQL_DATABASE=superset #MYSQL_USER=superset @@ -51,3 +56,10 @@ SUPERSET_LOAD_EXAMPLES=yes CYPRESS_CONFIG=false SUPERSET_PORT=8088 MAPBOX_API_KEY='' + +# Make sure you set this to a unique secure random value on production +SUPERSET_SECRET_KEY=TEST_NON_DEV_SECRET + +ENABLE_PLAYWRIGHT=false +PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true +BUILD_SUPERSET_FRONTEND_IN_DOCKER=true diff --git a/apps/superset/src/docker/.env-non-dev b/apps/superset/src/docker/.env-non-dev deleted file mode 100644 index a86ddbd19..000000000 --- a/apps/superset/src/docker/.env-non-dev +++ /dev/null @@ -1,53 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -COMPOSE_PROJECT_NAME=superset - -# database configurations (do not modify) -DATABASE_DB=superset -DATABASE_HOST=db -DATABASE_PASSWORD=superset -DATABASE_USER=superset -DATABASE_PORT=5432 -DATABASE_DIALECT=postgresql - -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 -POSTGRES_DB=superset -POSTGRES_USER=superset -POSTGRES_PASSWORD=superset -#MYSQL_DATABASE=superset -#MYSQL_USER=superset -#MYSQL_PASSWORD=superset -#MYSQL_RANDOM_ROOT_PASSWORD=yes - -# Add the mapped in /app/pythonpath_docker which allows devs to override stuff -PYTHONPATH=/app/pythonpath:/app/docker/pythonpath_dev -REDIS_HOST=redis -REDIS_PORT=6379 - -SUPERSET_ENV=production -SUPERSET_LOAD_EXAMPLES=yes -SUPERSET_SECRET_KEY=TEST_NON_DEV_SECRET -CYPRESS_CONFIG=false -SUPERSET_PORT=8088 -MAPBOX_API_KEY='' diff --git a/apps/superset/src/docker/README.md b/apps/superset/src/docker/README.md old mode 100644 new mode 100755 diff --git a/apps/superset/src/docker/apt-install.sh b/apps/superset/src/docker/apt-install.sh new file mode 100755 index 000000000..bd9152beb --- /dev/null +++ b/apps/superset/src/docker/apt-install.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +set -euo pipefail + +# Ensure this script is run as root +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" >&2 + exit 1 +fi + +# Check for required arguments +if [[ $# -lt 1 ]]; then + echo "Usage: $0 [ ...]" >&2 + exit 1 +fi + +# Colors for better logging (optional) +GREEN='\033[0;32m' +RED='\033[0;31m' +RESET='\033[0m' + +# Install packages with clean-up +echo -e "${GREEN}Updating package lists...${RESET}" +apt-get update -qq + +echo -e "${GREEN}Installing packages: $@${RESET}" +apt-get install -yqq --no-install-recommends "$@" + +echo -e "${GREEN}Autoremoving unnecessary packages...${RESET}" +apt-get autoremove -y + +echo -e "${GREEN}Cleaning up package cache and metadata...${RESET}" +apt-get clean +rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* /tmp/* /var/tmp/* + +echo -e "${GREEN}Installation and cleanup complete.${RESET}" diff --git a/apps/superset/src/docker/docker-bootstrap.sh b/apps/superset/src/docker/docker-bootstrap.sh index 7d53f9289..982891249 100755 --- a/apps/superset/src/docker/docker-bootstrap.sh +++ b/apps/superset/src/docker/docker-bootstrap.sh @@ -17,7 +17,7 @@ # set -eo pipefail - +pip install sqlalchemy-drill psycopg2-binary REQUIREMENTS_LOCAL="/app/docker/requirements-local.txt" # If Cypress run – overwrite the password for admin and export env variables if [ "$CYPRESS_CONFIG" == "true" ]; then @@ -35,18 +35,11 @@ else echo "Skipping local overrides" fi -# -# playwright is an optional package - run only if it is installed -# -if command -v playwright > /dev/null 2>&1; then - playwright install-deps - playwright install chromium -fi - case "${1}" in worker) echo "Starting Celery worker..." - celery --app=superset.tasks.celery_app:app worker -O fair -l INFO + # setting up only 2 workers by default to contain memory usage in dev environments + celery --app=superset.tasks.celery_app:app worker -O fair -l INFO --concurrency=${CELERYD_CONCURRENCY:-2} ;; beat) echo "Starting Celery beat..." diff --git a/apps/superset/src/docker/docker-entrypoint-initdb.d/examples-init.sh b/apps/superset/src/docker/docker-entrypoint-initdb.d/examples-init.sh index 0eaedf2b7..bed154325 100755 --- a/apps/superset/src/docker/docker-entrypoint-initdb.d/examples-init.sh +++ b/apps/superset/src/docker/docker-entrypoint-initdb.d/examples-init.sh @@ -1,3 +1,22 @@ +#!/usr/bin/env bash + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + # ------------------------------------------------------------------------ # Creates the examples database and respective user. This database location # and access credentials are defined on the environment variables diff --git a/apps/superset/src/docker/docker-frontend.sh b/apps/superset/src/docker/docker-frontend.sh index a1ad94470..b80e12a0c 100755 --- a/apps/superset/src/docker/docker-frontend.sh +++ b/apps/superset/src/docker/docker-frontend.sh @@ -18,12 +18,27 @@ set -e # Packages needed for puppeteer: -apt update -apt install -y chromium +if [ "$PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" = "false" ]; then + apt update + apt install -y chromium +fi -cd /app/superset-frontend -npm install -f --no-optional --global webpack webpack-cli -npm install -f --no-optional +if [ "$BUILD_SUPERSET_FRONTEND_IN_DOCKER" = "true" ]; then + echo "Building Superset frontend in dev mode inside docker container" + cd /app/superset-frontend -echo "Running frontend" -npm run dev + if [ "$NPM_RUN_PRUNE" = "true" ]; then + echo "Running `npm run prune`" + npm run prune + fi + + echo "Running `npm install`" + npm install + + echo "Running frontend" + npm run dev + +else + echo "Skipping frontend build steps - YOU NEED TO RUN IT MANUALLY ON THE HOST!" + echo "https://superset.apache.org/docs/contributing/development/#webpack-dev-server" +fi diff --git a/apps/superset/src/docker/docker-init.sh b/apps/superset/src/docker/docker-init.sh index 2961dc476..1148a9684 100755 --- a/apps/superset/src/docker/docker-init.sh +++ b/apps/superset/src/docker/docker-init.sh @@ -22,7 +22,11 @@ set -e # /app/docker/docker-bootstrap.sh -STEP_CNT=4 +if [ "$SUPERSET_LOAD_EXAMPLES" = "yes" ]; then + STEP_CNT=4 +else + STEP_CNT=3 +fi echo_step() { cat <