Skip to content

Commit 34dd5ef

Browse files
PEP458: Add minimal RSTUF service configuration (#15241)
* remove vault container The vault container was a previous TUF implementation (TUF initialization #7488) The new integration with RSTUF does not require this container. Signed-off-by: Kairo de Araujo <[email protected]> * PEP 458: Add RSTUF services in the Warehouse Infra This commit adds the RSTUF services to the Warehouse infrastructure for development and sets the minimum required to start RSTUF services. It adds the RSTUF API, which is used later to integrate into Warehouse and RSTUF Worker, which is responsible for computing the TUF metadata. The RSTUF requires the Postgres and Redis. Postgres stores the rstuf database used for TUF metadata computing. Redis stores the task message queue between RSTUF API and Worker, task backend result, and live settings between RSTUF services. RSTUF shares the same Postgres and Redis in development environment but has a specific setup to use its own Postgres database and Redis database ID. Postgresql URI `RSTUF_SQL_SERVER=postgresql://postgres@db:5432/rstuf` Redis DB Broker and Result is id 1 `RSTUF_BROKER_SERVER=redis://redis/1` `RSTUF_REDIS_SERVER_DB_RESULT=1` Redis DB for TUF repository settings is 2 `RSTUF_REDIS_SERVER_DB_REPO_SETTINGS=2` This commit also includes TUF database creation in the Makefile during the `make initdb`. Signed-off-by: Kairo de Araujo <[email protected]> * remove rstuf-worker unnecessary settings Remove settings from rstuf-worker in docker-compose.yml Signed-off-by: Kairo de Araujo <[email protected]> * remove vault volume from docker-compose --------- Signed-off-by: Kairo de Araujo <[email protected]> Co-authored-by: Ee Durbin <[email protected]>
1 parent 8f395d8 commit 34dd5ef

File tree

5 files changed

+29
-77
lines changed

5 files changed

+29
-77
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ initdb: .state/docker-build-base
101101
docker compose run --rm web psql -h db -d postgres -U postgres -c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname ='warehouse';"
102102
docker compose run --rm web psql -h db -d postgres -U postgres -c "DROP DATABASE IF EXISTS warehouse"
103103
docker compose run --rm web psql -h db -d postgres -U postgres -c "CREATE DATABASE warehouse ENCODING 'UTF8'"
104+
docker compose run --rm web psql -h db -d postgres -U postgres -c "DROP DATABASE IF EXISTS rstuf"
105+
docker compose run --rm web psql -h db -d postgres -U postgres -c "CREATE DATABASE rstuf ENCODING 'UTF8'"
104106
docker compose run --rm web bash -c "xz -d -f -k dev/$(DB).sql.xz --stdout | psql -h db -d warehouse -U postgres -v ON_ERROR_STOP=1 -1 -f -"
105107
docker compose run --rm web psql -h db -d warehouse -U postgres -c "UPDATE users SET name='Ee Durbin' WHERE username='ewdurbin'"
106108
$(MAKE) runmigrations

dev/environment

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ TOKEN_REMEMBER_DEVICE_SECRET="an insecure remember device auth secret key"
5858

5959
WAREHOUSE_LEGACY_DOMAIN=pypi.python.org
6060

61-
VAULT_URL="http://vault:8200"
62-
VAULT_TOKEN="an insecure vault access token"
63-
6461
GITHUB_TOKEN_SCANNING_META_API_URL="http://notgithub:8000/meta/public_keys/token_scanning"
6562
TWOFACTORREQUIREMENT_ENABLED=true
6663
TWOFACTORMANDATE_AVAILABLE=true

dev/vault/config.hcl

Lines changed: 0 additions & 3 deletions
This file was deleted.

dev/vault/entry.sh

Lines changed: 0 additions & 52 deletions
This file was deleted.

docker-compose.yml

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,10 @@ volumes:
66
packages-archive:
77
sponsorlogos:
88
policies:
9-
vault:
109
caches:
10+
rstuf-metadata:
1111

1212
services:
13-
vault:
14-
# NOTE: pinned for consistency with whats available in our deployment
15-
image: vault:1.12.3
16-
restart: on-failure
17-
entrypoint: /bin/sh
18-
command: /etc/vault/entry.sh
19-
stop_signal: SIGINT
20-
environment:
21-
VAULT_DEV_LISTEN_ADDRESS: 0.0.0.0:8200
22-
VAULT_DEV_ROOT_TOKEN_ID: "an insecure vault access token"
23-
ports:
24-
- "8200:8200"
25-
cap_add:
26-
- IPC_LOCK
27-
volumes:
28-
- vault:/vault/file
29-
- ./dev/vault:/etc/vault
30-
3113
db:
3214
image: postgres:14.4
3315
ports:
@@ -160,6 +142,32 @@ services:
160142
ARCHIVE_FILES_BACKEND: "warehouse.packaging.services.LocalArchiveFileStorage path=/var/opt/warehouse/packages-archive/ url=http://files:9001/packages-archive/{path}"
161143
SIMPLE_BACKEND: "warehouse.packaging.services.LocalSimpleStorage path=/var/opt/warehouse/simple/ url=http://files:9001/simple/{path}"
162144

145+
rstuf-api:
146+
image: ghcr.io/repository-service-tuf/repository-service-tuf-api:v0.9.0b1
147+
ports:
148+
- 8001:80
149+
environment:
150+
- RSTUF_BROKER_SERVER=redis://redis/1
151+
- RSTUF_REDIS_SERVER=redis://redis
152+
- RSTUF_REDIS_SERVER_DB_RESULT=1
153+
- RSTUF_REDIS_SERVER_DB_REPO_SETTINGS=2
154+
155+
rstuf-worker:
156+
image: ghcr.io/repository-service-tuf/repository-service-tuf-worker:v0.11.0b1
157+
volumes:
158+
- rstuf-metadata:/var/opt/repository-service-tuf/storage
159+
environment:
160+
- RSTUF_STORAGE_BACKEND=LocalStorage
161+
- RSTUF_LOCAL_STORAGE_BACKEND_PATH=/var/opt/repository-service-tuf/storage
162+
- RSTUF_BROKER_SERVER=redis://redis/1
163+
- RSTUF_REDIS_SERVER=redis://redis
164+
- RSTUF_REDIS_SERVER_DB_RESULT=1
165+
- RSTUF_REDIS_SERVER_DB_REPO_SETTINGS=2
166+
- RSTUF_SQL_SERVER=postgresql://postgres@db:5432/rstuf
167+
depends_on:
168+
db:
169+
condition: service_healthy
170+
163171
static:
164172
build:
165173
context: .

0 commit comments

Comments
 (0)