Skip to content

Commit

Permalink
added the ability to run the calendar in the docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Nov 4, 2023
1 parent 0f18850 commit e87bbe2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TILE_SPRITES_URL=https://raw.githubusercontent.com/maputnik/osm-liberty/gh-pages
# database
POSTGRES_PASSWORD=CHANGE_ME
POSTGRES_USER=navigatum
POSTGRES_DB=navigatum

# feedback
GITHUB_TOKEN=CHANGE_ME
Expand Down
23 changes: 20 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ services:
depends_on:
meilisearch:
condition: service_healthy
required: true
restart: true
healthcheck:
test: wget -q --spider http://localhost:3003/api/status
retries: 5
Expand All @@ -83,14 +81,33 @@ services:
test: wget -q --spider http://localhost:3004/api/feedback/status
retries: 5
start_period: 10s
calendar-api:
image: ghcr.io/tum-dev/navigatum-server:latest
restart: always
build: ./server
command: /bin/navigatum-calendar
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_URL: postgres:5432
depends_on:
db:
condition: service_healthy
ports:
- "3005:3005"
healthcheck:
test: wget -q --spider http://localhost:3005/api/calendar/status
retries: 5
start_period: 10s
db:
image: postgres:15
restart: unless-stopped
environment:
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
Expand Down
2 changes: 2 additions & 0 deletions server/calendar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ async fn health_status_handler() -> HttpResponse {
}

use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
use log::debug;
use structured_logger::async_json::new_writer;
use structured_logger::Builder;

pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!("migrations");

fn apply_db_migrations() {
info!("Applying database migrations");
let con = &mut utils::establish_connection();
con.run_pending_migrations(MIGRATIONS)
.expect("Migrations could not be applied");
Expand Down
3 changes: 3 additions & 0 deletions webclient/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ http {
location /api/feedback {
proxy_pass http://feedback-api:3004;
}
location /api/calendar {
proxy_pass http://calendar-api:3005;
}
location /cdn {
proxy_pass http://data:3002;
}
Expand Down

0 comments on commit e87bbe2

Please sign in to comment.