-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
111 lines (109 loc) · 2.68 KB
/
docker-compose.yml
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
services:
relay:
build: .
container_name: nostr-ts-relay
environment:
RELAY_PORT: 8008
NOSTR_CONFIG_DIR: /home/node/
DB_HOST: db
DB_PORT: 5432
DB_USER: nostr_ts_relay
DB_PASSWORD: nostr_ts_relay
DB_NAME: nostr_ts_relay
DB_MIN_POOL_SIZE: 16
DB_MAX_POOL_SIZE: 64
REDIS_HOST: cache
REDIS_PORT: 6379
REDIS_USER: default
REDIS_PASSWORD: nostr_ts_relay
# Enable DEBUG for troubleshooting. Examples:
# DEBUG: "worker:*"
# DEBUG: "knex:query"
user: node:node
volumes:
- ${PWD}/.nostr:/home/node/
ports:
- 8008:8008
depends_on:
cache:
condition: service_healthy
db:
condition: service_healthy
migrations:
condition: service_completed_successfully
restart: on-failure
networks:
default:
ipv4_address: 10.10.10.2
db:
image: postgres
container_name: db
environment:
POSTGRES_DB: nostr_ts_relay
POSTGRES_USER: nostr_ts_relay
POSTGRES_PASSWORD: nostr_ts_relay
volumes:
- pgdata:/var/lib/postgresql/data-old
- ${PWD}/.nostr/data:/var/lib/postgresql/data
- ${PWD}/.nostr/db-logs:/var/log/postgresql
- ${PWD}/postgresql.conf:/postgresql.conf
ports:
- 15432:5432
networks:
default:
ipv4_address: 10.10.10.3
command: postgres -c 'config_file=/postgresql.conf'
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U nostr_ts_relay"]
interval: 5s
timeout: 5s
retries: 5
start_period: 360s
cache:
image: redis:7.0.5-alpine3.16
container_name: cache
volumes:
- cache:/data
command: redis-server --save 20 1 --loglevel warning --requirepass nostr_ts_relay
networks:
default:
ipv4_address: 10.10.10.4
restart: always
healthcheck:
test: [ "CMD", "redis-cli", "ping", "|", "grep", "PONG" ]
interval: 1s
timeout: 5s
retries: 5
migrations:
image: node:18-alpine3.16
container_name: migrations
environment:
DB_HOST: db
DB_PORT: 5432
DB_USER: nostr_ts_relay
DB_PASSWORD: nostr_ts_relay
DB_NAME: nostr_ts_relay
entrypoint:
- sh
- -c
- 'cd code && npm install --no-save --quiet [email protected] [email protected] && npx knex migrate:latest'
volumes:
- ./migrations:/code/migrations
- ./knexfile.js:/code/knexfile.js
depends_on:
db:
condition: service_healthy
networks:
default:
ipv4_address: 10.10.10.254
networks:
default:
name: nostr-ts-relay
ipam:
driver: default
config:
- subnet: 10.10.10.0/24
volumes:
cache:
pgdata: