## 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
```
```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
[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
[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