diff --git a/.mrconfig b/.mrconfig --- a/.mrconfig +++ b/.mrconfig @@ -51,6 +51,10 @@ grep -q pre-commit.com .git/hooks/pre-commit || pre-commit install grep -q pre-commit.com .git/hooks/commit-msg || pre-commit install -t commit-msg +[swh-graphql] +checkout = git clone 'https://forge.softwareheritage.org/source/swh-graphql.git' 'swh-graphql' +fixups = grep -q pre-commit.com .git/hooks/pre-commit || pre-commit install + [swh-icinga-plugins] checkout = git clone 'https://forge.softwareheritage.org/source/swh-icinga-plugins.git' 'swh-icinga-plugins' fixups = diff --git a/docker/Dockerfile b/docker/Dockerfile --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -69,6 +69,7 @@ swh-core[db,http] \ swh-counters \ swh-deposit[server] \ + swh-graphql \ swh-indexer \ swh-journal \ swh-lister \ diff --git a/docker/conf/graphql.yml b/docker/conf/graphql.yml new file mode 100644 --- /dev/null +++ b/docker/conf/graphql.yml @@ -0,0 +1,5 @@ +storage: + cls: remote + url: http://webapp.internal.staging.swh.network:5002 + +debug: yes diff --git a/docker/docker-compose.graphql.yml b/docker/docker-compose.graphql.yml new file mode 100644 --- /dev/null +++ b/docker/docker-compose.graphql.yml @@ -0,0 +1,16 @@ +version: "2.1" + +services: + swh-graphql: + image: swh/stack + build: ./ + entrypoint: /entrypoint.sh + ports: + - 5013:5013 + environment: + SWH_CONFIG_FILENAME: /graphql.yml + env_file: + - ./env/common_python.env + volumes: + - "./conf/graphql.yml:/graphql.yml:ro" + - "./services/swh-graphql/entrypoint.sh:/entrypoint.sh:ro" diff --git a/docker/services/swh-graphql/entrypoint.sh b/docker/services/swh-graphql/entrypoint.sh new file mode 100755 --- /dev/null +++ b/docker/services/swh-graphql/entrypoint.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +source /srv/softwareheritage/utils/pyutils.sh +setup_pip + +case "$1" in + "shell") + exec bash -i + ;; + *) + echo Starting the swh-graphql API server + + exec gunicorn --bind 0.0.0.0:5013 \ + --reload \ + --threads 4 \ + --workers 2 \ + --log-level DEBUG \ + --timeout 3600 \ + --config 'python:swh.core.api.gunicorn_config' \ + 'swh.graphql.server:make_app_from_configfile()' + ;; +esac