GoToSocial is an ActivityPub social network server for micro blogging. It is open source, peer-to-peer, decentralised and federated. Thus, GoToSocial instances connect to the Fediverse.
This guide walks you step by step until you get a GoToSocial instance published as a service on The Edge that can be accessed on the Internet.
Make sure that all of the mandatory prerequisites have been met before progressing further.
| Name | Source | Description |
|---|---|---|
| <CONTAINER_NAME> | User input | The name of the Linux container where the app will be run. |
| <DB_PASSWORD> | User input | The password for logging in with the gotosocial database user in the database. |
| <IP_ADDRESS__EDGE_SERVER_VPN> | IP address in VPN | The IPv4 address of the the Server on The Edge in the VPN. |
| <ROOT_PWD__CONTAINER> | User input | The password of the root user in the container. |
| <IP_ADDRESS__CONTAINER> | Generated | The IPv4 address of the contaier run by the server on the Edge. |
| <IP_ADDRESS_INET_GW> | Linux VPS Admin Panel | The public and static IP address of the Internet Gateway. |
| <GOTOSOCIAL_DOMAIN> | User input | The host for the A record created with your domain registrar, e.g. gts.myowndomain.net. |
| <GOTOSOCIAL_ADMIN_EMAIL> | User input | The email address of the GoToSocial instance admin user. |
| <GOTOSOCIAL_ADMIN_PASSWORD> | User input | The password of the GoToSocial admin user |
Run the following commands on your server on the Edge.
incus launch images:debian/bookworm/cloud <CONTAINER_NAME>
incus exec <CONTAINER_NAME> bash
You may need to change the default MTU for HTTPS connections to function. Run
ip link set dev eth0 mtu 1000if you findapt updateorapt upgradestuck for long time. This setting is non persistent and it is lost when the container reboots.
apt update && apt upgrade && apt install fish curl wget
If you are not already within the container, run the following command on your server on the Edge to log in as
root.
incus exec <CONTAINER_NAME> fish
passwd
Set a password for the root user and make a (mental) note of it. It will be denoted with a variable <ROOT_PWD__CONTAINER>.
From here on the root user will use fish as default shell.
chsh -s /usr/bin/fish
Let's create the gotosocial user and set a system password for it.
useradd -m -d /var/www/gotosocial -s /usr/bin/fish -p gotosocial gotosocial
passwd gotosocial
The ability to establish SSH connections from the server on the Edge to the container is key for the upcoming Ansible automation. There is an Ansible connection driver for Linux containers with limited capabilities. The default Ansible connection driver through SSH is much more robust and powerful.
You can perform this step now or in future, when you make up your mind to give the automated solutions for system and application maintanence a try.
In order to complete this stage you need to perform the following commands in the container run by the server on The Edge.
apt update && apt install openssh-server
vi /etc/ssh/sshd_config
Add the following line to the file.
PermitRootLogin yes
systemctl enable ssh
systemctl start ssh
systemctl restart ssh
Run the following commands on your server on the Edge, i.e. outside of the container.
Run ssh-keygen only if you haven't generated SSH private and public keys on the server on the Edge. Otherwise use the already existing pair.
ssh-keygen
incus ls | grep <CONTAINER_NAME>
Make a note of the IPV4 value <IP_ADDRESS__CONTAINER>.
ssh-copy-id root@<IP_ADDRESS__CONTAINER>
Pass the password for the root user in the container as prompted.
From here on SSH connection as the
rootuser will be possible from the server on the Edge to the container. Containers are not visible and accessible to any other network devices.
Run the following commands on your server on the Edge.
incus exec <CONTAINER_NAME> fish
Let's harden the setup of the ssh server running in the container by disabling the password for logging in with root.
vi /etc/ssh/sshd_config
Delete the line PermitRootLogin yes.
Append the line PermitRootLogin prohibit-password.
systemctl restart ssh
You should have a fully functional Linux container named
<CONTAINER_NAME>that has also a non-administrative usergotosocial. In addition, the server on the Edge listens for SSH connections with therootuser. You know all login credentials.
In order to complete this stage you need to perform the following commands in the container run by the server on the Edge.
If you are not already within the container, run the following command on your server on the Edge to log in as
root.
incus exec <CONTAINER_NAME> fish
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
apt update && apt install postgresql-15
In order to enable data checksums we need to delete the existing cluster and initialize it again.
rm -rf /var/lib/postgresql/15/main
mkdir /var/lib/postgresql/15/main
chown -R postgres:postgres /var/lib/postgresql/15/main
chmod 700 /var/lib/postgresql/15/main
sudo -u postgres /usr/lib/postgresql/15/bin/initdb \
-D /var/lib/postgresql/15/main/ \
--locale=C.UTF-8 --encoding=UTF8 --data-checksums
systemctl enable postgresql@15-main.service
systemctl start postgresql@15-main.service
Verify that the stage has been completed successfully by running the following command in the container. Its output should indicate that the service is running.
systemctl status postgresql@15-main.service
In order to complete this stage you need to perform the following commands in the container run by the server on the Edge.
If you are not already within the container, run the following command on your server on the Edge to log in as
root.
incus exec <CONTAINER_NAME> fish
Take a not of the password for the database user. It will be denoted with a variable <DB_PASSWORD>.
sudo -u postgres createuser gotosocial --interactive --pwprompt
Take a note of the password <DB_PASSWORD>.
sudo -u postgres createdb gotosocial -O gotosocial --encoding='utf-8'
If you are not already within the container, run the following command on your server on the Edge to log in as
root.
incus exec <CONTAINER_NAME> fish
sudo su - gotosocial
cd ~
mkdir -p storage/certs versions config
Download the latest version of GoToSocial.
cd versions
Do not forget to replace the right version and architecture. For such details you can refer to the latest release.
export GTS_VER=0.14.2
wget https://github.com/superseriousbusiness/gotosocial/releases/download/v$GTS_VER/gotosocial_$GTS_VER_linux_amd64.tar.gz
mkdir gotosocial_$GTS_VER
tar -xvf gotosocial_$GTS_VER_linux_amd64.tar.gz -C gotosocial_$GTS_VER
ln -s gotosocial_$GTS_VER ../gotosocial
In order to complete this stage you need to perform the following commands in the container run by the server on the Edge.
If you are not already within the container, run the following command on your server on the Edge to log in as
root.
incus exec <CONTAINER_NAME> fish
sudo su - gotosocial
cd ~
mkdir tls
openssl req -x509 -nodes -newkey rsa:4096 -days 365 \
-keyout tls/key.pem \
-out tls/cert.pem
If you are not already within the container, run the following command on your server on the Edge to log in as
root.
incus exec <CONTAINER_NAME> fish
sudo -u gotosocial
cd ~
cp gotosocial/example/config.yaml config/
Edit the config/config.yaml file.
vi config/config.yaml
Make sure to substitute the variables enclosed in <...> with the real values matching your setup.
host: "<GOTOSOCIAL_DOMAIN>"
port: 8443
storage-backend: "local"
storage-local-base-path: "/var/www/gotosocial/storage"
db-type: "postgres"
db-address: "127.0.0.1"
db-port: 5432
db-user: "gotosocial"
db-password: "<DB_PASSWORD>"
tls-certificate-chain: "/var/www/gotosocial/tls/cert.pem"
tls-certificate-key: "/var/www/gotosocial/tls/key.pem"
If you are not already within the container, run the following command on your server on the Edge to log in as
root.
incus exec <CONTAINER_NAME> fish
GoToSocial has its own systemd service file that we need to copy to /etc/systemd/system.
cp /var/www/gotosocial/gotosocial/example/gotosocial.service /etc/systemd/system/
vi /etc/systemd/system/gotosocial.service
Replace the ExecStart and WorkingDirectory properties in the file with the values below.
ExecStart=/var/www/gotosocial/gotosocial/gotosocial --config-path /var/www/gotosocial/config/config.yaml server start
WorkingDirectory=/var/www/gotosocial/gotosocial
systemctl enable gotosocial.service
systemctl start gotosocial.service
systemctl status gotosocial.service
You should be able to run a successful HTTP request against the local GoToSocial server running within the container.
curl -k https://localhost:8443
In a terminal on on the server on the Edge run the following command to forward incoming HTTPS connections on port 15443 of the server to port 8443 on the container.
incus config device add <CONTAINER_NAME> \
https-15443-8443 proxy listen=tcp:0.0.0.0:15443 \
connect=tcp:127.0.0.1:8443
From here on the GoToSocial server instance should be accessible from the Server on the Edge and any other device in the same network.
curl -k https://localhost:15443
Make sure that you have created an A domain record for <GOTOSOCIAL_DOMAIN> with your domain registrar and you have waited for this record to become active.
If you use a domain name and that's not picked up by the domain name servers yet, Caddy will not be able to serve HTTPS requests because of Let's Encrypt (An SSL certificate authority) failing to verify the validity (ownership over) of the domain.
ssh mycelium@<IP_ADDRESS__INET_GW>
sudo su -
Add the following to /etc/caddy/Caddyfile.
Do not forget to substitute the variables enclosed in
<...>with the values matching your setup.
<GOTOSOCIAL_DOMAIN> {
reverse_proxy https://<IP_ADDRESS__EDGE_SERVER_VPN>:15443 {
transport http {
tls_insecure_skip_verify
}
}
}
systemctl reload caddy
If everything is configured well, you should be able to access the GoToSocial server through its domain name by using a web browser by typing
https://<GOTOSOCIAL_DOMAIN>in the address bar.
You will need to create a server user using the gotosocial executable file.
Further information related to user management in GoToSocial could be found in this guide.
If you are not already within the container, run the following command on your server on the Edge to log in as
root.
incus exec <CONTAINER_NAME> fish
sudo su - gotosocial
cd ~
Don't forget to substitute the variables enclosed within <...> with values matching your setup.
gotosocial/gotosocial --config-path /var/www/gotosocial/config/config.yaml \
admin account create \
--username admin_gts \
--email <GOTOSOCIAL_ADMIN_EMAIL> \
--password '<GOTOSOCIAL_ADMIN_PASSWORD>'
gotosocial/gotosocial --config-path /var/www/gotosocial/config/config.yaml \
admin account promote \
--username admin_gts
You can authenticate with the administrative interface by navigating to https://<GOTOSOCIAL_DOMAIN>/settings. You will need to use an admin user, such as the one created previously.
Some important settings, including federation, can be found there.
You will need to install a client app on a device of yours, authenticate and start posting.
One could find hints about client apps by navigating to https://<GOTOSOCIAL_DOMAIN>/ in a web browser.