Skip to content

Instantly share code, notes, and snippets.

@mikaelhg
Last active November 14, 2022 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikaelhg/9c4138cecb0622eb3db927a3c100fb05 to your computer and use it in GitHub Desktop.
Save mikaelhg/9c4138cecb0622eb3db927a3c100fb05 to your computer and use it in GitHub Desktop.
Hetzner + Caddy + GoToSocial

Zero to self-hosted Fediverse presence

With Hetzner + Caddy + GoToSocial.

1. You probably already have some way to host content on the Internets, but if not, get a $5 Hetzner cloud server. I just put it on my home server, a old repurposed thin client.

2. Install Caddy.

3. Download the GotToSocial tarball.

Create a gotosocial user and group, with homedir /home/gotosocial.

Unpack the tarball into /home/gotosocial.

Create a symbolic link of /usr/local/bin/gotosocial to /home/gotosocial/homegotosocial.

Copy the example configuration file to /etc/gotosocial/config.yaml, edit it as below.

Copy gotosocial.service to /etc/systemd/system/gotosocial.service, edit it.

Run sudo systemctl enable gotosocial and sudo systemctl start gotosocial. Check /usr/log/gotosocial.log for errors, and fix.

4. Create your initial accounts with the commands

sudo -u gotosocial ./gotosocial --config-path /etc/gotosocial/config.yaml admin account

First you create, then you confirm, and remember to give your account admin rights. Read more in the gotosocial docs.

4. Log in with https://pinafore.social/

I also installed the Python CLI client toot with pip install --user --upgrade toot, but logging in with that client required capturing the OAuth2 token required by toot by ps axufwww | grep arn when the Chrome client launch failure window was visible.

# /etc/caddy/Caddyfile
gueck.com {
encode zstd gzip
redir / /@mikael temporary
reverse_proxy * http://127.0.0.1:18088 {
# Flush immediatly, to prevent buffered response to the client
flush_interval -1
}
}
# Edits only to /etc/gotosocial/config.yaml
host: "gueck.com"
account-domain: "gueck.com"
bind-address: "127.0.0.1"
port: 18088
db-type: "sqlite"
db-address: "/home/gotosocial/sqlite.db"
accounts-registration-open: false
storage-local-base-path: "/home/gotosocial/storage"
letsencrypt-cert-dir: "/home/gotosocial/storage/certs"
# Edits only to /etc/systemd/system/gotosocial.service
ExecStart=/usr/local/bin/gotosocial --config-path /etc/gotosocial/config.yaml server start
WorkingDirectory=/home/gotosocial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment