From 4dc6cab61880595f0f8d3a4ad6bdd572e4f740c0 Mon Sep 17 00:00:00 2001 From: fsociety Date: Sat, 7 Sep 2024 16:53:07 +0200 Subject: [PATCH] feat: add optional Tor support with clearnet toggle Added support for optionally running the wot-relay service as a Tor hidden service. Updated the docker-compose.tor.yml file to conditionally enable clearnet access, based on the `ENABLE_CLEARNET` environment variable. Updated the README.md file with instructions on how to use this feature. --- .env.example | 1 + README.md | 17 ++++++++++++++++- docker-compose.tor.yml | 4 ++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 6eeee36..cb2991b 100644 --- a/.env.example +++ b/.env.example @@ -5,3 +5,4 @@ RELAY_URL="wss://wot.utxo.one" DB_PATH="db" INDEX_PATH="templates/index.html" STATIC_PATH="templates/static" +ENABLE_CLEARNET=false diff --git a/README.md b/README.md index 26359fa..772e122 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,22 @@ To start the project using Docker Compose, follow these steps: This will build the Docker image and start the `wot-relay` service as defined in the `docker-compose.yml` file. The application will be accessible on port 3334. -### 7. Access the relay +### 7. Hidden Service with Tor (optional) + +Same as the step 6, but with the following command: + +```sh +# in foreground +docker compose -f docker-compose.tor.yml up --build +# in background +docker compose -f docker-compose.tor.yml up --build -d +``` + +You can disable or enable clearnet access by changing `ENABLE_CLEARNET=false` or `ENABLE_CLEARNET=true` in the `.env` file. + +You can find the onion address here: `tor/data/relay/hostname` + +### 8. Access the relay Once everything is set up, the relay will be running on `localhost:3334`. diff --git a/docker-compose.tor.yml b/docker-compose.tor.yml index 15d5760..6bb6b4d 100644 --- a/docker-compose.tor.yml +++ b/docker-compose.tor.yml @@ -11,8 +11,8 @@ services: - "./templates/index.html:/app/templates/index.html" - "./templates/static:/app/templates/static" ports: - - "3334" # disable clearnet access - #- "3334:3334" # enable clearnet access + - "3334" # default port + - ${ENABLE_CLEARNET:+3334:3334} tor: image: lncm/tor:0.4.7.9@sha256:86c2fe9d9099e6376798979110b8b9a3ee5d8adec27289ac4a5ee892514ffe92