bitvora / haven

High Availability Vault for Events on Nostr
75 stars 14 forks source link

feat: Add Docker support and JSON file support #1

Closed HolgerHatGarKeineNode closed 1 month ago

HolgerHatGarKeineNode commented 1 month ago

This commit introduces Docker support to the project. It includes Dockerfile, docker-compose.yml, and docker-compose.tor.yml for running the application in a Docker container and setting up a Tor hidden service. It also updates the README to include instructions for using Docker.

Additionally, it makes adjustments to .env.example and .gitignore files for better Docker compatibility.

I wanted to be able to mount the folder db and haven outside of Docker in order to use my own backup strategies. To do this, I created the two folders and put .gitignore files in each of them. The folders must exist before we start Docker containers.

HolgerHatGarKeineNode commented 1 month ago

feat: add support for relay list from json file

This commit adds the ability to specify relay lists in a json file for both import and blastr settings. This provides more flexibility in configuring the application. It also includes error handling for reading and parsing the json file.

relays_blastr.json relays_import.json

These files contain the default values from the example .env. If you want, you can enter the file name of a JSON file in the .env and then this list will be loaded. I have experimented and wanted to use blastr on all relays that are available at https://api.nostr.watch/v1/online.

Sorry, I don't know how to separate PRs. Still need to learn, that was another push on my fork.

barrydeen commented 1 month ago

can you also set these in the .gitignore and have relays_blastr.json.example, so when people pull new versions it doesn't overwrite their originals?

HolgerHatGarKeineNode commented 1 month ago

@barrydeen ok, this is now explained in the README:


3. Set your environment variables

Open the .env file and set the necessary environment variables.

If you want to use custom relay files for import and blastr, you can specify IMPORT_SEED_RELAYS_FILE and BLASTR_RELAYS_FILE in the .env file. First, copy the example JSON files:

cp relays_import.example.json relays_import.json
cp blastr_relays.example.json blastr_relays.json

Then, set the paths to the files in the .env file:

IMPORT_SEED_RELAYS_FILE=relays_import.json
BLASTR_RELAYS_FILE=blastr_relays.json

The JSON should contain an array of relay URLs (without ws:// or wss://):

[
  "relay.damus.io",
  "nos.lol",
]

I need the two .gitignore files in db and haven folders, because otherwise git clone will not create those folders for us.