diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ .tox docker/*.override.yml docker/tests/*.logs +*~ diff --git a/docker/conf/winery.yml b/docker/conf/winery.yml new file mode 100644 --- /dev/null +++ b/docker/conf/winery.yml @@ -0,0 +1,7 @@ +objstorage: + cls: winery + base_dsn: postgresql://postgres:testpassword@swh-winery-db + shard_dsn: postgresql://postgres:testpassword@swh-winery-db + shard_max_size: 10485760 + +client_max_size: 1073741824 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -243,6 +243,30 @@ - "./conf/storage.yml:/storage.yml:ro" - "./services/swh-storage/entrypoint.sh:/entrypoint.sh:ro" + # Winery object storage + + swh-winery-db: + image: postgres:13 + env_file: + - ./env/common_python.env + - ./env/winery-db.env + + swh-winery: + build: ./ + image: swh/stack + ports: + - 5012:5012 + depends_on: + - swh-winery-db + env_file: + - ./env/common_python.env + environment: + SWH_CONFIG_FILENAME: /winery.yml + entrypoint: /entrypoint.sh + volumes: + - "./conf/winery.yml:/winery.yml:ro" + - "./services/swh-winery/entrypoint.sh:/entrypoint.sh:ro" + # Object storage swh-objstorage: diff --git a/docker/env/winery-db.env b/docker/env/winery-db.env new file mode 100644 --- /dev/null +++ b/docker/env/winery-db.env @@ -0,0 +1,2 @@ +POSTGRES_PASSWORD=testpassword +POSTGRES_DB=sharedbase diff --git a/docker/services/swh-winery/entrypoint.sh b/docker/services/swh-winery/entrypoint.sh new file mode 100755 --- /dev/null +++ b/docker/services/swh-winery/entrypoint.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e + +source /srv/softwareheritage/utils/pyutils.sh +setup_pip + +echo Installed Python packages: +pip list + +if [ "$1" = 'shell' ] ; then + exec bash -i +else + echo Starting the swh-winery API server + exec gunicorn --bind 0.0.0.0:5012 \ + --worker-class aiohttp.worker.GunicornWebWorker \ + --log-level DEBUG \ + --threads 4 \ + --workers 2 \ + --reload \ + --timeout 3600 \ + --config 'python:swh.core.api.gunicorn_config' \ + 'swh.objstorage.api.server:make_app_from_configfile()' + +fi