lk/networking/servers/agate.md

87 lines
1.6 KiB
Markdown
Raw Permalink Normal View History

2022-01-16 18:20:39 +00:00
---
2023-06-17 16:28:15 +00:00
title: "Agate on Arch Linux"
tags: [ "Documentation", "Networking", "Arch", "Gemini" ]
2022-01-16 18:20:39 +00:00
---
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
Docs are [here](https://github.com/mbrubeck/agate).
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
You will need DNS set up before proceeding.
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
Install agate.
`yay -S agate`
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
Be root!
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
In my case the domain is 'splint.rs'.
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
`DOMAIN1=splint.rs`
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
You can set up any number of domain names.
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
`DOMAIN2=ttrpgs.com`
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
Make a directory to serve the gemini files from:
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
`GEMDIR=/srv/gemini`
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
`mkdir -p $GEMDIR/$DOMAIN1`
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
`mkdir -p $GEMDIR/$DOMAIN2`
2022-02-05 17:20:55 +00:00
2023-06-17 16:28:15 +00:00
Put at least one gemini file into the directory:
2021-02-24 03:50:05 +00:00
```
2023-06-17 16:28:15 +00:00
echo Welcome to $DOMAIN1 > $GEMDIR/$DOMAIN1/index.gmi
echo Welcome to $DOMAIN2 > $GEMDIR/$DOMAIN2/index.gmi
```
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
Set a language variable:
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
`LANG=en_GB`
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
You need to run the agate command once interactively, in order to create certs:
```
agate --content $GEMDIR --certs $GEMDIR/.certs \
--addr [::]:1965 --addr 0.0.0.0:1965
--hostname $DOMAIN1 --hostname $DOMAIN2
--lang $LANG
2021-02-24 03:50:05 +00:00
```
2023-06-17 16:28:15 +00:00
Once that works, it's time to make a service file; select any name for it:
`SVFILE=st`
```
echo "
CONTENT=--content $GEMDIR
CERT=--certs $GEMDIR/.certs
ADDR=--addr [::]:1965 --addr 0.0.0.0:1965
HOSTNAME=--hostname $DOMAIN1 --hostname $DOMAIN2
LANG=--lang $LANG
" > $SVFILE.conf
```
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
Check the service file has all those variables and looks right:
2021-02-24 03:50:05 +00:00
2023-06-17 16:28:15 +00:00
`cat $SVFILE.conf`
2023-04-17 07:16:03 +00:00
2023-06-17 16:28:15 +00:00
Now move it into the agate config directory:
2023-04-17 07:16:03 +00:00
2023-06-17 16:28:15 +00:00
`mv $SVFILE.conf /etc/agate/`
And finally, start the service:
```
systemctl daemon-reload
systemctl enable --now agate@$SVFILE.conf
```
Your Gemini capsule should be available, and you should be able to see any access in the logs:
```
journalctl -xeu agate@$SVFILE.conf
```
2023-04-17 07:16:03 +00:00