Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ This project is deployed in accordance to the [DargStack template](https://githu

You cannot access the recommendation service directly.

- ### `reccoom_consumer`

You can track the recommender's event streaming consumer using `redpanda-console`.
Comment thread
dargmuesli marked this conversation as resolved.

- ### `reccoom_migration`

You cannot access the recommender's database migration service directly.
Expand Down Expand Up @@ -404,6 +408,10 @@ This project is deployed in accordance to the [DargStack template](https://githu

The metrics monitoring's data.

- ### `reccoom_fastembed_data`

The recommender's model cache.

- ### `reccoom_postgres_data`

The recommendation database's data.
Expand Down
30 changes: 30 additions & 0 deletions src/development/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,33 @@ services:
volumes:
- ../../../reccoom/:/srv/app/ #DARGSTACK-REMOVE
- ./configurations/postgraphile/jwtES256.key.pub:/run/configurations/jwtES256.key.pub:ro
reccoom_consumer:
# You can track the recommender's event streaming consumer using `redpanda-console`.
command: ["uv", "run", "python", "-m", "src.consumer"]
environment:
Comment thread
dargmuesli marked this conversation as resolved.
KAFKA_BOOTSTRAP_SERVERS: redpanda:9092
POSTGRES_HOST: postgres
RECCOOM_POSTGRES_HOST: reccoom_postgres
healthcheck:
test: ["CMD-SHELL", "test -f /run/consumer-alive && [ $$(( $$(date +%s) - $$(date +%s -r /run/consumer-alive) )) -lt 60 ]"]
timeout: 5s
image: maevsi/reccoom:dev
secrets:
- source: postgres_db
target: /run/environment-variables/POSTGRES_DATABASE
- source: postgres_db
target: /run/environment-variables/RECCOOM_POSTGRES_DATABASE
- source: postgres_role_service_reccoom_username
target: /run/environment-variables/POSTGRES_USER
- source: postgres_user
target: /run/environment-variables/RECCOOM_POSTGRES_USER
- source: postgres_role_service_reccoom_password
target: /run/environment-variables/POSTGRES_PASSWORD
- source: postgres_password
target: /run/environment-variables/RECCOOM_POSTGRES_PASSWORD
volumes:
- reccoom_fastembed_data:/tmp/fastembed_cache/
- ../../../reccoom/:/srv/app/ #DARGSTACK-REMOVE
reccoom_migration:
# You cannot access the recommender's database migration service directly.
command: ["uv", "run", "alembic", "upgrade", "head"]
Expand Down Expand Up @@ -904,6 +931,9 @@ volumes:
prometheus_data:
# The metrics monitoring's data.
{}
reccoom_fastembed_data:
# The recommender's model cache.
{}
reccoom_postgres_data:
# The recommendation database's data.
{}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
#!/bin/sh
set -eu

CONNECTOR_NAME="postgres-connector"
DEBEZIUM_URL="http://debezium:8083/connectors"
Expand All @@ -12,36 +13,22 @@ while ! curl --output /dev/null --silent --show-error "$DEBEZIUM_URL"; do
sleep 5
done

echo "Debezium is ready. Registering PostgreSQL connector..."
echo "Debezium is ready. Ensuring PostgreSQL connector is up to date..."

# Check if the connector already exists
HTTP_STATUS=$(curl --output /dev/null --silent --show-error -w "%{http_code}" "$DEBEZIUM_URL/$CONNECTOR_NAME")
# PUT is idempotent: creates if missing, updates if config changed,
# no-op if unchanged. Preserves WAL offsets across config updates.
curl --fail --output /dev/null --silent --show-error \
-X PUT "$DEBEZIUM_URL/$CONNECTOR_NAME/config" \
-H "Content-Type: application/json" \
-d '{
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
"database.dbname": "'"$POSTGRES_DB"'",
"database.hostname": "postgres",
"database.password": "'"$POSTGRES_PASSWORD"'",
"database.user": "'"$POSTGRES_USER"'",
"plugin.name": "pgoutput",
"table.include.list": "vibetype.event,vibetype.upload,vibetype_private.notification",
"topic.prefix" : "vibetype"
}'

if [ "$HTTP_STATUS" -eq 200 ]; then
echo "Connector '$CONNECTOR_NAME' already exists. Skipping registration."
elif [ "$HTTP_STATUS" -eq 404 ]; then
echo "Connector '$CONNECTOR_NAME' does not exist. Registering..."

# Register the Debezium PostgreSQL connector
curl --output /dev/null --silent --show-error \
-X POST $DEBEZIUM_URL \
-H "Content-Type: application/json" \
-d '{
"name": "'"$CONNECTOR_NAME"'",
"config": {
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
"database.dbname": "'"$POSTGRES_DB"'",
"database.hostname": "postgres",
"database.password": "'"$POSTGRES_PASSWORD"'",
"database.user": "'"$POSTGRES_USER"'",
"plugin.name": "pgoutput",
"table.include.list": "vibetype.upload,vibetype_private.notification",
"topic.prefix" : "vibetype"
}
}'

echo "PostgreSQL connector '$CONNECTOR_NAME' registered."
else
echo "Failed to query Debezium API. HTTP status: $HTTP_STATUS"
exit 1
fi
echo "PostgreSQL connector '$CONNECTOR_NAME' is up to date."
Comment thread
dargmuesli marked this conversation as resolved.
2 changes: 1 addition & 1 deletion src/production/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ services:
- traefik.http.routers.prometheus_secure.tls.certresolver=default
reccoom:
deploy: (( prune ))
image: ghcr.io/maevsi/reccoom:0.14.1
image: ghcr.io/maevsi/reccoom:0.15.0
redpanda-console:
deploy:
labels:
Expand Down
Loading