nostream/docker-compose.yml
Ricardo Arturo Cabral Mejía 273dcc6530
fix: excessive cache writes
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
2023-01-14 22:43:54 -05:00

132 lines
3.1 KiB
YAML

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
TOR_HOST: tor_proxy
TOR_CONTROL_PORT: 9051
TOR_PASSWORD: nostr_ts_relay
HIDDEN_SERVICE_PORT: 80
# Enable DEBUG for troubleshooting. Examples:
# DEBUG: "primary:*"
# DEBUG: "worker:*"
# DEBUG: "knex:query"
user: node:node
volumes:
- relay_data:/home/node/
ports:
- 8008:8008
depends_on:
cache:
condition: service_healthy
db:
condition: service_healthy
migrations:
condition: service_completed_successfully
tor_proxy:
condition: service_healthy
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 --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 knex@2.3.0 pg@8.8.0 && 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
tor_proxy:
image: dperson/torproxy
restart: on-failure
environment:
PASSWORD: nostr_ts_relay
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
default:
ipv4_address: 10.10.10.6
networks:
default:
name: nostr-ts-relay
ipam:
driver: default
config:
- subnet: 10.10.10.0/24
volumes:
relay_data:
cache:
pgdata: