diff --git a/docker/conf/web.yml b/docker/conf/web.yml --- a/docker/conf/web.yml +++ b/docker/conf/web.yml @@ -28,8 +28,12 @@ serve_assets: yes -development_db: /tmp/db.sqlite3 -production_db: /tmp/db.sqlite3 +db: + host: swh-web-db + port: 5432 + name: swh-web + user: postgres + password: testpassword throttling: cache_uri: 127.0.0.1:11211 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -211,6 +211,10 @@ - "./services/swh-indexer-storage/entrypoint.sh:/entrypoint.sh:ro" # Web interface + swh-web-db: + image: postgres:12 + env_file: + - ./env/01-web-db.env swh-web: build: ./ @@ -220,8 +224,11 @@ depends_on: - swh-storage - swh-idx-storage + - swh-web-db env_file: - ./env/common_python.env + - ./env/01-web-db.env + - ./env/02-web-db.env environment: VERBOSITY: 3 DJANGO_SETTINGS_MODULE: swh.web.settings.production diff --git a/docker/services/swh-web/entrypoint.sh b/docker/services/swh-web/entrypoint.sh --- a/docker/services/swh-web/entrypoint.sh +++ b/docker/services/swh-web/entrypoint.sh @@ -15,6 +15,9 @@ User.objects.create_superuser(username, email, password); " +source /srv/softwareheritage/utils/pgsql.sh +setup_pgsql + source /srv/softwareheritage/utils/pyutils.sh setup_pip @@ -26,6 +29,8 @@ echo "Starting memcached" memcached& + wait_pgsql + echo "Migrating db using ${DJANGO_SETTINGS_MODULE}" django-admin migrate --settings=${DJANGO_SETTINGS_MODULE}