-
Notifications
You must be signed in to change notification settings - Fork 1
chore(docker): remove OpenSearch service and update PostgreSQL config #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(docker): remove OpenSearch service and update PostgreSQL config #16
Conversation
anatolyshipitz
commented
May 2, 2025
- Removed the OpenSearch service from docker-compose.yml to streamline the setup.
- Added a new PostgreSQL database for visibility and updated related environment variables.
- Enhanced health checks for Temporal service to ensure better reliability.
- Updated init-db.sh to create and grant privileges for the new visibility database.
…uration - Removed the OpenSearch service from docker-compose.yml to streamline the setup. - Added a new PostgreSQL database for visibility and updated related environment variables. - Enhanced health checks for Temporal service to ensure better reliability. - Updated init-db.sh to create and grant privileges for the new visibility database.
Warning Rate limit exceeded@anatolyshipitz has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 12 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
## Walkthrough
This update transitions the Temporal service from using OpenSearch for visibility data to utilizing a dedicated PostgreSQL visibility database. The `docker-compose.yml` file removes the OpenSearch service and its dependencies, introduces new environment variables for PostgreSQL visibility database credentials, and adds a health check for Temporal using `tctl`. The `Dockerfile.temporal` is updated to initialize and update the visibility schema in PostgreSQL. The `init-db.sh` script is modified to grant the Temporal user database creation privileges and to create and configure a new visibility database.
## Changes
| File(s) | Change Summary |
|-----------------------|------------------------------------------------------------------------------------------------------------------------------|
| Dockerfile.temporal | Added RUN command to initialize and update the Temporal visibility schema in PostgreSQL using `temporal-sql-tool`. |
| docker-compose.yml | Removed OpenSearch service and related dependencies; added visibility DB environment variables and healthcheck for Temporal. |
| scripts/init-db.sh | Granted CREATEDB privilege to temporal user; created and configured a new visibility database owned by the temporal user. |
## Suggested reviewers
- DenisChistyakov
- killev Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
- Enclosed environment variable references in quotes for better handling of special characters and spaces. - Ensured consistency in command syntax for setting up and updating the PostgreSQL schema in the Dockerfile.
🔍 Vulnerabilities of
|
digest | sha256:8cb3f7d0b9e05795d3781b05c0180d12e0d05a61d24167862c477fafac94fb25 |
vulnerabilities | |
platform | linux/amd64 |
size | 243 MB |
packages | 1628 |
📦 Base Image node:20-alpine
Description
| ||||||||||||
Description
| ||||||||||||
Description
| ||||||||||||
Description
| ||||||||||||
Description
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
scripts/init-db.sh (1)
13-15
: Add idempotency to creation logic
Currently, re-running this script will error out if the temporal role or visibility database already exists. Consider guarding these operations withpsql
checks to skip creation when they already exist, for example:if ! psql -U postgres -d postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='${POSTGRES_USER_TEMPORAL}'" | grep -q 1; then CREATE USER "${POSTGRES_USER_TEMPORAL}" WITH ENCRYPTED PASSWORD '${POSTGRES_PASSWORD_TEMPORAL}'; fi if ! psql -U postgres -d postgres -tAc "SELECT 1 FROM pg_database WHERE datname='${POSTGRES_DB_TEMPORAL_VISIBILITY}'" | grep -q 1; then CREATE DATABASE "${POSTGRES_DB_TEMPORAL_VISIBILITY}" OWNER "${POSTGRES_USER_TEMPORAL}"; fiThis change will make the script repeatable without failures.
docker-compose.yml (1)
102-107
: Improve Temporal healthcheck reliability
The current exec form may always pass iftctl cluster health
returns exit code 0 even when not fully serving. Consider switching to a shell form that greps forSERVING
:- healthcheck: - test: ["CMD", "tctl", "--address", "temporal:${TEMPORAL_PORT:-7233}", "cluster", "health"] + healthcheck: + test: ["CMD-SHELL", "tctl --address temporal:${TEMPORAL_PORT:-7233} cluster health | grep -q SERVING"] interval: 10s timeout: 5s retries: 5 start_period: 30s
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
Dockerfile.temporal
(2 hunks)docker-compose.yml
(3 hunks)scripts/init-db.sh
(1 hunks)
🔇 Additional comments (2)
docker-compose.yml (2)
90-92
: Validate consumption of visibility DB env vars
TheVISIBILITY_DB_USER/PWD/PORT
variables are newly introduced, but the Temporal CLI and base image expectPOSTGRES_USER
,POSTGRES_PWD
, andDB_PORT
for connections. Confirm your entrypoint or application config consumesVISIBILITY_*
, or consolidate to the existing vars.
53-55
:✅ Verification successful
Ensure init script sees new DB vars
You’ve addedPOSTGRES_PASSWORD_TEMPORAL
andPOSTGRES_DB_TEMPORAL_VISIBILITY
, which matchesinit-db.sh
. Verify these are indeed available in the init container to avoid silent misconfigurations.Run:
🏁 Script executed:
docker-compose run --rm postgresql env | grep POSTGRES_DB_TEMPORAL_VISIBILITY
Length of output: 184
Here’s a quick check of how
init-db.sh
is wired up and whether those env vars are actually set in that service:
🏁 Script executed:
#!/bin/bash # Locate any references to the init script rg -n "init-db.sh" # Show the environment block around where POSTGRES_DB_TEMPORAL_VISIBILITY is declared rg -C3 -n "POSTGRES_DB_TEMPORAL_VISIBILITY" docker-compose.ymlLength of output: 549
Init script has access to the new DB vars
BothPOSTGRES_PASSWORD_TEMPORAL
andPOSTGRES_DB_TEMPORAL_VISIBILITY
are declared in thepostgresql
service’s environment block (docker-compose.yml lines 51–54), and the init script (./scripts/init-db.sh
) is mounted into/docker-entrypoint-initdb.d
(line 59). Therefore these variables will be available when the init script runs.No further action required.
- Updated the PostgreSQL command syntax in Dockerfile.temporal for better readability by adding line continuation with backslashes. - Ensured consistency in the command structure for setting up and updating the PostgreSQL schema.
….temporal - Reformatted the PostgreSQL command syntax in Dockerfile.temporal by adding line breaks for improved readability. - Maintained consistency in the command structure for setting up and updating the PostgreSQL schema.
- Changed command options in Dockerfile.temporal for the PostgreSQL setup to use more descriptive flags: `--endpoint`, `--user`, `--port`, and `--database`. - Improved clarity and consistency in the command structure for setting up and updating the PostgreSQL schema.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM