mirror of
https://github.com/bitvora/wot-relay.git
synced 2025-06-06 18:31:05 +00:00
Merge pull request #5 from HolgerHatGarKeineNode/master
feat: update Dockerfile, docker-compose and add Tor support for relay service
This commit is contained in:
commit
5ba7aae9cd
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
db
|
||||||
|
templates
|
@ -3,4 +3,5 @@ RELAY_PUBKEY="e2ccf7cf20403f3f2a4a55b328f0de3be38558a7d5f33632fdaaefc726c1c8eb"
|
|||||||
RELAY_DESCRIPTION="Only notes in utxo WoT"
|
RELAY_DESCRIPTION="Only notes in utxo WoT"
|
||||||
RELAY_URL="wss://wot.utxo.one"
|
RELAY_URL="wss://wot.utxo.one"
|
||||||
DB_PATH="db"
|
DB_PATH="db"
|
||||||
INDEX_PATH="templates/index.html"
|
INDEX_PATH="templates/index.html"
|
||||||
|
STATIC_PATH="templates/static"
|
||||||
|
58
Dockerfile
58
Dockerfile
@ -1,27 +1,31 @@
|
|||||||
# Use Golang image based on Debian Bookworm
|
# Use Golang image based on Debian Bookworm
|
||||||
FROM golang:bookworm
|
FROM golang:bookworm
|
||||||
|
|
||||||
# Set the working directory within the container
|
# Set the working directory within the container
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Clone the repository
|
# Copy go.mod and go.sum files
|
||||||
RUN git clone https://github.com/bitvora/wot-relay .
|
COPY go.mod go.sum ./
|
||||||
|
|
||||||
# Download Go module dependencies
|
# Download dependencies
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
# Write the .env file
|
# Copy the rest of the application source code
|
||||||
RUN touch .env && \
|
COPY . .
|
||||||
echo "RELAY_NAME=${RELAY_NAME}" >> .env && \
|
|
||||||
echo "RELAY_PUBKEY=${RELAY_PUBKEY}" >> .env && \
|
# Set fixed environment variables
|
||||||
echo "RELAY_DESCRIPTION=${RELAY_DESCRIPTION}" >> .env && \
|
ENV DB_PATH="db"
|
||||||
echo "DB_PATH=${DB_PATH}" >> .env
|
ENV INDEX_PATH="templates/index.html"
|
||||||
|
ENV STATIC_PATH="templates/static"
|
||||||
# Build the Go application
|
|
||||||
RUN go build -o main .
|
# touch a .env (https://github.com/bitvora/wot-relay/pull/4)
|
||||||
|
RUN touch .env
|
||||||
# Expose the port that the application will run on
|
|
||||||
EXPOSE 3334
|
# Build the Go application
|
||||||
|
RUN go build -o main .
|
||||||
# Set the command to run the executable
|
|
||||||
CMD ["./main"]
|
# Expose the port that the application will run on
|
||||||
|
EXPOSE 3334
|
||||||
|
|
||||||
|
# Set the command to run the executable
|
||||||
|
CMD ["./main"]
|
||||||
|
47
README.md
47
README.md
@ -97,26 +97,51 @@ To start the project using Docker Compose, follow these steps:
|
|||||||
|
|
||||||
1. Ensure Docker and Docker Compose are installed on your system.
|
1. Ensure Docker and Docker Compose are installed on your system.
|
||||||
2. Navigate to the project directory.
|
2. Navigate to the project directory.
|
||||||
3. Edit the `docker-compose.yml` file to update the environment variables as needed:
|
3. Ensure the `.env` file is present in the project directory and has the necessary environment variables set.
|
||||||
|
4. You can also change the paths of the `db` folder and `templates` folder in the `docker-compose.yml` file.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
environment:
|
volumes:
|
||||||
RELAY_NAME: "utxo WoT relay"
|
- "./db:/app/db" # only change the left side before the colon
|
||||||
RELAY_PUBKEY: "YOURPUBKEY"
|
- "./templates/index.html:/app/templates/index.html" # only change the left side before the colon
|
||||||
RELAY_DESCRIPTION: "Only notes in utxo WoT"
|
- "./templates/static:/app/templates/static" # only change the left side before the colon
|
||||||
DB_PATH: "./db"
|
```
|
||||||
```
|
|
||||||
|
|
||||||
4. Run the following command:
|
5. Run the following command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker-compose up --build
|
# in foreground
|
||||||
|
docker compose up --build
|
||||||
|
# in background
|
||||||
|
docker compose up --build -d
|
||||||
|
```
|
||||||
|
6. For updating the relay, run the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git pull
|
||||||
|
docker compose build --no-cache
|
||||||
|
# in foreground
|
||||||
|
docker compose up
|
||||||
|
# in background
|
||||||
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
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. Hidden Service with Tor (optional)
|
||||||
|
|
||||||
### 7. Access the relay
|
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 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`.
|
Once everything is set up, the relay will be running on `localhost:3334`.
|
||||||
|
|
||||||
|
25
docker-compose.tor.yml
Normal file
25
docker-compose.tor.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
services:
|
||||||
|
relay:
|
||||||
|
container_name: wot-relay
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
volumes:
|
||||||
|
- "./db:/app/db"
|
||||||
|
- "./templates/index.html:/app/templates/index.html"
|
||||||
|
- "./templates/static:/app/templates/static"
|
||||||
|
ports:
|
||||||
|
- "3334"
|
||||||
|
|
||||||
|
tor:
|
||||||
|
image: lncm/tor:0.4.7.9@sha256:86c2fe9d9099e6376798979110b8b9a3ee5d8adec27289ac4a5ee892514ffe92
|
||||||
|
container_name: wot-relay-tor
|
||||||
|
depends_on:
|
||||||
|
- relay
|
||||||
|
volumes:
|
||||||
|
- ./tor/torrc:/etc/tor/torrc
|
||||||
|
- ./tor/data:/var/lib/tor
|
||||||
|
restart: on-failure
|
||||||
|
stop_grace_period: 10m30s
|
@ -1,14 +1,14 @@
|
|||||||
services:
|
services:
|
||||||
wot-relay:
|
relay:
|
||||||
build:
|
container_name: wot-relay
|
||||||
context: .
|
build:
|
||||||
dockerfile: Dockerfile
|
context: .
|
||||||
environment:
|
dockerfile: Dockerfile
|
||||||
RELAY_NAME: "utxo WoT relay"
|
env_file:
|
||||||
RELAY_PUBKEY: "e2ccf7cf20403f3f2a4a55b328f0de3be38558a7d5f33632fdaaefc726c1c8eb"
|
- .env
|
||||||
RELAY_DESCRIPTION: "Only notes in utxo WoT"
|
volumes:
|
||||||
DB_PATH: "./db"
|
- "./db:/app/db" # only change the left side before the colon
|
||||||
volumes:
|
- "./templates/index.html:/app/templates/index.html" # only change the left side before the colon
|
||||||
- "./db:/app/db"
|
- "./templates/static:/app/templates/static" # only change the left side before the colon
|
||||||
ports:
|
ports:
|
||||||
- "3334:3334"
|
- "3334:3334"
|
||||||
|
2
tor/data/.gitignore
vendored
Normal file
2
tor/data/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
Loading…
x
Reference in New Issue
Block a user