Skip to content

Commit 141cb45

Browse files
authored
fix: Fixing issue around requirements-local.txt (apache#11769)
* Fixing issue around requirements-local.txt * Fixing license * Linting
1 parent 1ef3a02 commit 141cb45

File tree

4 files changed

+54
-7
lines changed

4 files changed

+54
-7
lines changed

docker-compose.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ x-superset-depends-on: &superset-depends-on
2020
- redis
2121
x-superset-volumes: &superset-volumes
2222
# /app/pythonpath_docker will be appended to the PYTHONPATH in the final container
23-
- ./docker/docker-init.sh:/app/docker-init.sh
24-
- ./docker/pythonpath_dev:/app/pythonpath
23+
- ./docker:/app/docker
2524
- ./superset:/app/superset
2625
- ./superset-frontend:/app/superset-frontend
2726
- superset_home:/app/superset_home
@@ -51,19 +50,21 @@ services:
5150
env_file: docker/.env
5251
image: *superset-image
5352
container_name: superset_app
54-
command: ["flask", "run", "-p", "8088", "--with-threads", "--reload", "--debugger", "--host=0.0.0.0"]
53+
command: ["/app/docker/docker-bootstrap.sh", "app"]
5554
restart: unless-stopped
5655
ports:
5756
- 8088:8088
57+
user: "root"
5858
depends_on: *superset-depends-on
5959
volumes: *superset-volumes
6060

6161
superset-init:
6262
image: *superset-image
6363
container_name: superset_init
64-
command: ["/app/docker-init.sh"]
64+
command: ["/app/docker/docker-init.sh"]
6565
env_file: docker/.env
6666
depends_on: *superset-depends-on
67+
user: "root"
6768
volumes: *superset-volumes
6869

6970
superset-node:
@@ -77,16 +78,17 @@ services:
7778
superset-worker:
7879
image: *superset-image
7980
container_name: superset_worker
80-
command: ["celery", "worker", "--app=superset.tasks.celery_app:app", "-Ofair", "-l", "INFO"]
81+
command: ["/app/docker/docker-bootstrap.sh", "worker"]
8182
env_file: docker/.env
8283
restart: unless-stopped
8384
depends_on: *superset-depends-on
85+
user: "root"
8486
volumes: *superset-volumes
8587

8688
superset-tests-worker:
8789
image: *superset-image
8890
container_name: superset_tests_worker
89-
command: ["celery", "worker", "--app=superset.tasks.celery_app:app", "-Ofair", "-l", "INFO"]
91+
command: ["/app/docker/docker-bootstrap.sh", "worker"]
9092
env_file: docker/.env
9193
environment:
9294
DATABASE_HOST: localhost
@@ -96,6 +98,7 @@ services:
9698
REDIS_HOST: localhost
9799
network_mode: host
98100
depends_on: *superset-depends-on
101+
user: "root"
99102
volumes: *superset-volumes
100103

101104
volumes:

docker/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ POSTGRES_PASSWORD=superset
3535
#MYSQL_RANDOM_ROOT_PASSWORD=yes
3636

3737
# Add the mapped in /app/pythonpath_docker which allows devs to override stuff
38-
PYTHONPATH=/app/pythonpath:/app/pythonpath_docker
38+
PYTHONPATH=/app/pythonpath:/app/docker/pythonpath_dev
3939
REDIS_HOST=redis
4040
REDIS_PORT=6379
4141

docker/docker-bootstrap.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
set -eo pipefail
20+
21+
REQUIREMENTS_LOCAL="/app/docker/requirements-local.txt"
22+
23+
#
24+
# Make sure we have dev requirements installed
25+
#
26+
if [ -f "${REQUIREMENTS_LOCAL}" ]; then
27+
echo "Installing local overrides at ${REQUIREMENTS_LOCAL}"
28+
pip install -r "${REQUIREMENTS_LOCAL}"
29+
else
30+
echo "Skipping local overrides"
31+
fi
32+
33+
if [[ "${1}" == "worker" ]]; then
34+
echo "Starting Celery worker..."
35+
celery worker --app=superset.tasks.celery_app:app -Ofair -l INFO
36+
elif [[ "${1}" == "app" ]]; then
37+
echo "Starting web app..."
38+
flask run -p 8088 --with-threads --reload --debugger --host=0.0.0.0
39+
fi

docker/docker-init.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
#
1818
set -e
1919

20+
#
21+
# Always install local overrides first
22+
#
23+
/app/docker/docker-bootstrap.sh
24+
2025
STEP_CNT=4
2126

2227
echo_step() {

0 commit comments

Comments
 (0)