changed how the api is installed

This commit is contained in:
Enju Aihara 2022-03-31 19:31:34 +02:00
parent a3f1348b6e
commit b6ef7be08f
3 changed files with 23 additions and 16 deletions

View file

@ -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

View file

@ -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

View file

@ -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