What is GoToSocial
GoToSocial provides a lightweight, customizable, and safety-focused entryway into the Fediverse, and is comparable to (but distinct from) existing projects such as Mastodon, Pleroma, Friendica, and PixelFed. -GitHub - gotosocial
In simple words it is a simple micro-blogging application with connectivity to other fediverse applications.
It is also compatible with mastodon API.
GoToSocial over Mastodon
There are quite a few reasons to run GoToSocial instance.
-
It is simpler to run and very easy to setup.
-
Personal instances don’t need a big heavy mastodon server.
-
Customizable CSS for account pages.
A few cons
-
It is still under development and is not feature complete with mastodon, plemora and other fediverse microblogging programs.
-
It doesn’t have an integrated client front-end, basically you cannot post directly from the site. Personally I like this way more, since I find 3rd party clients much better.
-
3rd party apps still have bugs, with GoToSocial and sometimes bug out.
Fedilab just keeps on crashing for me.
Docker
Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers.[5] The service has both free and premium tiers. The software that hosts the containers is called Docker Engine.[6] It was first started in 2013 and is developed by Docker, Inc.[7] ~ Docker (software) - Wikipedia
It containerizes apps and makes them easier to deploy and maintain. It is the most beautiful thing ever. Once you use it, you want everything to be a docker app. So simple so elegant.
Get Started here: Overview | Docker Documentation
A bit about Cloudflare Tunnels
A good way to describe it for my purpose would be a cornered man’s port-forwarding. They do have their advantages in terms of security and ease of use and security compared to normal port forwarding.
A cloudflare tunnel, routes a service, without needing port-forwarding or a publicly routable IP address. You can use it with CGNAT ip addresses!.
There are other more complex and desirable features that cloudflare provides with their cloudflare tunnels, you should check it out. Over the years cloudflare is one of the companies, I’ve truly had a good experience with.
There are other providers and self hosting options for this purpose available, I just use cloudflare because they are my domain registrar. The process for other providers should be similar. Their UI is also a joy to use albeit a bit slow.
I use it at home because my ISP blocks port-forwarding and for my Oracle cloud instance. Oracle provides a free tier for hosting cloud instances, but the ways in which they have scarred me…. by using their god awful UI, laggy ssh sessions which kill themselves mid command, I could simply use an
A
name record to point to the oracle provided ip-address, but that is giving Oracle too much power.My two cents about using Oracle:
Don’t.
If there is no other choice, use as less of Oracle as possible.
I applied to their pay as you go plan so that they don’t just delete my free instance, for “verification” they deducted 100 USD from my account, that scared the ever living shit out of me, until I got the message 1 minute later from my bank, that it was reversed. At least give a warning saying you will be checking for 100 USD, by deducting and refunding it.
I have since terminated my Oracle Cloud Account.
Checklist before starting
-
A device with docker installed. (If the device is a windows machine, change the bash command to however they suit you, I have no idea how it works.)
-
Internet connection.
-
Domain name to point to. If using cloudflare ensure the domain is available at cloudflare. For other services, do whatever they say for you having the needed rights for pointing a domain name.
Instructions
Step 1: Installing GoToSocial
-
On your machine create directory
gotosocial
and sub directorydata
and filedocker-compose.yaml
:Alternatively: follow the official docs and edit
docker-compose.yml
accordingly in next step.1 2 3
mkdir -p ~/gotosocial/data cd gotosocial touch docker-compose.yaml
-
Paste the following in your
docker-compose.yaml
:Edit the following parameters:
-
GTS_HOST
-
GTS_ACCOUNT_DOMAIN
, remove if you do not want account delegation. Having is makes your handle as@[email protected]
instead of@[email protected]
. -
path/to/data
should be the complete path, do not use~
like~/gotosocial/data
, it errors out and the container keeps restarting. Read more about it here.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
version: "3.3" services: gotosocial: image: superseriousbusiness/gotosocial:latest container_name: gotosocial user: 1000:1000 hostname: gts.docker # If you change this remember the hostname networks: - gotosocial environment: GTS_HOST: gts.example.com # Change Me GTS_ACCOUNT_DOMAIN: example.com # Change Me GTS_DB_TYPE: sqlite GTS_DB_ADDRESS: /gotosocial/storage/sqlite.db GTS_LETSENCRYPT_ENABLED: "false" GTS_LETSENCRYPT_EMAIL_ADDRESS: "" volumes: - /path/to/data:/gotosocial/storage #Change path restart: "always" networks: gotosocial: ipam: driver: default
-
Now simply
docker-compose up -d
ordocker compose up -d
. -
Check if
gotosocial
is working correctly by runningdocker logs -f gotosocial
. If it is running correctly, you should get similar message:1 2 3 4 5 6 7 8
time=2022-04-19T09:48:35Z level=info msg=connected to SQLITE database time=2022-04-19T09:48:35Z level=info msg=MIGRATED DATABASE TO group #1 (20211113114307, 20220214175650, 20220305130328, 20220315160814) func=doMigration time=2022-04-19T09:48:36Z level=info msg=instance account example.org CREATED with id 01EXX0TJ9PPPXF2C4N2MMMVK50 time=2022-04-19T09:48:36Z level=info msg=created instance instance example.org with id 01PQT31C7BZJ1Q2Z4BMEV90ZCV time=2022-04-19T09:48:36Z level=info msg=media manager cron logger: start[] time=2022-04-19T09:48:36Z level=info msg=media manager cron logger: schedule[now 2022-04-19 09:48:36.096127852 +0000 UTC entry 1 next 2022-04-20 00:00:00 +0000 UTC] time=2022-04-19T09:48:36Z level=info msg=started media manager remote cache cleanup job: will run next at 2022-04-20 00:00:00 +0000 UTC time=2022-04-19T09:48:36Z level=info msg=listening on 0.0.0.0:8080
-
Step 2: Setting up Cloudflare Zero Trust
-
Login to your cloudflare account and select
Zero Trust
in the sidebar. -
Signup for a free account.
Step 3: Create a tunnel
-
Login to your Zero Trust account.
-
On the sidebar select
Access
then in the sub-menuTunnels
. -
Select
Create a tunnel
, then name your tunnel andSave Tunnel
. -
Do not close the webpage yet.
Step 4: Installing cloudflared
-
In a new folder create a new
docker-compose.yaml
.1 2 3 4
cd ~ # Or wherever you want to create the folder mkdir cloudflared cd cloudflared touch docker-compose.yaml
-
In the
docker-compose.yaml
file add the following, replacing<token>
with the token from the cloudflare tunnels webpage.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
version: "3.9" services: tunnel: container_name: cloudflared networks: - gotosocial_gotosocial image: cloudflare/cloudflared restart: unless-stopped command: tunnel run environment: - TUNNEL_TOKEN=<token> networks: gotosocial_gotosocial: external: true
-
Save the file and
docker-compose up -d
ordocker compose up -d
.
Back on your cloudflare tunnels page, scroll down to check if connector is connected. If it shows a connector hit save.
If you want to add other services to this cloudflare tunnel simply add their networks to the above docker file like how the
gotosocial_gotosocial
network is added and rundocker compose up -d
.You can also do this the other way round, creating a cloudflared specific network and then adding it to your apps as you create them, but i don’t recommend it because then all your services are connected to that network and can access each other. This way only cloudflared is connected to your services.
If you want a good GUI for docker portainer is an incredible tool.
Step 5: Pointing your domain name
-
Choose whatever
domain
you want. -
In
Service
add:-
Type: HTTP
-
URL:
gts.docker:8080
(replacegts.docker
with whatever hostname you put in Step 1 and8080
is the port where GoToSocial is listening.)
-
-
Select
Save hostname
.
remove/change sub-domain as you see fit.
Voila!!
If you did everything correctly your GoToSocial instance should be up and running. Access it at gts.whatever-your-domain-is
. Now go wild.
Bonus Round: Creating users
To create a user:
|
|
And then to promote the created user to admin:
|
|
Further Reading
I recommend reading the GoToSocial Documentation as it was quite helpful making this. Overall it is well-written, missing a few things here and there. You can also find further configuration options there.