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 ## Installation
### Copy the preloaded database to the live database
```bash ```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 ### Install the services
Make sure to edit the `User` and `WorkingDirectory` in each service file accordingly.
```bash ```bash
sudo cp services/* /etc/systemd/system sudo cp services/* /etc/systemd/system
``` ```
@ -28,14 +29,14 @@ sudo cp services/* /etc/systemd/system
```bash ```bash
cd apis cd apis
yarn install sudo -Hu fba yarn install
``` ```
### start the services ### start the services
```bash ```bash
systemctl start fetch_blocks systemctl enable --now fetch_blocks
systemctl start fedi_block_api systemctl enable --now fedi_block_api
``` ```
## Try it out ## Try it out

View file

@ -3,8 +3,11 @@ Description=Fedi block API
[Service] [Service]
Type=simple Type=simple
Restart=always Restart=on-failure
RestartSec=1 RestartSec=10
User= User=fba
WorkingDirectory=/fedi-block-api/apis WorkingDirectory=/opt/fedi-block-api/apis
ExecStart=node fedi_block_api.js ExecStart=node fedi_block_api.js
[Install]
WantedBy=multi-user.target

View file

@ -4,7 +4,10 @@ Description=Fetch blocks
[Service] [Service]
Type=simple Type=simple
Restart=always Restart=always
RestartSec=86400 RestartSec=604800
User= User=fba
WorkingDirectory=/fedi-block-api WorkingDirectory=/opt/fedi-block-api
ExecStart=python3 fetch_blocks.py ExecStart=python3 fetch_blocks.py
[Install]
WantedBy=multi-user.target