Skip to content

Commit a1f46ac

Browse files
committed
time to rewrite the workflows
1 parent 9d9e732 commit a1f46ac

6 files changed

+111
-18
lines changed

docker/docker-compose.dev.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: rodhaj_dev
2+
3+
# For development purposes, it is recommended in order to start the bot normally and using the Dev Reloader system
4+
services:
5+
database:
6+
container_name: rodhaj_postgres
7+
build:
8+
context: ./pg
9+
dockerfile: Dockerfile
10+
environment:
11+
POSTGRES_PASSWORD: ${DB_PASSWORD}
12+
POSTGRES_DB: ${DB_DATABASE_NAME}
13+
POSTGRES_USER: ${DB_USERNAME}
14+
volumes:
15+
- database:/var/lib/postgresql/data
16+
ports:
17+
- 5432:5432
18+
19+
volumes:
20+
database:

docker/docker-compose.prod..yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: rodhaj_prod
2+
3+
services:
4+
rodhaj:
5+
container_name: rodhaj
6+
image: ghcr.io/transprogrammer/rodhaj:latest
7+
volumes:
8+
# Do not edit the next line. If you want to change the path of the configuration file, please edit the CONFIG_LOCATION variable
9+
- ${CONFIG_LOCATION}:/rodhaj/bot/config.yml
10+
env_file:
11+
- .env
12+
ports:
13+
- 8555:8555
14+
depends_on:
15+
- database
16+
command: sh -c '/rodhaj/wait-for database:5432 -- echo "[Wait-for] PostgreSQL is fully up. Starting Rodhaj." && /rodhaj/start.sh'
17+
restart: always
18+
19+
database:
20+
container_name: rodhaj_postgres
21+
build:
22+
context: ./pg
23+
dockerfile: Dockerfile
24+
environment:
25+
POSTGRES_PASSWORD: ${DB_PASSWORD}
26+
POSTGRES_DB: ${DB_DATABASE_NAME}
27+
POSTGRES_USER: ${DB_USERNAME}
28+
POSTGRES_INITDB_ARGS: '--data-checksums'
29+
ports:
30+
- 5432:5432
31+
volumes:
32+
# Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
33+
- database:/var/lib/postgresql/data
34+
healthcheck:
35+
test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
36+
interval: 5m
37+
start_interval: 30s
38+
start_period: 5m
39+
restart: always
40+
41+
rodhaj-prometheus:
42+
container_name: rodhaj_prometheus
43+
ports:
44+
- 9090:9090
45+
image: prom/prometheus:latest
46+
volumes:
47+
- ./prometheus.yml:/etc/prometheus/prometheus.yml
48+
- prometheus-data:/prometheus
49+
50+
# first login uses admin/admin
51+
# add data source for http://immich-prometheus:9090 to get started
52+
rodhaj-grafana:
53+
container_name: rodhaj_grafana
54+
command: ['./run.sh', '-disable-reporting']
55+
ports:
56+
- 3000:3000
57+
image: grafana/grafana-enterprise:11.1.3-ubuntu
58+
volumes:
59+
- grafana-data:/var/lib/grafana
60+
61+
volumes:
62+
database:
63+
prometheus-data:
64+
grafana-data:

docker/docker-compose.yml

+17-8
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,38 @@ services:
55
container_name: rodhaj
66
image: ghcr.io/transprogrammer/rodhaj:latest
77
volumes:
8-
# Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
8+
# Do not edit the next line. If you want to change the path of the configuration file, please edit the CONFIG_LOCATION variable
99
- ${CONFIG_LOCATION}:/rodhaj/bot/config.yml
1010
env_file:
1111
- .env
1212
ports:
13-
- 8555:3001
13+
- 8555:8555
1414
depends_on:
1515
- database
16+
command: sh -c '/rodhaj/wait-for database:5432 -- echo "[Wait-for] PostgreSQL is fully up. Starting Rodhaj." && /rodhaj/start.sh'
1617
restart: always
1718

1819
database:
1920
container_name: rodhaj_postgres
20-
image: rodhaj/postgres:latest
21+
build:
22+
context: ./pg
23+
dockerfile: Dockerfile
2124
environment:
22-
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
23-
POSTGRES_USER: ${POSTGRES_USER}
25+
POSTGRES_PASSWORD: ${DB_PASSWORD}
26+
POSTGRES_DB: ${DB_DATABASE_NAME}
27+
POSTGRES_USER: ${DB_USERNAME}
2428
POSTGRES_INITDB_ARGS: '--data-checksums'
29+
ports:
30+
- 5432:5432
2531
volumes:
2632
# Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
27-
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
33+
- database:/var/lib/postgresql/data
2834
healthcheck:
29-
test: pg_isready --dbname='${POSTGRES_DB}' --username='${POSTGRES_USER}' || exit 1; Chksum="$$(psql --dbname='${POSTGRES_DB}' --username='${POSTGERS_USER}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
35+
test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
3036
interval: 5m
3137
start_interval: 30s
3238
start_period: 5m
33-
restart: always
39+
restart: always
40+
41+
volumes:
42+
database:

docker/example.env

+1-8
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,10 @@
22
# The configuration can be found under the config-example.yml
33
CONFIG_LOCATION=./config.yml
44

5-
# The location where your database files are stored
6-
DB_DATA_LOCATION=./postgres
7-
8-
# Connection secret for the rodhaj user. You should change it to a random password
9-
RODHAJ_PASSWORD=rodhaj
10-
115
# Connection secret for the postgres. You should change it to a random password
126
POSTGRES_PASSWORD=postgres
137

14-
158
# The values below this line do not need to be changed
169
###################################################################################
1710
POSTGRES_USER=postgres
18-
POSTGRES_DB=postgres
11+
POSTGRES_DB=rodhaj

docker/pg/init.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
set -e
33

44
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
5-
CREATE ROLE rodhaj WITH LOGIN PASSWORD '$RODHAJ_PASSWORD';
6-
CREATE DATABASE rodhaj OWNER rodhaj;
5+
CREATE EXTENSION IF NOT EXISTS pg_trgm;
76
EOSQL

docker/prometheus.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
global:
2+
scrape_interval: 15s
3+
evaluation_interval: 15s
4+
5+
scrape_configs:
6+
- job_name: rodhaj
7+
static_configs:
8+
- targets: ['rodhaj:8555']

0 commit comments

Comments
 (0)