2024-09-06 11:16:40 -04:00
# WOT Relay
2024-09-06 11:17:31 -04:00
WOT Relay is a Nostr relay that saves all the notes that people you follow, and people they follow are posting.
2024-09-06 11:16:40 -04:00
## Prerequisites
- **Go**: Ensure you have Go installed on your system. You can download it from [here ](https://golang.org/dl/ ).
2024-09-07 13:29:56 -04:00
- **Build Essentials**: If you're using Linux, you may need to install build essentials. You can do this by running `sudo apt install build-essential` .
2024-09-06 11:16:40 -04:00
## Setup Instructions
Follow these steps to get the WOT Relay running on your local machine:
### 1. Clone the repository
```bash
git clone https://github.com/bitvora/wot-relay.git
cd wot-relay
```
### 2. Copy `.env.example` to `.env`
You'll need to create an `.env` file based on the example provided in the repository.
```bash
cp .env.example .env
```
### 3. Set your environment variables
Open the `.env` file and set the necessary environment variables. Example variables include:
```bash
RELAY_NAME="YourRelayName"
RELAY_PUBKEY="YourPublicKey"
RELAY_DESCRIPTION="Your relay description"
2024-09-07 13:29:56 -04:00
DB_PATH="/home/ubuntu/wot-relay/db" # any path you would like the database to be saved.
INDEX_PATH="/home/ubuntu/wot-relay/templates/index.html" # path to the index.html file
STATIC_PATH="/home/ubuntu/wot-relay/templates/static" # path to the static folder
2024-09-06 11:16:40 -04:00
```
### 4. Build the project
Run the following command to build the relay:
```bash
go build
```
### 5. Create a Systemd Service (optional)
To have the relay run as a service, create a systemd unit file. Here's an example:
1. Create the file:
```bash
sudo nano /etc/systemd/system/wot-relay.service
```
2. Add the following contents:
```ini
[Unit]
Description=WOT Relay Service
After=network.target
[Service]
ExecStart=/path/to/wot-relay
WorkingDirectory=/path/to/wot-relay
Restart=always
EnvironmentFile=/path/to/.env
[Install]
WantedBy=multi-user.target
```
Replace `/path/to/` with the actual paths where you cloned the repository and stored the `.env` file.
3. Reload systemd to recognize the new service:
```bash
sudo systemctl daemon-reload
```
4. Start the service:
```bash
sudo systemctl start wot-relay
```
5. (Optional) Enable the service to start on boot:
```bash
sudo systemctl enable wot-relay
```
2024-09-06 17:55:21 +00:00
### 6. Start the Project with Docker Compose (optional)
2024-09-06 17:52:49 +00:00
To start the project using Docker Compose, follow these steps:
1. Ensure Docker and Docker Compose are installed on your system.
2. Navigate to the project directory.
2024-09-07 13:29:56 -04:00
3. Ensure the `.env` file is present in the project directory and has the necessary environment variables set.
2024-09-07 15:57:21 +02:00
4. You can also change the paths of the `db` folder and `templates` folder in the `docker-compose.yml` file.
```yaml
2024-09-07 13:29:56 -04:00
volumes:
- "./db:/app/db" # only change the left side before the colon
- "./templates/index.html:/app/templates/index.html" # only change the left side before the colon
- "./templates/static:/app/templates/static" # only change the left side before the colon
2024-09-07 15:57:21 +02:00
```
2024-09-06 17:54:55 +00:00
2024-09-07 15:57:21 +02:00
5. Run the following command:
2024-09-06 17:52:49 +00:00
2024-09-07 13:29:56 -04:00
```sh
# in foreground
docker compose up --build
# in background
docker compose up --build -d
```
2024-09-07 15:57:21 +02:00
6. For updating the relay, run the following command:
2024-09-06 17:52:49 +00:00
2024-09-07 13:29:56 -04:00
```sh
git pull
docker compose build --no-cache
# in foreground
docker compose up
# in background
docker compose up -d
```
2024-09-06 17:52:49 +00:00
2024-09-07 15:57:21 +02:00
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.
2024-09-06 17:54:55 +00:00
2024-09-07 16:53:07 +02:00
### 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 find the onion address here: `tor/data/relay/hostname`
### 8. Access the relay
2024-09-06 11:16:40 -04:00
Once everything is set up, the relay will be running on `localhost:3334` .
```bash
http://localhost:3334
```
## License
This project is licensed under the MIT License.