Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 1 addition & 87 deletions .build-files/docker-compose-local.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,91 +22,6 @@ services:
- path: ${DOCKER_ENV_FILE} # relative to docker compose (has to be in same directory)
required: true

# Depends on database. Database must be healthy before starting server
server:
build:
context: ../ # relative to docker compose
dockerfile: ./.build-files/Dockerfile.server # relatvie to build context
args:
DOCKER_ENV_FILE: ${DOCKER_ENV_FILE}
ports:
- "8000:8000"
environment:
DJANGO_ENV_FILE: "/app/.env"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy

celery:
build:
context: ../ # relative to docker compose
dockerfile: ./.build-files/Dockerfile.celery # relatvie to build context
args:
DOCKER_ENV_FILE: ${DOCKER_ENV_FILE}
command:
[
"celery",
"--app",
"celery_app",
"worker",
"--loglevel",
"info",
"--without-heartbeat",
"-c",
"4",
]
# Docker Compose does not set the TTY width, which causes Celery errors
tty: false
environment:
DJANGO_ENV_FILE: "/app/.env"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy

# MySQL service. Has healthcheck which uses mysqladmin to ping before reporting healthy.
db:
image: mysql:latest
environment:
MYSQL_DATABASE: ${DATABASE_NAME}
MYSQL_USER: ${DATABASE_USER}
MYSQL_PASSWORD: ${DATABASE_PASSWORD}
MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD}
volumes:
- mysql-data:/var/lib/mysql
ports:
- "3306:3306"
healthcheck:
test:
[
"CMD",
"mysqladmin",
"ping",
"-h",
"localhost",
"-u",
"root",
"-p${DATABASE_ROOT_PASSWORD}",
]
timeout: 20s
retries: 10
env_file:
- path: ${DOCKER_ENV_FILE} # relative to docker compose (has to be in same directory)
required: true

redis:
image: redis:latest
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5

data:
build:
context: ./
Expand All @@ -125,6 +40,5 @@ services:
- duckdb-data:/app/duckdb-data

volumes:
mysql-data:
duckdb-data:
migrations_volume:
migrations_volume:
7 changes: 0 additions & 7 deletions .build-files/nginx-http-local.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ http {
try_files $uri $uri/ /index.html;
}

location /api {
proxy_pass http://server:8000/api;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location /data {
proxy_pass http://data:9000/;
Expand Down
17 changes: 13 additions & 4 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,12 @@ def build_containers(env_file, disable_spinner=False):
else:
print("Building containers...")

process = run_command(f"docker-compose -f .build-files/docker-compose.yml"
f" --env-file {env_file} build")
service_string = ""
if services is not None:
service_string = " ".join(services)

command = f"docker-compose -f .build-files/docker-compose.yml --env-file {env_file} build {service_string}"
process = run_command(command)
process.wait() # Wait for the build to complete

if not disable_spinner:
Expand Down Expand Up @@ -331,8 +335,13 @@ def start_containers(env_file, disable_spinner=False):
spinner_thread.start()
else:
print("Starting containers...")
process = run_command(f"docker-compose -f .build-files/docker-compose.yml"
f" --env-file {env_file} up -d")

service_string = ""
if services is not None:
service_string = " ".join(services)

command = f"docker-compose -f .build-files/docker-compose.yml --env-file {env_file} up -d {service_string}"
process = run_command(command)

process.wait() # Wait for the containers to start

Expand Down
Loading