About Gotosocial#
GoToSocial is a very lightweight (so lightweight that it doesn't even have a user interface and requires the use of third-party programs to log in and is compatible with Mastodon applications) ActivityPub federated social networking program. Building your own GoToSocial instance can prevent your information from becoming useless due to instance closure, force majeure, and other reasons.
Preparation#
- Register a Fly.io account and link a card (to prevent abuse);
- Register Cloudflare and enable R2. Enabling R2 requires linking a card. Create a storage bucket and generate an API token.
- Register render.com and create a POSTGRESQL database, and record the database password and other information.
Install flyctl#
- Linux
curl -L https://fly.io/install.sh | sh
- macOS
curl -L https://fly.io/install.sh | sh
- Windows, enable RemoteSigned: Run as administrator
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
powershell -Command "iwr https://fly.io/install.ps1 -useb | iex"
Login#
flyctl auth login
# If login fails, use
# flyctl auth login -i
# Enter account credentials to log in
Create APP#
Change YOURAPPNAME
to the desired name
flyctl launch --name YOURAPPNAME --image=superseriousbusiness/gotosocial:latest --region hkg --no-deploy
Create volume#
flyctl volumes create social_data --region hkg --size 1
Edit configuration#
Edit the fly.toml
configuration file in the root directory, refer to the following
app = "gotos" ## Custom name
primary_region = "hkg" ## Server node, currently in Hong Kong
[experimental]
vm = true
[build]
image = "superseriousbusiness/gotosocial:latest"
[env]
GTS_DB_ADDRESS = "#Database address"
GTS_DB_DATABASE = "#Database name"
GTS_DB_PORT = "5432"
GTS_DB_TLS_MODE = "enable"
GTS_DB_TYPE = "postgres"
GTS_DB_USER = "Database username"
GTS_HOST = "GTS domain"
GTS_LETSENCRYPT_ENABLED = "false"
GTS_STORAGE_BACKEND = "s3"
GTS_STORAGE_S3_BUCKET = "BUCKET name"
GTS_STORAGE_S3_ENDPOINT = "#S3 API"
GTS_STORAGE_S3_ACCESS_KEY = "#api-tokens"
GTS_STORAGE_S3_SECRET_KEY = "#api-tokens"
GTS_STORAGE_S3_PROXY = "true"
[[mounts]]
source = "social_data"
destination = "/gotosocial/storage"
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1
processes = ["app"]
In the above configuration, GTS_STORAGE_S3_ENDPOINT
should not include https:
and the final /BUCKET name
.
Deploy#
flyctl deploy
After successful launch, a URL will be displayed. If it can be accessed successfully, it means the deployment is successful.
Create users and administrators#
Execute in the fly.toml
file directory
flyctl ssh console
- Create a user
/gotosocial/gotosocial admin account create --username YOUR_USERNAME --email YOUR@EMAIL.COM --password 'SOME_VERY_GOOD_PASSWD'
YOUR_USERNAME
is the username
YOUR@EMAIL.COM
is the email
SOME_VERY_GOOD_PASSWD
is the password. It needs to be complex enough. If it is too simple, it will prompt that the password is not secure enough and needs to be reset.
- Set as administrator
/gotosocial/gotosocial admin account promote --username YOUR_USERNAME
Demo#
Download database#
Execute in the fly.toml
file directory
flyctl sftp get /gotosocial/storage/sqlite.db