Skip to content

Commit

Permalink
feat: expose relay over Tor
Browse files Browse the repository at this point in the history
  • Loading branch information
cameri committed Nov 7, 2022
1 parent ae73059 commit 116d687
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 9 deletions.
15 changes: 15 additions & 0 deletions docker-compose.tor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
tor:
image: lncm/tor:0.4.7.9@sha256:86c2fe9d9099e6376798979110b8b9a3ee5d8adec27289ac4a5ee892514ffe92
container_name: tor
user: toruser
depends_on:
- relay
volumes:
- ${PWD}/tor/torrc:/etc/tor/torrc
- ${HOME}/.nostr/tor/data:/var/lib/tor
restart: on-failure
stop_grace_period: 10m30s
networks:
default:
ipv4_address: 10.10.10.253
24 changes: 17 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@ services:
DB_MIN_POOL_SIZE: 1
DB_MAX_POOL_SIZE: 2
NOSTR_CONFIG_DIR: /home/node/
SERVER_PORT: 8008
DEBUG: worker:event-message-handler,worker:web-socket-server-adapter
user: node:node
volumes:
- $HOME/.nostr:/home/node/
ports:
- "8008:8008"
- 8008:8008
depends_on:
db:
condition: service_healthy
migrations:
condition: service_completed_successfully
restart: on-failure
networks:
- nostr-ts-relay
restart: always
default:
ipv4_address: 10.10.10.2
db:
image: postgres
container_name: db
Expand All @@ -33,15 +36,16 @@ services:
volumes:
- pgdata:/var/lib/postgresql/data/
networks:
- nostr-ts-relay
default:
ipv4_address: 10.10.10.3
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U nostr_ts_relay"]
interval: 5s
timeout: 5s
retries: 5
migrations:
image: node:18-alpine3.15
image: node:18-alpine3.16
container_name: migrations
environment:
DB_HOST: db
Expand All @@ -60,10 +64,16 @@ services:
depends_on:
- db
networks:
- nostr-ts-relay
default:
ipv4_address: 10.10.10.254

networks:
nostr-ts-relay:
default:
name: nostr-ts-relay
ipam:
driver: default
config:
- subnet: 10.10.10.0/24

volumes:
pgdata:
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@
"test:integration": "cucumber-js",
"cover:integration": "nyc --report-dir .coverage/integration npm run test:integration -- -p cover",
"predocker:compose:start": "[ -d \"$HOME/.nostr\" ] || mkdir -p $HOME/.nostr",
"docker:compose:start": "docker compose up --build",
"docker:compose:start": "docker compose up --build --remove-orphans",
"docker:compose:stop": "docker compose down",
"docker:compose:clean": "docker compose rm",
"pretor:docker:compose:start": "mkdir -p $HOME/.nostr/tor/data",
"tor:docker:compose:start": "docker compose -f docker-compose.yml -f docker-compose.tor.yml up --build --remove-orphans",
"tor:hostname": "cat $HOME/.nostr/tor/data/nostr-ts-relay/hostname",
"tor:docker:compose:stop": "docker compose -f docker-compose.yml -f docker-compose.tor.yml down",
"predocker:integration:run": "docker compose -f ./test/integration/docker-compose.yml up -d --quiet-pull --build",
"docker:integration:run": "docker compose -f ./test/integration/docker-compose.yml run tests",
"postdocker:integration:run": "docker compose -f ./test/integration/docker-compose.yml down",
Expand Down Expand Up @@ -99,7 +103,7 @@
"@noble/secp256k1": "1.7.0",
"debug": "4.3.4",
"joi": "17.6.1",
"knex": "2.3.0",
"knex": "^2.3.0",
"pg": "8.8.0",
"pg-query-stream": "4.2.3",
"ramda": "0.28.0",
Expand Down
2 changes: 2 additions & 0 deletions tor/torrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HiddenServiceDir /var/lib/tor/nostr-ts-relay
HiddenServicePort 80 10.10.10.2:8008

0 comments on commit 116d687

Please sign in to comment.