diff options
author | 2023-06-10 11:13:04 +0200 | |
---|---|---|
committer | 2023-06-10 11:13:04 +0200 | |
commit | 84e1c7a7c49f5ecf0b75322c9554a3a89846ccc5 (patch) | |
tree | 5fbf78d6ae99030851f5f2ebc2c6731f58656e16 /docs/getting_started/installation | |
parent | [bugfix] Delete from list timeline on status deletion (#1878) (diff) | |
download | gotosocial-84e1c7a7c49f5ecf0b75322c9554a3a89846ccc5.tar.xz |
[docs] Revamp the installation guide (#1877)
This tries to revamp/restructure the installation guide. It's renamed to
"Getting Started" as it now contains a few more things than just the
installation, especially the deployment considerations which we didn't
use to spell out as much ahead of time.
Installation is now a section with the guides on their own. I've removed
a bit of redundancy like the user creation. I also removed the rogue
reverse proxy section in the Docker guide and lifted that into the
reverse proxy section.
Diffstat (limited to 'docs/getting_started/installation')
-rw-r--r-- | docs/getting_started/installation/container.md | 123 | ||||
-rw-r--r-- | docs/getting_started/installation/index.md | 14 | ||||
-rw-r--r-- | docs/getting_started/installation/metal.md | 123 |
3 files changed, 260 insertions, 0 deletions
diff --git a/docs/getting_started/installation/container.md b/docs/getting_started/installation/container.md new file mode 100644 index 000000000..de134542f --- /dev/null +++ b/docs/getting_started/installation/container.md @@ -0,0 +1,123 @@ +# Container + +This guide walks you through getting GoToSocial up and running using the official container images we publish. In this case we'll be using the Docker runtime directly through [Docker Compose](https://docs.docker.com/compose) together with SQLite as the database. + +You can also run GoToSocial using a container orchestration system such as [Kubernetes](https://kubernetes.io/) or [Nomad](https://www.nomadproject.io/), but that is beyond the scope of this guide. + +## Create a Working Directory + +You need a working directory in which your docker-compose file will be located, and a directory for GoToSocial to store data in, so create these directories with the following command: + +```bash +mkdir -p ~/gotosocial/data +``` + +Now change to the working directory you created: + +```bash +cd ~/gotosocial +``` + +## Get the latest docker-compose.yaml + +Use `wget` to download the latest [docker-compose.yaml](https://raw.githubusercontent.com/superseriousbusiness/gotosocial/main/example/docker-compose/docker-compose.yaml) example, which we'll customize for our needs: + +```bash +wget https://raw.githubusercontent.com/superseriousbusiness/gotosocial/main/example/docker-compose/docker-compose.yaml +``` + +## Edit the docker-compose.yaml + +Because GoToSocial can be configured using [Environment Variables](../../configuration/index.md#environment-variables), we can skip mounting a config.yaml file into the container, to make our configuration simpler. We just need to edit the docker-compose.yaml file to change a few things. + +First open the docker-compose.yaml file in your editor of choice. For example: + +```bash +nano docker-compose.yaml +``` + +### Version + +If desired, update the GoToSocial Docker image tag to the version of GtS you want to use. + +`latest` - the default. This points to the latest stable release of GoToSocial. + +`snapshot` - points to whatever code is currently on the main branch. Not guaranteed to be stable, will often be broken. Use with caution. + +You can also replace `latest` with a specific GoToSocial version number. This is recommended when you want to make sure that you don't update your GoToSocial version by accident, which can cause problems. + +The list of releases can be found [right here](https://github.com/superseriousbusiness/gotosocial/releases), with the newest release at the top. Replace `latest` in the docker-compose.yaml with the number of the desired release (without the leading `v` or trailing version name). So for example if you want to run [v0.3.1 Sleepy Sloth](https://github.com/superseriousbusiness/gotosocial/releases/tag/v0.3.1) for whatever reason, you should replace: + +```text +image: superseriousbusiness/gotosocial:latest +``` + +with: + +```text +image: superseriousbusiness/gotosocial:0.3.1 +``` + +### Host + +Change the `GTS_HOST` environment variable to the domain you are running GoToSocial on. + +### User (optional / probably not necessary) + +By default, Dockerized GoToSocial runs with Linux user/group `1000:1000`, which is fine in most cases. If you want to run as a different user/group, you should change the `user` field in the docker-compose.yaml accordingly. + +For example, let's say you created the `~/gotosocial/data` directory for a user with id `1001`, and group id `1001`. If you now try to run GoToSocial without changing the `user` field, it will get a permissions error trying to open its database file in the directory. In this case, you would have to change the `user` field of the docker compose file to `1001:1001`. + +### LetsEncrypt (optional) + +If you want to use [LetsEncrypt](../../configuration/tls.md) for TLS certificates (https), you should also: + +1. Change the value of `GTS_LETSENCRYPT_ENABLED` to `"true"`. +2. Remove the `#` before `- "80:80"` in the `ports` section. +3. (Optional) Set `GTS_LETSENCRYPT_EMAIL_ADDRESS` to a valid email address to receive certificate expiry warnings etc. + +## Start GoToSocial + +With those small changes out of the way, you can now start GoToSocial with the following command: + +```shell +docker-compose up -d +``` + +After running this command, you should get an output like: + +```text +Creating network "gotosocial_gotosocial" with the default driver +Creating gotosocial ... done +``` + +If you want to follow the logs of GoToSocial, you can use: + +```bash +docker logs -f gotosocial +``` + +If everything is OK, you should see something similar to the following: + +```text +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 +``` + +## Create your first User + +Now that GoToSocial is running, you should create at least a user for yourself. How to do so is documented in our [Creating users](../user_creation.md) guide. + +### Done + +GoToSocial should now be running on your machine! To verify this, open your browser and go to `http://localhost:443`. You should see the GoToSocial landing page. Well done! + +## (Optional) Reverse Proxy + +If you want to run other webservers on port 443 or want to add an additional layer of security you might want to use a [reverse proxy](../reverse_proxy/index.md). We have guides available for a couple of popular open source options and will gladly take pull requests to add more. diff --git a/docs/getting_started/installation/index.md b/docs/getting_started/installation/index.md new file mode 100644 index 000000000..3457a69c6 --- /dev/null +++ b/docs/getting_started/installation/index.md @@ -0,0 +1,14 @@ +# Installation + +As we noted in [Releases](../releases.md), we publish official binary release as well as containers. We have a number of guides available on how to deploy your own GoToSocial instance this way. + +Before proceeding with your installation, please ensure you've read through the [Deployment considerations](../index.md) first and have a domain and server ready to go. + +Also take a minute to familiarise yourself with [how to configure](../../configuration/index.md) GoToSocial. + +## Guides + +For third-party releases we don't provide guides on how to use them. You need to refer to their own documentation instead. Our guides might still be useful to review in order to familiarise yourself with which configuration options you likely want to set and tweak. + +* [Bare metal](metal.md) +* [Container](container.md) diff --git a/docs/getting_started/installation/metal.md b/docs/getting_started/installation/metal.md new file mode 100644 index 000000000..3040dbbb8 --- /dev/null +++ b/docs/getting_started/installation/metal.md @@ -0,0 +1,123 @@ +# Bare metal + +This guide walks you through getting GoToSocial up and running on bare metal using the official binary releases. + +## Prepare VPS + +In a terminal on the VPS or your homeserver, make the directory that GoToSocial will run from, the directory it will use as storage, and the directory it will store LetsEncrypt certificates in: + +```bash +mkdir /gotosocial && mkdir /gotosocial/storage && mkdir /gotosocial/storage/certs +``` + +If you don't have root permissions on the machine, use something like `~/gotosocial` instead. + +## Download Release + +In a terminal on the VPS or your homeserver, cd into the base directory for GoToSocial you just created above: + +```bash +cd /gotosocial +``` + +Now, download the latest GoToSocial release archive corresponding to the operating system and architecture you're running on. + +(You can find the list of releases [right here](https://github.com/superseriousbusiness/gotosocial/releases), arranged with the newest release at the top.) + +For example, to download version 0.5.2 for running on 64-bit Linux: + +```bash +wget https://github.com/superseriousbusiness/gotosocial/releases/download/v0.5.2/gotosocial_0.5.2_linux_amd64.tar.gz +``` + +Then extract it: + +```bash +tar -xzf gotosocial_0.5.2_linux_amd64.tar.gz +``` + +This will put the `gotosocial` binary in your current directory, in addition to the `web` folder, which contains assets for the web frontend, and an `example` folder, which contains a sample configuration file. + +## Edit Configuration File + +Copy the configuration file from the example folder into your current directory: + +```bash +cp ./example/config.yaml . +``` + +Now open the file in your text editor of choice so that you can set some important configuration values. Change the following settings: + +- Set `host` to whatever hostname you're going to be running the server on (eg., `example.org`). +- Set `port` to `443`. +- Set `db-type` to `sqlite`. +- Set `db-address` to `sqlite.db`. +- Set `storage-local-base-path` to the storage directory you created above (eg., `/gotosocial/storage`). +- Set `letsencrypt-enabled` to `true`. +- Set `letsencrypt-cert-dir` to the certificate storage directory you created above (eg., `/gotosocial/storage/certs`). + +The above options assume you're using SQLite as your database. If you want to use Postgres instead, see [here](../../configuration/database.md) for the config options. + +## Run the Binary + +You can now run the binary. + +Start the GoToSocial server with the following command: + +```bash +./gotosocial --config-path ./config.yaml server start +``` + +The server should now start up and you should be able to access the splash page by navigating to your domain in the browser. Note that it might take up to a minute or so for your LetsEncrypt certificates to be created for the first time, so refresh a few times if necessary. + +Note that for this example we're assuming that we're allowed to run on port 443 (standard https port), and that nothing else is running on this port. + +## Create your user + +You can use the GoToSocial binary to also create and promote your user account. This is all documented in our [Creating users](../user_creation.md) guide. + +## Login + +You should now be able to log in to your instance using the email address and password of the account you just created. We recommend using [Semaphore](https://semaphore.social) or [Tusky](https://tusky.app) for this. + +## (Optional) Enable the systemd service + +If you don't like manually starting GoToSocial on every boot you might want to create a systemd service that does that for you. + +First stop your GoToSocial instance. + +Then create a new user and group for your GoToSocial installation: + +```bash +sudo useradd -r gotosocial +sudo groupadd gotosocial +sudo usermod -a -G gotosocial gotosocial +``` + +Then make them the owner of your GoToSocial installation since they will need to read and write in it: + +```bash +sudo chown -R gotosocial:gotosocial /gotosocial +``` + +You can find a `gotosocial.service` file in the `example` folder on [github](https://raw.githubusercontent.com/superseriousbusiness/gotosocial/main/example/gotosocial.service) or your installation. + +Copy it to `/etc/systemd/system/gotosocial.service`: + +```bash +sudo cp /gotosocial/example/gotosocial.service /etc/systemd/system/ +``` + +Then use `sudoedit /etc/systemd/system/gotosocial.service` to change the `ExecStart=` and `WorkingDirectory=` lines according to your installation. + +If you have been following this guide word for word the defaults should be fine. + +After you're done enable the service: + +```bash +sudo systemctl enable --now gotosocial.service +``` + +## (Optional) Reverse proxy + +If you want to run other webservers on port 443 or want to add an additional layer of security you might want to use a [reverse proxy](../reverse_proxy/index.md). We have guides available for a couple of popular open source options and will gladly take pull requests to add more. |