nostream/docker-compose.yml
2022-11-08 23:52:26 -05:00

70 lines
1.5 KiB
YAML

services:
relay:
build: .
container_name: nostr-ts-relay
environment:
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: 1
DB_MAX_POOL_SIZE: 2
NOSTR_CONFIG_DIR: /home/node/
user: node:node
volumes:
- $HOME/.nostr:/home/node/
ports:
- "8008:8008"
depends_on:
db:
condition: service_healthy
migrations:
condition: service_completed_successfully
networks:
- nostr-ts-relay
restart: always
db:
image: postgres
container_name: db
environment:
POSTGRES_USER: nostr_ts_relay
POSTGRES_PASSWORD: nostr_ts_relay
volumes:
- pgdata:/var/lib/postgresql/data/
networks:
- nostr-ts-relay
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U nostr_ts_relay"]
interval: 5s
timeout: 5s
retries: 5
migrations:
image: node:18-alpine3.15
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 -g knex@2.3.0 && npm install knex --quiet && npm run db:migrate'
volumes:
- ./package.json:/code/package.json
- ./migrations:/code/migrations
- ./knexfile.js:/code/knexfile.js
depends_on:
- db
networks:
- nostr-ts-relay
networks:
nostr-ts-relay:
volumes:
pgdata: