Skip to content

Commit

Permalink
use extend for docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmi151 committed Feb 14, 2025
1 parent 43a414d commit 0f1a51c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 86 deletions.
2 changes: 1 addition & 1 deletion backend/maelstro/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def substitute_single_credentials_from_env(
if common_password is not None:
if server_instance.get("password") is None:
server_instance["password"] = common_password
print(server_instance)

return Credentials(server_instance.get("login"), server_instance.get("password"))


Expand Down
39 changes: 0 additions & 39 deletions config/nginx-solo.conf

This file was deleted.

32 changes: 21 additions & 11 deletions docker-compose-solo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ volumes:

services:
database:
image: georchestra/database:24.0.x
image: postgres:16
environment:
- PGHOST=database
- PGPORT=5432
Expand All @@ -30,16 +30,19 @@ services:
timeout: 10s
volumes:
- ./config/:/etc/maelstro/:ro
- ./config/nginx-solo.conf:/etc/nginx/conf.d/default.conf:ro
ports:
- "8080:8080"
environment:
CUSTOM_SCRIPTS_DIRECTORY: /etc/maelstro/scripts

maelstro-back:
build:
context: ./backend
target: server
healthcheck:
test: "health_check"
interval: 10s
retries: 5
start_period: 10s
timeout: 10s
volumes:
- ./backend:/app
- ./config/:/etc/maelstro/:ro
Expand All @@ -53,11 +56,18 @@ services:
PGDATABASE: "georchestra"
PGUSER: "georchestra"
PGPASSWORD: "georchestra"
healthcheck:
test: "health_check"
interval: 10s
retries: 5
start_period: 10s
timeout: 10s

command:
- serve_docker_dev
- serve_docker_dev
check:
profiles:
- check
build:
context: ./backend
target: check
environment:
MAELSTRO_CONFIG: /app/tests/test_config.yaml
LOCAL_LOGIN: testadmin
LOCAL_PASSWORD: testadmin
volumes:
- ./backend:/app
53 changes: 18 additions & 35 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,39 @@ include:

services:
maelstro-front:
build:
context: ./frontend
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/maelstro/"]
interval: 10s
retries: 5
start_period: 10s
timeout: 10s
extends:
file: docker-compose-solo.yml
service: maelstro-front
volumes:
- georchestra_datadir:/etc/georchestra
ports: []
environment:
CUSTOM_SCRIPTS_DIRECTORY: /etc/georchestra/maelstro/scripts
depends_on:
envsubst:
condition: service_completed_successfully

maelstro-back:
build:
context: ./backend
target: server
depends_on:
envsubst:
condition: service_completed_successfully
extends:
file: docker-compose-solo.yml
service: maelstro-back
volumes:
- ./backend:/app
- georchestra_datadir:/etc/georchestra
depends_on:
envsubst:
condition: service_completed_successfully
environment:
MAELSTRO_CONFIG: /app/dev_config.yaml
LOCAL_LOGIN: testadmin
LOCAL_PASSWORD: testadmin
healthcheck:
test: "health_check"
interval: 10s
retries: 5
start_period: 10s
timeout: 10s
command:
- serve_docker_dev
ports:
- 127.0.0.1:8000:8000 # Used for frontend development
PGHOST: "database"
PGPORT: "5432"
PGDATABASE: "georchestra"
PGUSER: "georchestra"
PGPASSWORD: "georchestra"

check:
profiles:
- check
build:
context: ./backend
target: check
environment:
MAELSTRO_CONFIG: /app/tests/test_config.yaml
LOCAL_LOGIN: testadmin
LOCAL_PASSWORD: testadmin
volumes:
- ./backend:/app
extends:
file: docker-compose-solo.yml
service: check
5 changes: 5 additions & 0 deletions frontend/nginx-default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ server {
add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always;
}

location /maelstro-backend {
proxy_pass http://maelstro-back:8000;
add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always;
}

# all assets contain hash in filename, cache forever
location ^~ /assets/ {
alias /app;
Expand Down

0 comments on commit 0f1a51c

Please sign in to comment.