Islands: Setting Up Your Own Island

@oliphant@writer.oliphant.social

If you want to join an island network, you will either need to join an island server, or else create your own. Island fedi accounts are distinct and separate from other fediverse accounts, as this is a separate opt-in network. Once you create a single island account, you shouldn't need to create another unless you need to join two completely disconnected archipelagos.

Note: We use the term “Island Network” and “Archipelago” interchangeably. Use whatever you prefer.

However, I encourage you to create your own, even if you're just a single individual or a small family. Doing so is pretty easy. For this tutorial, we're going to use GoToSocial as our server software for this project. You can use any kind of fedi software to create an island, of course, so long as it supports allowlist or limited federation mode.

Why GoToSocial?

For a few reasons. The first is that, compared to Mastodon, GoToSocial is very simple and requires a fraction of the resources required for Mastodon, which automatically makes it cheaper to host, easy to set up and configure, and you don't have to do anything at all with nginx, it has its own webserver and letsencrypt (https) support, too.

It was intended to be used for small communities, it was not designed or optimized for hundreds of thousands of users per server, which is perfect for our network of small island servers.

In addition to Postgres, it supports sqlite and can store assets on disk, which means you won't need to worry about configuring a database or cloud storage (though that's certainly an option).

You can probably run it off of a Raspberry Pi (though I suspect you'll need a super fast SD card to handle writing in a performant fashion to the sqlite db).

You don't have to know anything about Golang to use it, in fact you can run it quite easily with a docker container, and that's the tutorial I'm going to do here.

Get a Server

NOTE: You may want to do a bare metal install rather than a Docker install. Use this guide to do a bare metal install of GTS. It also has the added benefit of being a very cheap VPS ($3.75/mo) and runs on clean energy! Skip the rest of this document if you are planning on using that type of server, otherwise continue this tutorial to perform a Docker install of GTS.

You'll have to host it somewhere, after all. For the sake of simplicity, we're going to assume you have that part covered. The system requirements for GoToSocial are very minimal but you should still review those documents to get an idea of how big of a server you'll need. The easiest method is to get a VPS.

On Digital Ocean, a 1GB/1CPU server with 35GB of storage space costs $8/mo. Get a few people chipping in, and that becomes even more manageable. Hostwinds offers similar pricing.

For the sake of this tutorial, we'll make a few assumptions, starting with a Ubuntu server.

We're also going to assume you know how to handle DNS, and have an A record for your new shiny domain name for your new island pointed to your server, so you can “come with your own hostname” when filling out the GTS_HOST in the docker-compose.yml below.

Set Up the Server

Once you log into the server, let's update it, install any necessary upgrades, and put docker and fail2ban on it. You'll also need to open up ports 443, 80, and 22 (for SSH) in the firewall.

Note: You can do all of this logged in as the root user.

sudo apt-get update && apt-get upgrade -y && apt-get install fail2ban
sudo apt-get dist-upgrade

Create a user for the gotosocial process, we don't want to run the GTS process with root permissions.

sudo useradd gotosocial

This user, if it's the first you created, will be user 1000 of group 1000, which will match our default GoToSocial docker file. You should check just to make sure.

$ id -u gotosocial
1000

Reboot if necessary (with the reboot command), then let's install Docker.

First, adding the Docker repo:

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Now do the Docker install.

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Test that Docker is running
sudo docker run hello-world

You should see a 'Hello World' message if docker is properly installed.

Now that this is done, let's set up the firewall.

Start by checking the status.

ufw status verbose

If this is your first time setting up the server, the firewall is likely inactive. We'll open up the ports we need, then enable the firewall.

Let's open up ssh (port 22), http (80), and https (443).

ufw allow ssh
ufw allow http
ufw allow https

Now enable the firewall.

ufw enable
Install GoToSocial

We'll be using the Docker container for this purpose, for ease of install and updates.

Create the folder for our gotosocial app, and change ownership to our gotosocial user.

mkdir -p ~/gotosocial/data

cd ~/gotosocial

Then we will need to create the docker-compose file to turn it into an island and get it to work with your server.

Before we do that, quickly run the date command and note your server's timezone. Hopefully it's UTC, but if not, you'll need to enable and modify the TZ option using one of the TZ Identifiers found here. Example: America/New York

$ date
Sat Aug  3 22:01:20 UTC 2024

(In the case of Island One, and a lot of VPS servers, UTC is the default.)

Now let's create the file.

nano docker-compose.yml

For our purposes, you should be able to cut and paste the following into the docker-compose.yml, modifying as appropriate for your domain. Be sure to modify GTS_HOST at minimum. If you know your SMTP settings and want to send out email, you can optionally add those settings below. Despite asking for an email address for signing in, an admin can 'confirm' an email address with the CLI.

In addition, remove the # in front of GTS_ACCOUNTS_REGISTRATION_OPEN if you want to enable signups on your island. Note that you can change this at any time, you'll just need to run docker compose restart from the ~/gotosocial folder.

Lastly, note the user: 1000:1000 below. If your gotosocial user is not 1000 and with a group of 1000, you'll need to modify this entry as well.

Copy and paste the following into your nano editor window:

services:
  gotosocial:
    image: superseriousbusiness/gotosocial:latest
    container_name: gotosocial
    user: 1000:1000
    networks:
      - gotosocial
    environment:
      # change log level to 'warn' for less verbose logging
      GTS_LOG_LEVEL: info
      GTS_HOST: [YOUR HOST HERE, aka. uno.1sland.social]
      GTS_DB_TYPE: sqlite
      GTS_DB_ADDRESS: /gotosocial/storage/sqlite.db
      # If you want to open up registration on your server
      # Note that all registrations require review by default
      #GTS_ACCOUNTS_REGISTRATION_OPEN: "true"
      GTS_LETSENCRYPT_ENABLED: "true"
      GTS_LETSENCRYPT_EMAIL_ADDRESS: ""
      # Optional: If you have a preferred language for your instance
      #GTS_INSTANCE_LANGUAGES: "en"
      
      # REQUIRED: This is what makes this an island server
      GTS_INSTANCE_FEDERATION_MODE: "allowlist"

      # This is a compatibility option that helps the server spoof other apps
      # Since GTS supports the Mastodon api
      GTS_INSTANCE_INJECT_MASTODON_VERSION: "true"
      # Default Post character limit of 5000, you can adjust it by
      # uncommenting GTS_STATUSES_MAX_CHARS
      #GTS_STATUSES_MAX_CHARS: 5000
      # Optional: For sending out mail
      #GTS_SMTP_HOST: ""
      #GTS_SMTP_PORT: 587
      #GTS_SMTP_USERNAME: ""
      #GTS_SMTP_PASSWORD: ""
      #GTS_SMTP_FROM: "yourname@example.com"
      ## For reverse proxy setups:
      # GTS_TRUSTED_PROXIES: "172.x.x.x"
      ## Set the timezone of your server:
      #TZ: UTC
    ports:
      - "443:8080"
      ## For letsencrypt:
      - "80:80"
      ## For reverse proxy setups:
      #- "127.0.0.1:8080:8080"
    volumes:
      - ~/gotosocial/data:/gotosocial/storage
    restart: "always"

networks:
  gotosocial:
    ipam:
      driver: default

Note the above script comes from this example script if you'd prefer to review the defaults, and this file may change over time.

Hit Ctrl + X and then Y to save the file.

Now let's make sure everything is owned by the gotosocial user we created.

# change ownership to gotosocial user
sudo chown gotosocial:gotosocial ~/gotosocial/*

And that's it. Now we start up the server.

docker compose up -d

If you hit the host from https://GTS_HOST above, you should see your new island home page, working over SSL.

Create an Admin user

Now you need to create a user to administer your server. For this next part, you'll have to ensure you create a strong password. GTS won't let you create a weak password, so let's generate something cryptographically secure and unique.

$ openssl rand -base64 24 
eA/HSr80X+WWF1E+r8QnDQTqd4eFBmxm

Don't use the password above, that's just an example.

Now we use the GTS CLI to create a user, using the password above.

Modify admin below as you see fit. This will be the user's handle on your server.

docker exec -it gotosocial /gotosocial/gotosocial admin account create --username admin --email you@example.com --password '[your password]'

Yes, put the password inside the quotes. You will login with the email and password, but the admin's handle will be the username you select above.

In addition, you might want to go ahead and “confirm” their email address, especially if you're not using an SMTP server.

docker exec -it gotosocial /gotosocial/gotosocial admin account confirm --username admin

And even though we created an admin, the admin privileges might not be set. You can fix that by promoting the user to an admin:

docker exec -it gotosocial /gotosocial/gotosocial admin account promote --username admin

Now, because GTS is a bit weird about this, you'll need to restart the GTS service after creating this user for them to be able to log in and see all the admin functions.

docker compose restart

Once that's done, you can log into the backend and admin interface by going to /settings, or in other words https://[your host]/settings.

Administering The Server

You need to log in at the /settings endpoint. In other words, at https://[your server]/settings.

Log in with the admin email and password from above.

From the settings area you should be not only able to change your profile, avatar, and other basic settings, but also server-level settings.

Importantly, you'll want to ensure you have access to the 'Moderation' area on the left, and then visit Domain Permissions > Allows, or /settings/moderation/domain-permissions/allows

Lastly, under the 'Accounts' area is where you can click in to review the 'Pending' signups for your instance, if you enabled signups.

Basic Server Commands

If you ever want to update and pull the latest version of GTS:

docker compose stop && docker compose rm -f && docker compose pull && docker compose up -d

If you need to make a change to the docker-compose.yml file to change a configuration setting, you can restart the server quickly:

docker compose restart

And that's basically it.

If you want a good user interface for GoToSocial (and Mastodon as well), I highly recommend Phanpy.

Install Script

If you prefer an installer, this repo has all of the details about how to run it on your server.

— @oli 🐘