Skip to content

Commit e40925d

Browse files
authored
Merge pull request bitvora#14 from aaccioly-open-source/feature/docker-nginx-ssl
New Docker compose with Nginx + SSL Support
2 parents c6f1ac7 + d491c62 commit e40925d

File tree

6 files changed

+994
-3
lines changed

6 files changed

+994
-3
lines changed

.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,7 @@ AWS_BUCKET_NAME="backups"
8888

8989
## Blastr Settings
9090
BLASTR_RELAYS="relay.damus.io,nos.lol,relay.nostr.band,relay.snort.social,nostr.land,nostr.mom,relay.nos.social,relay.primal.net,relay.nostr.bg,no.str.cr,nostr21.com,nostrue.com,relay.siamstr.com,wot.utxo.one,nostrelites.org,wot.nostr.party,wot.sovbit.host,wot.girino.org,relay.lnau.net,wot.siamstr.com,wot.sudocarlos.com,relay.otherstuff.fyi,relay.lexingtonbitcoin.org,wot.azzamo.net,wot.swarmstr.com,zap.watch,satsage.xyz,wons.calva.dev"
91-
BLASTR_RELAYS_FILE="relays_blastr.json"
91+
BLASTR_RELAYS_FILE="relays_blastr.json"
92+
93+
# Docker
94+

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.env
22
relays_import.json
33
relays_blastr.json
4-
haven
4+
haven
5+
.DS_Store
6+
.idea/

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ RUN chown -R appuser:appgroup /app
3131
USER appuser
3232

3333
# Expose the port that the application will run on
34-
EXPOSE 3334
34+
EXPOSE 3355
3535

3636
# Set the command to run the executable
3737
CMD ["./main"]

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,24 @@ To start the project using Docker Compose, follow these steps:
230230

231231
This will build the Docker image and start the `haven-relay` service as defined in the `docker-compose.yml` file. The application will be accessible on port 3335.
232232

233+
### Nginx + SSL with Docker (optional)
234+
235+
If you want to serve the relay over HTTPS, you can use Nginx as a reverse proxy with SSL termination.
236+
237+
It's recommended to edit the `.env` file and modify the `EMAIL` to a real email address.
238+
239+
You'll also need to expose ports 80 and 443 to the internet and set up your DNS A and AAAA (if you are using IPv6)
240+
records to point to your server's IP address.
241+
242+
Finally, run the following command:
243+
244+
```sh
245+
# in foreground
246+
docker compose -f docker-compose-nginx-ssl.yml up --build
247+
# in background
248+
docker compose -f docker-compose-nginx-ssl.yml up --build -d
249+
```
250+
233251
### Hidden Service with Tor and Docker (optional)
234252

235253
Same as the step 6, but with the following command:

docker-compose-nginx-ssl.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
services:
2+
relay:
3+
container_name: haven-relay
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
env_file:
8+
- .env
9+
environment:
10+
- LETSENCRYPT_HOST=${RELAY_URL}
11+
- VIRTUAL_HOST=${RELAY_URL}
12+
- VIRTUAL_PORT=3355
13+
volumes:
14+
- "./db:/app/db"
15+
- "./haven:/app/haven"
16+
user: "${DOCKER_UID:-1000}:${DOCKER_GID:-1000}"
17+
network_mode: bridge
18+
restart: unless-stopped
19+
20+
nginx-proxy:
21+
image: nginx:alpine
22+
container_name: nginx-proxy
23+
volumes:
24+
# The vhost volume is only required if you
25+
# plan to obtain standalone certificates
26+
# - vhost:/etc/nginx/vhost.d
27+
- conf:/etc/nginx/conf.d
28+
- html:/usr/share/nginx/html
29+
- certs:/etc/nginx/certs:ro
30+
ports:
31+
- "80:80"
32+
- "443:443"
33+
network_mode: bridge
34+
restart: unless-stopped
35+
36+
docker-gen:
37+
image: nginxproxy/docker-gen
38+
container_name: nginx-proxy-gen
39+
command: -notify-sighup nginx-proxy -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
40+
volumes_from:
41+
- nginx-proxy
42+
volumes:
43+
- ./nginx/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
44+
- /var/run/docker.sock:/tmp/docker.sock:ro
45+
labels:
46+
- "com.github.nginx-proxy.docker-gen"
47+
privileged: true
48+
network_mode: bridge
49+
50+
acme-companion:
51+
image: nginxproxy/acme-companion
52+
container_name: nginx-proxy-acme
53+
environment:
54+
- DEFAULT_EMAIL=${ACME_EMAIL}
55+
volumes_from:
56+
- nginx-proxy
57+
volumes:
58+
- certs:/etc/nginx/certs:rw
59+
- acme:/etc/acme.sh
60+
- /var/run/docker.sock:/var/run/docker.sock:ro
61+
privileged: true
62+
network_mode: bridge
63+
64+
volumes:
65+
# vhost:
66+
conf:
67+
html:
68+
certs:
69+
acme:

0 commit comments

Comments
 (0)