diff --git a/README.md b/README.md index 117589c..12efbcf 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,17 @@ Used to see which instances block yours. ## Installation -### Copy the preloaded database to the live database - ```bash -cp blocks_preloaded.db blocks.db +sudo useradd -m fba +sudo mkdir -p /opt/fedi-block-api +sudo chown -R fba:fba /opt/fedi-block-api +sudo -Hu fba git clone https://gitlab.com/EnjuAihara/fedi-block-api.git /opt/fedi-block-api +cd /opt/fedi-block-api +sudo -Hu fba cp blocks_preloaded.db blocks.db ``` ### Install the services -Make sure to edit the `User` and `WorkingDirectory` in each service file accordingly. - ```bash sudo cp services/* /etc/systemd/system ``` @@ -28,14 +29,14 @@ sudo cp services/* /etc/systemd/system ```bash cd apis -yarn install +sudo -Hu fba yarn install ``` ### start the services ```bash -systemctl start fetch_blocks -systemctl start fedi_block_api +systemctl enable --now fetch_blocks +systemctl enable --now fedi_block_api ``` ## Try it out diff --git a/services/fedi_block_api.service b/services/fedi_block_api.service index 51f7407..7b62676 100644 --- a/services/fedi_block_api.service +++ b/services/fedi_block_api.service @@ -3,8 +3,11 @@ Description=Fedi block API [Service] Type=simple -Restart=always -RestartSec=1 -User= -WorkingDirectory=/fedi-block-api/apis +Restart=on-failure +RestartSec=10 +User=fba +WorkingDirectory=/opt/fedi-block-api/apis ExecStart=node fedi_block_api.js + +[Install] +WantedBy=multi-user.target diff --git a/services/fetch_blocks.service b/services/fetch_blocks.service index cca342d..d5230f9 100644 --- a/services/fetch_blocks.service +++ b/services/fetch_blocks.service @@ -4,7 +4,10 @@ Description=Fetch blocks [Service] Type=simple Restart=always -RestartSec=86400 -User= -WorkingDirectory=/fedi-block-api -ExecStart=python3 fetch_blocks.py +RestartSec=604800 +User=fba +WorkingDirectory=/opt/fedi-block-api +ExecStart=python3 fetch_blocks.py + +[Install] +WantedBy=multi-user.target