faster docker

This commit is contained in:
Alessio 2025-08-02 07:58:27 +02:00
parent 9a3b6c1e75
commit acf169edaf
3 changed files with 5 additions and 10 deletions

View file

@ -3,7 +3,7 @@ set -e
python3 -m venv .env
source ./.env/bin/activate
pip install -r src/requirements/production.txt -r src/requirements/dev.txt
pip install psycopg2 pylibmc
pip install psycopg2
sudo pacman -Sy librsvg
./start_db.sh db

View file

@ -15,7 +15,7 @@ x-healthcheck_defaults: &healthcheck_defaults
interval: 10s
timeout: 2s
retries: 5
start_period: 5s
start_period: 10s
x-c3nav-defaults: &c3nav-defaults
build:
context: ..
@ -81,7 +81,7 @@ services:
image: postgres:16
healthcheck:
<<: *healthcheck_defaults
test: pg_isready -U postgres
test: pg_isready -U postgres && psql -U postgres -d ${C3NAV_DATABASE_NAME:-c3nav} -c "SELECT 1;"
environment:
POSTGRES_DB: ${C3NAV_DATABASE_NAME:-c3nav}
POSTGRES_HOST_AUTH_METHOD: "trust"

View file

@ -12,17 +12,13 @@ docker volume create c3nav-redis
# Start only postgres and redis first (no build since we pre-built)
docker compose up -d postgres redis
sleep 10
sleep 5
cat ./db/auth_user.sql | docker exec -i local_run-postgres-1 su - postgres -c 'psql c3nav'
# Create Django superuser
sleep 1
# Load database dump before starting the main app
cat ./db/dump.sql | docker exec -i local_run-postgres-1 su - postgres -c 'psql c3nav'
cat ./db/dump.sql | docker exec -i local_run-postgres-1 su - postgres -c 'psql c3nav' > /dev/null
# Fix geometry access permissions for anonymous users
docker exec -i local_run-postgres-1 psql -U postgres -d c3nav -c "UPDATE mapdata_space SET base_mapdata_accessible = true;"
@ -38,7 +34,6 @@ user.set_password('admin')
user.save()
print('Password set successfully for user:', user.username)
\" | /app/env/bin/python manage.py shell"
sleep 30
# Fake apply all migrations since we loaded from dump