Skip to content

Commit

Permalink
Add unleash compose file for podman and sql init script
Browse files Browse the repository at this point in the history
  • Loading branch information
catastrophe-brandon committed Oct 2, 2024
1 parent 12a5982 commit 2fbbc1c
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
8 changes: 8 additions & 0 deletions local/podman/postgres/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--
ALTER user unleash_user superuser
createdb
createrole;
CREATE DATABASE unleash;
GRANT ALL PRIVILEGES ON DATABASE unleash to unleash_user;
GRANT ALL ON SCHEMA public to unleash_user;
GRANT ALL ON ALL TABLES IN SCHEMA public to unleash_user;
54 changes: 54 additions & 0 deletions local/podman/unleash-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
version: "3.9"
services:

# The Unleash server contains the Unleash configuration and
# communicates with server-side SDKs and the Unleash Proxy
unleash_web:
image: quay.io/cloudservices/unleash-server:latest
ports:
- "4242:4242"
environment:
DATABASE_URL: "postgres://unleash_user:password@db/unleash"
DATABASE_SSL: "false"
LOG_LEVEL: "debug"
INIT_FRONTEND_API_TOKENS: "default:development.unleash-insecure-frontend-api-token"
INIT_CLIENT_API_TOKENS: "default:development.unleash-insecure-api-token"
# This is setup to seed in feature flags, production is entirely different
INIT_ADMIN_API_TOKENS: "*:*.unleash-insecure-api-token"
depends_on:
db:
condition: service_healthy
# Healthchecks aren't honored by compose anymore in depends_on
healthcheck:
test: wget --no-verbose --tries=1 --spider http://db:4242/health || exit 1
interval: 1s
timeout: 1m
retries: 5
start_period: 15s
# Contains hard-coded sleep to wait for postgres to be ready
command: [ "sh", "-c", "echo sleeping; sleep 30; node index.js"]

# Note: Not all log data appears on the terminal output
# To view more detailed log data, shell into the container and view like this:
# cat var/lib/pgsql/data/userdata/log/postgresql-Tue.log
db:
expose:
- "5432"
ports:
- "5432:5432"
image: quay.io/sclorg/postgresql-15-c9s:latest
environment:
- POSTGRESQL_DATABASE=unleash
- POSTGRESQL_USER=unleash_user
- POSTGRESQL_PASSWORD=password
healthcheck:
test: ["CMD", "pg_isready", "--username=unleash_user", "--host=db", "--port=5432"]
interval: 2s
timeout: 1m
retries: 5
start_period: 10s
# This sets up the permissions for chrome user explicitly
volumes:
- ./postgres/data:/var/lib/postgresql/data
- ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql

0 comments on commit 2fbbc1c

Please sign in to comment.