-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.example.yml
More file actions
131 lines (121 loc) · 3.24 KB
/
Copy pathcompose.example.yml
File metadata and controls
131 lines (121 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# ===========================================================================
# Example Docker Compose file
# ===========================================================================
#
# Purpose:
# --------
#
# This file is an example Docker Compose configuration for self hosting
# Sure on your local machine or on a cloud VPS.
#
# The configuration below is a "standard" setup that works out of the box,
# but if you're running this outside of a local network, it is recommended
# to set the environment variables for extra security.
# Setup:
# ------
#
# To run this, read the setup guide:
# https://github.com/hendripermana/sure/blob/main/docs/hosting/docker.md
#
# Troubleshooting:
# ----------------
#
# If you run into problems, please open an issue on GitHub:
# https://github.com/hendripermana/sure/issues
x-db-env: &db_env
POSTGRES_USER: ${POSTGRES_USER:-permoney_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-permoney_password}
POSTGRES_DB: ${POSTGRES_DB:-permoney_production}
x-rails-env: &rails_env
<<: *db_env
SECRET_KEY_BASE: ${SECRET_KEY_BASE:?SECRET_KEY_BASE is required (generate via openssl rand -hex 64).}
RAILS_ENV: production
RACK_ENV: production
RAILS_SERVE_STATIC_FILES: "true"
RAILS_LOG_TO_STDOUT: "true"
SELF_HOSTED: "true"
RAILS_FORCE_SSL: "false"
RAILS_ASSUME_SSL: "false"
DB_HOST: db
DB_PORT: 5432
REDIS_URL: redis://redis:6379/1
DB_POOL: ${DB_POOL:-52}
DB_CHECKOUT_TIMEOUT: ${DB_CHECKOUT_TIMEOUT:-5}
SIDEKIQ_CONCURRENCY: ${SIDEKIQ_CONCURRENCY:-15}
SIDEKIQ_TIMEOUT: ${SIDEKIQ_TIMEOUT:-90}
WEB_CONCURRENCY: ${WEB_CONCURRENCY:-4}
RAILS_MAX_THREADS: ${RAILS_MAX_THREADS:-8}
OPENAI_ACCESS_TOKEN: ${OPENAI_ACCESS_TOKEN}
x-app-base: &app_base
image: ${SURE_IMAGE:-ghcr.io/hendripermana/sure:latest}
restart: unless-stopped
volumes:
- app-storage:/rails/storage
environment:
<<: *rails_env
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
networks:
- permoney_net
services:
web:
<<: *app_base
ports:
- "3000:3000"
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:3000/up || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
worker:
<<: *app_base
command: bundle exec sidekiq
healthcheck:
test: ["CMD-SHELL", "pgrep -f sidekiq || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
db:
image: postgres:18
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/18/docker
environment:
<<: *db_env
PGDATA: /var/lib/postgresql/18/docker
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 5s
retries: 5
networks:
- permoney_net
redis:
image: redis:8.2.2
restart: unless-stopped
volumes:
- redis-data:/data
command: >
redis-server \
--maxmemory 512mb \
--maxmemory-policy allkeys-lru \
--save 60 1000
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
networks:
- permoney_net
volumes:
app-storage:
postgres-data:
redis-data:
networks:
permoney_net:
driver: bridge