diff --git a/docker/conf/web-keycloak.yml b/docker/conf/web-keycloak.yml --- a/docker/conf/web-keycloak.yml +++ b/docker/conf/web-keycloak.yml @@ -32,8 +32,12 @@ serve_assets: yes -development_db: /tmp/db.sqlite3 -production_db: /tmp/db.sqlite3 +production_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/conf/web-mirror.yml b/docker/conf/web-mirror.yml --- a/docker/conf/web-mirror.yml +++ b/docker/conf/web-mirror.yml @@ -31,3 +31,10 @@ debug: yes serve_assets: yes + +production_db: + host: swh-web-db + port: 5432 + name: swh-web + user: postgres + password: testpassword diff --git a/docker/conf/web-read-replica.yml b/docker/conf/web-read-replica.yml --- a/docker/conf/web-read-replica.yml +++ b/docker/conf/web-read-replica.yml @@ -28,8 +28,12 @@ serve_assets: yes -development_db: /tmp/db.sqlite3 -production_db: /tmp/db.sqlite3 +production_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/conf/web-search.yml b/docker/conf/web-search.yml --- a/docker/conf/web-search.yml +++ b/docker/conf/web-search.yml @@ -33,8 +33,12 @@ serve_assets: yes -development_db: /tmp/db.sqlite3 -production_db: /tmp/db.sqlite3 +production_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/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 +production_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/env/01-web-db.env b/docker/env/01-web-db.env new file mode 100644 --- /dev/null +++ b/docker/env/01-web-db.env @@ -0,0 +1,2 @@ +POSTGRES_DB=swh-web +POSTGRES_PASSWORD=testpassword diff --git a/docker/env/02-web-db.env b/docker/env/02-web-db.env new file mode 100644 --- /dev/null +++ b/docker/env/02-web-db.env @@ -0,0 +1,3 @@ +PGHOST=swh-web-db +PGUSER=postgres + 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}