How I started my GoToSocial instance in the Fediverse
Ever since I joined the Fediverse a year and a half ago, I had this vague idea that one day I would have my own instance. And here we are, I am now the owner and the admin of fedi.stfn.pl
The welcome screen of my instance
The final push that made me create my own instance was the sad story of botsin.space, a Fediverse server dedicated to running bots. For the last year I had been running there my Astrobin Image of the Day bot. But that now ended as its owner decided that they do not have the time and means to continue running this popular instance, and that they would be shutting it down. Gracefully, they provided ample time for migrating before the final turning off the lights.
I considered several options, most of them being migrating to other existing instances, but eventually I decided that this is a perfect motivation for me to start my own gig. After doing some research and asking a few fellow Fedi people, I decided to go with GoToSocial, an ActivityPub server application.
From reading the docs, GoToSocial seemed like an easy solution to implement, and it did not require SMTP, something which stopped me from my old plan to self-host Lemmy. One day I will write about my bad experiences with an SMTP service. I was also glad to read that GTS requires minimal resources, and so can be run on a low-tier VPS. Finally, I’ve seen a few people in the Fediverse running their own instances, and they all seemed happy with the quality of service.
OK then, the software is chosen, now for the place to run it. I again turned to RackNerd, as I am happy with their VPS that I already have, and they have a BlackFriday (ugh, I know) sale. This post, as any other, is not sponsored by them, nor by anyone else, but I have an affiliate link that you can use, and if you buy something from them using the link, I will get a tiny commission. This blog is also running on a RackNerd VPS. I went with a slightly more powerful machine, with two CPU cores and 3GB of RAM.
The rest of the post will be about the initial setup, configuration and running of my GoToSocial instance, if you, dear reader, want to do the same I would suggest reading it in full before following my steps.
No usable frontend?
Before we start, let’s get one thing out of the way. One thing that was not clear for me was that, quoting the docs, “Unlike other federated server projects, GoToSocial doesn’t include an integrated client front-end (i.e., a web app).” What does that mean?
It means that you when you go to webpage of your account, for example stfn @ fedi.stfn.pl, you will not be able to post new statuses. Also there is no timeline view of the people you follow, there is only the instance welcome screen. To actually use your account, you need to use a separate app, the two recommended by GoToSocial are Semaphore in the browser and Tusky on mobile. Semaphore is okayish, looks and works very beta-like, but Tusky I can fully recommend, its the app that I use all the time on my phone. All in all I would say it’s just a minor inconvenience, and I understand the GTS devs focusing fully on the backend part.
The preparation
Once you have your own VPS, you need to get a domain for it. One options is to buy a domain from your preferred domain provider, I personally use home.pl, but from what I know there’s a ton of them, like NameCheap, or Porkbun. After buying, point the domain to the IP address of your fresh VPS. The second option, is that if you already have a domain you can set up a subdomain, which is usually free. This is what I went with, I have the domain stfn.pl, and for the instance url I chose fedi.stfn.pl
Now, the server. I went with the typical setup and hardening of a Linux VPS, DigitalOcean has a great article on it, which I use everytime I have a new machine in the cloud: DigitalOcean initial server setup
The outcome is a VPS to which I can ssh into using only ssh keys, with a regular user with sudo permissions, and the VPS is running a firewall. The firewall is configured so that the VPS can only be accessed using ports 22 (ssh), 80 (http) and 443 (https)
A good checkpoint at this moment is to install nginx, and try opening your domain in the browser. If everything went fine, you should see a default nginx welcome screen. If not, one possibility is that you need to wait a bit, it takes time for DNS to propagate.
Installing GoToSocial
Here is the documentation for installing GTS: Installation
I would suggesting reading it all before starting with the installation, that will give a clear view of all the things that need to be done.
I went with a bare metal installation, did not feel like using Docker here. I also decided to use a separate reverse proxy for handling the incoming traffic.
I also decided that SQLite will be fine, the docs said that using SQLite is ok for instances up to 30 users, and I don’t think I will ever pass 10, with most of them being bots posting once a day or so.
Here is my config.yml
file in full:
host: "fedi.stfn.pl"
bind-address: "127.0.0.1"
port: 8000
trusted-proxies:
- "127.0.0.1/32"
db-type: "sqlite"
db-address: "sqlite.db"
storage-local-base-path: "/gotosocial/storage"
lets-encrypt-enabled: false
instance-language:
- "en-gb"
- "pl"
The default port is 8080, but I went with 8000, as 8080 is the port used by the nginx-prometheus-exporter
, about which I will talk more in the next post.
The bind-address
and trusted-proxies
are required to be this way for GTS to work with the reverse proxy. Also lets-encrypt-enabled
is set to false
as nginx will be handling the TLS certificates, not GoToSocial.
The final step here was to set up the systemd
service. I have a confession to make, I am a big fan of systemd, I use it whenever possible to daemonize services. This is also described in the documentation.
At this moment, after enabling and starting the systemd service, you should be able to curl into your instance from your server, but not from anywhere else, as GTS is running, but will only accept connections from 127.0.0.1
, meaning the same machine. You can test it out by running:
curl localhost:8000
And the response should be the HTML of the instance welcome screen.
With GoToSocial running, it’s time to configure the reverse proxy. If you did the previous steps, nginx should be already installed on your server. GoToSocial provides docs on setting it up: reverse proxy setup
For obtaining TLS certificates I am using Certbot, with Certbot the whole job is a single command, and the certificates autorenew automatically.
The upside of having a separate reverse proxy is that in the future you will be able to run other services along GTS on your VPS, and separate the traffic flowing towards them at the reverse proxy level.
At this moment you should be able to type your domain in the browser, and see the welcome screen of your GoToSocial instance.
If that is not the case, then it’s time for investigation, I would start it in this order:
# check if GoToSocial is running
sudo systemctl status gotosocial.service
# check if nginx is running
sudo systemctl status nginx.service
# check GoToSocial logs
sudo journalctl -f -u gotosocial.service
# check nginx logs
sudo tail -f /var/log/nginx/access.log
Each one of those places should tell you something about the state of things.
But if everything is fine, the instance is running, nothing is burning, you can proceed with creating the first user. GTS provides a CLI tool for the creation of users, everything is described in the docs, but for the tl;dr crowd, here’s the command:
./gotosocial --config-path /path/to/config.yaml \
admin account create \
--username some_username \
--email some_email@whatever.org \
--password 'SOME_PASSWORD'
Read the docs for other info, like promoting the user to be an admin. And remember to restart the GTS service each time you create a new user:
sudo systemctl restart gotosocial.service
After each restart, GTS needs a minute or two to be up and running again, so be patient and don’t panic :)
Using GoToSocial
And it’s done. You can now log in, using Tusky, Semaphore or any other application, provide the username, password, and instance url, and done, you are a part of the Fediverse from your own domain! It’s that simple.
Settings
To configure your account and your whole instance, you can login to the settings page, at {domain}/settings. There you will be able to well, set the settings for your account, and if you have the admin right, set the settings for the whole instance. Set the settings, wow, that came out bad. But you know what I mean. Settings. Config.
Federating
It takes a while for the other instances to find out about yours. What I did was that I used my existing accounts at pol.social and fosstodon.org to boost my “hello world” post from my first account in my instance, and it helped advertise my new instance over the Fediverse. At the moment of writing this post, my server is federating with almost 1600 other instances.
Who is using fedi.stfn.pl?
Right now it’s me, and my two bots:
For now I do not plan to invite anyone else, I am new at this Fedi administration thing, and if I break something and lose all data, I want to be the only one affected by it.
Bottom line
So here I am, with my own Fediverse instance. So far it has been running fine, there are still some things I need to work out, like regular backups. I have nginx logs opened in the background to take a look at them now and then and see if there are any problems happening. In the other pane of tmux I have htop opened to see the resources usage. So far, barring short spikes when someone popular boosts my toots, the load is close to 0.0, and RAM usage is around 400-500MB.
I am sure this is only the first blog post in a series in which I will be talking about my experiences as an admin. And already I have to say, it does feel good :)
And what is more, having my own instance means I can upload my own custom emojis. Being a person who grew up in Poland in the 90s and 00s, the choice was obvious. I apologize for nothing.
I would like to thank
Special thanks to Amin and Inga for helping me work out some doubts and issues that I had with initial configuration! :)
Coming up next
Soon there should be another blog post, in which I will talk about how I migrated my bot, and about setting up monitoring for my instance.
Thanks for reading!
If you enjoyed this post, please consider helping me make new projects (and pay for the servers!) by supporting me on the following crowdfunding sites: