preliminary systemd unit and environment configuration file

pull/967/head
Anthony Bucci 2 months ago
parent c03e7f291a
commit b970a56f03
  1. 47
      deployment/systemd/README.md
  2. 10
      deployment/systemd/yarnd.env
  3. 16
      deployment/systemd/yarnd.service

@ -0,0 +1,47 @@
# Setting up `yarnd` with `systemd`
1. Copy `yarnd.sevice` and `yarnd.env` from `deployment/systemd/yarnd.service` to someplace convenient for editing. You will need to decide on values for the following variables and then edit `yarnd.service` and `yarnd.env` accordingly
| Variable | Meaning |
| ------------- | ----------------------------------------------------- |
| YOUR_POD_URL | The external URL at which your pod will be accessible |
| YOUR_POD_NAME | The friendly name of your pod |
| YARND_USERID | A system userid |
| YARND_USERGROUP | A system usergroup |
| YOUR_ADMIN_EMAIL_ADDRESS | The email address of your pod's admisnitrator |
| YOUR_ADMIN_NAME | A human name |
| YARND_ADMIN_USERID | A system userid; can be the same as YARND_USERID |
| YARND_EXECUTABLE_LOCATION | For instance, `/usr/local/bin` |
| YARND_ENVIRONMENT_LOCATION | For instance, `/etc/default` |
| YARND_DATA_LOCATION | For instance `/var/local/data` |
2. Put your newly-edited `systemd` unit into your system's `systemd` units directory. From the `yarn` directory cloned from gitea:
```bash
# sudo cp yarnd.service /lib/systemd/system/
```
3. Put yoru newly-edited `yarnd.env` file into YARND_ENVIRONMENT_LOCATION, the location you chose earlier:
```bash
# sudo cp yarnd.env YARND_ENVIRONMENT_LOCATION
```
4. Tell the `systemd` daemon to reload its configuration
```bash
# sudo systemctl daemon-reload
```
5. Tell `systemd` to start the yarn daemon
```bash
# sudo systemctl start yarnd
```
6. Verify the daemon started correctly
```bash
# sudo systemctl status yarnd
```
7. If you want `yarnd` to be restarted when your system reboots, enable the unit
```bash
# sudo systemctl enable yarnd
```

@ -0,0 +1,10 @@
# /etc/default/yarnd
#
# to generate those keys randomly
# cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1
#
# yarn.social environment for systemd unit
API_SIGNING_KEY=???
COOKIE_SECRET=???
MAGICLINK_SECRET=???
OPEN_REGISTRATIONS=true

@ -0,0 +1,16 @@
[Unit]
Description=YOUR_POD_NAME
After=syslog.target
After=network.target
[Service]
Type=simple
User=YARND_USERID
Group=YARND_USERGROUP
EnvironmentFile=YARND_ENVIRONMENT_LOCATION/yarnd.env
ExecStart=YARND_EXECUTABLE_LOCATION/yarnd -d YARND_DATA_LOCATION-s bitcask://YARND_DATA_LOCATION/yarn.db --admin-email "YOUR_ADMIN_EMAIL_ADDRESS" --admin-name "YOUR_ADMIN_NAME" --admin-user "YARND_ADMIN_USERID" --description "YOUR_POD_NAME" --lang "en" --name "Buccipod" -u "YOUR_POD_URL"
TimeoutSec=300
[Install]
WantedBy=multi-user.target
Loading…
Cancel
Save