Skip to content

Commit 065638c

Browse files
committed
feat(docker): pin nostream IPv4 for Tor/I2P sidecars (#35)
1 parent de828e8 commit 065638c

1 file changed

Lines changed: 148 additions & 147 deletions

File tree

docker-compose.yml

Lines changed: 148 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,148 @@
1-
services:
2-
nostream:
3-
build: .
4-
container_name: nostream
5-
environment:
6-
SECRET: ${SECRET}
7-
RELAY_PORT: 8008
8-
# Master
9-
NOSTR_CONFIG_DIR: /home/node/.nostr
10-
DB_HOST: nostream-db
11-
DB_PORT: 5432
12-
DB_USER: nostr_ts_relay
13-
DB_PASSWORD: nostr_ts_relay
14-
DB_NAME: nostr_ts_relay
15-
DB_MIN_POOL_SIZE: 16
16-
DB_MAX_POOL_SIZE: 64
17-
DB_ACQUIRE_CONNECTION_TIMEOUT: 60000
18-
# Read Replica
19-
READ_REPLICAS: 2
20-
READ_REPLICA_ENABLED: 'false'
21-
# Read Replica No. 1
22-
RR0_DB_HOST: db
23-
RR0_DB_PORT: 5432
24-
RR0_DB_USER: nostr_ts_relay
25-
RR0_DB_PASSWORD: nostr_ts_relay
26-
RR0_DB_NAME: nostr_ts_relay
27-
RR0_DB_MIN_POOL_SIZE: 16
28-
RR0_DB_MAX_POOL_SIZE: 64
29-
RR0_DB_ACQUIRE_CONNECTION_TIMEOUT: 10000
30-
# Read Replica No. 2
31-
RR1_DB_HOST: db
32-
RR1_DB_PORT: 5432
33-
RR1_DB_USER: nostr_ts_relay
34-
RR1_DB_PASSWORD: nostr_ts_relay
35-
RR1_DB_NAME: nostr_ts_relay
36-
RR1_DB_MIN_POOL_SIZE: 16
37-
RR1_DB_MAX_POOL_SIZE: 64
38-
RR1_DB_ACQUIRE_CONNECTION_TIMEOUT: 10000
39-
# Add RR2, RR3, etc. to configure more read replicas
40-
# Redis
41-
REDIS_HOST: nostream-cache
42-
REDIS_PORT: 6379
43-
REDIS_USER: default
44-
REDIS_PASSWORD: nostr_ts_relay
45-
TOR_HOST: tor_proxy
46-
TOR_CONTROL_PORT: 9051
47-
TOR_PASSWORD: nostr_ts_relay
48-
HIDDEN_SERVICE_PORT: 80
49-
# Payments Processors
50-
# Zebedee
51-
ZEBEDEE_API_KEY: ${ZEBEDEE_API_KEY}
52-
# Nodeless.io
53-
NODELESS_API_KEY: ${NODELESS_API_KEY}
54-
NODELESS_WEBHOOK_SECRET: ${NODELESS_WEBHOOK_SECRET}
55-
# OpenNode
56-
OPENNODE_API_KEY: ${OPENNODE_API_KEY}
57-
# Lnbits
58-
LNBITS_API_KEY: ${LNBITS_API_KEY}
59-
# Enable DEBUG for troubleshooting. Examples:
60-
# DEBUG: "primary:*"
61-
# DEBUG: "worker:*"
62-
# DEBUG: "knex:query"
63-
user: node:node
64-
volumes:
65-
- ${PWD}/.nostr:/home/node/.nostr
66-
ports:
67-
- 127.0.0.1:8008:8008
68-
depends_on:
69-
nostream-cache:
70-
condition: service_healthy
71-
nostream-db:
72-
condition: service_healthy
73-
nostream-migrate:
74-
condition: service_completed_successfully
75-
restart: on-failure
76-
networks:
77-
default:
78-
79-
nostream-db:
80-
image: postgres:15
81-
container_name: nostream-db
82-
environment:
83-
POSTGRES_DB: nostr_ts_relay
84-
POSTGRES_USER: nostr_ts_relay
85-
POSTGRES_PASSWORD: nostr_ts_relay
86-
volumes:
87-
- ${PWD}/.nostr/data:/var/lib/postgresql/data
88-
- ${PWD}/.nostr/db-logs:/var/log/postgresql
89-
- ${PWD}/postgresql.conf:/postgresql.conf
90-
networks:
91-
default:
92-
command: postgres -c 'config_file=/postgresql.conf'
93-
restart: always
94-
healthcheck:
95-
test: ["CMD-SHELL", "pg_isready -U nostr_ts_relay"]
96-
interval: 5s
97-
timeout: 5s
98-
retries: 5
99-
start_period: 360s
100-
101-
nostream-cache:
102-
image: redis:7.0.5-alpine3.16
103-
container_name: nostream-cache
104-
volumes:
105-
- cache:/data
106-
command: redis-server --loglevel warning --requirepass nostr_ts_relay
107-
networks:
108-
default:
109-
restart: always
110-
healthcheck:
111-
test: [ "CMD", "redis-cli", "ping", "|", "grep", "PONG" ]
112-
interval: 1s
113-
timeout: 5s
114-
retries: 5
115-
116-
nostream-migrate:
117-
image: node:24-alpine
118-
container_name: nostream-migrate
119-
environment:
120-
DB_HOST: nostream-db
121-
DB_PORT: 5432
122-
DB_USER: nostr_ts_relay
123-
DB_PASSWORD: nostr_ts_relay
124-
DB_NAME: nostr_ts_relay
125-
entrypoint:
126-
- sh
127-
- -c
128-
- 'cd code && npm install --no-save --quiet knex@2.4.0 pg@8.8.0 && npx knex migrate:latest'
129-
volumes:
130-
- ./migrations:/code/migrations
131-
- ./knexfile.js:/code/knexfile.js
132-
depends_on:
133-
nostream-db:
134-
condition: service_healthy
135-
networks:
136-
default:
137-
138-
networks:
139-
default:
140-
name: nostream
141-
ipam:
142-
driver: default
143-
config:
144-
- subnet: 10.10.10.0/24
145-
146-
volumes:
147-
cache:
1+
services:
2+
nostream:
3+
build: .
4+
container_name: nostream
5+
environment:
6+
SECRET: ${SECRET}
7+
RELAY_PORT: 8008
8+
# Master
9+
NOSTR_CONFIG_DIR: /home/node/.nostr
10+
DB_HOST: nostream-db
11+
DB_PORT: 5432
12+
DB_USER: nostr_ts_relay
13+
DB_PASSWORD: nostr_ts_relay
14+
DB_NAME: nostr_ts_relay
15+
DB_MIN_POOL_SIZE: 16
16+
DB_MAX_POOL_SIZE: 64
17+
DB_ACQUIRE_CONNECTION_TIMEOUT: 60000
18+
# Read Replica
19+
READ_REPLICAS: 2
20+
READ_REPLICA_ENABLED: 'false'
21+
# Read Replica No. 1
22+
RR0_DB_HOST: db
23+
RR0_DB_PORT: 5432
24+
RR0_DB_USER: nostr_ts_relay
25+
RR0_DB_PASSWORD: nostr_ts_relay
26+
RR0_DB_NAME: nostr_ts_relay
27+
RR0_DB_MIN_POOL_SIZE: 16
28+
RR0_DB_MAX_POOL_SIZE: 64
29+
RR0_DB_ACQUIRE_CONNECTION_TIMEOUT: 10000
30+
# Read Replica No. 2
31+
RR1_DB_HOST: db
32+
RR1_DB_PORT: 5432
33+
RR1_DB_USER: nostr_ts_relay
34+
RR1_DB_PASSWORD: nostr_ts_relay
35+
RR1_DB_NAME: nostr_ts_relay
36+
RR1_DB_MIN_POOL_SIZE: 16
37+
RR1_DB_MAX_POOL_SIZE: 64
38+
RR1_DB_ACQUIRE_CONNECTION_TIMEOUT: 10000
39+
# Add RR2, RR3, etc. to configure more read replicas
40+
# Redis
41+
REDIS_HOST: nostream-cache
42+
REDIS_PORT: 6379
43+
REDIS_USER: default
44+
REDIS_PASSWORD: nostr_ts_relay
45+
TOR_HOST: tor_proxy
46+
TOR_CONTROL_PORT: 9051
47+
TOR_PASSWORD: nostr_ts_relay
48+
HIDDEN_SERVICE_PORT: 80
49+
# Payments Processors
50+
# Zebedee
51+
ZEBEDEE_API_KEY: ${ZEBEDEE_API_KEY}
52+
# Nodeless.io
53+
NODELESS_API_KEY: ${NODELESS_API_KEY}
54+
NODELESS_WEBHOOK_SECRET: ${NODELESS_WEBHOOK_SECRET}
55+
# OpenNode
56+
OPENNODE_API_KEY: ${OPENNODE_API_KEY}
57+
# Lnbits
58+
LNBITS_API_KEY: ${LNBITS_API_KEY}
59+
# Enable DEBUG for troubleshooting. Examples:
60+
# DEBUG: "primary:*"
61+
# DEBUG: "worker:*"
62+
# DEBUG: "knex:query"
63+
user: node:node
64+
volumes:
65+
- ${PWD}/.nostr:/home/node/.nostr
66+
ports:
67+
- 127.0.0.1:8008:8008
68+
depends_on:
69+
nostream-cache:
70+
condition: service_healthy
71+
nostream-db:
72+
condition: service_healthy
73+
nostream-migrate:
74+
condition: service_completed_successfully
75+
restart: on-failure
76+
networks:
77+
default:
78+
ipv4_address: 10.10.10.2
79+
80+
nostream-db:
81+
image: postgres:15
82+
container_name: nostream-db
83+
environment:
84+
POSTGRES_DB: nostr_ts_relay
85+
POSTGRES_USER: nostr_ts_relay
86+
POSTGRES_PASSWORD: nostr_ts_relay
87+
volumes:
88+
- ${PWD}/.nostr/data:/var/lib/postgresql/data
89+
- ${PWD}/.nostr/db-logs:/var/log/postgresql
90+
- ${PWD}/postgresql.conf:/postgresql.conf
91+
networks:
92+
default:
93+
command: postgres -c 'config_file=/postgresql.conf'
94+
restart: always
95+
healthcheck:
96+
test: ["CMD-SHELL", "pg_isready -U nostr_ts_relay"]
97+
interval: 5s
98+
timeout: 5s
99+
retries: 5
100+
start_period: 360s
101+
102+
nostream-cache:
103+
image: redis:7.0.5-alpine3.16
104+
container_name: nostream-cache
105+
volumes:
106+
- cache:/data
107+
command: redis-server --loglevel warning --requirepass nostr_ts_relay
108+
networks:
109+
default:
110+
restart: always
111+
healthcheck:
112+
test: [ "CMD", "redis-cli", "ping", "|", "grep", "PONG" ]
113+
interval: 1s
114+
timeout: 5s
115+
retries: 5
116+
117+
nostream-migrate:
118+
image: node:24-alpine
119+
container_name: nostream-migrate
120+
environment:
121+
DB_HOST: nostream-db
122+
DB_PORT: 5432
123+
DB_USER: nostr_ts_relay
124+
DB_PASSWORD: nostr_ts_relay
125+
DB_NAME: nostr_ts_relay
126+
entrypoint:
127+
- sh
128+
- -c
129+
- 'cd code && npm install --no-save --quiet knex@2.4.0 pg@8.8.0 && npx knex migrate:latest'
130+
volumes:
131+
- ./migrations:/code/migrations
132+
- ./knexfile.js:/code/knexfile.js
133+
depends_on:
134+
nostream-db:
135+
condition: service_healthy
136+
networks:
137+
default:
138+
139+
networks:
140+
default:
141+
name: nostream
142+
ipam:
143+
driver: default
144+
config:
145+
- subnet: 10.10.10.0/24
146+
147+
volumes:
148+
cache:

0 commit comments

Comments
 (0)