This repository has been archived on 2021-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
hometown/README.md

88 lines
3.3 KiB
Markdown
Raw Permalink Normal View History

2021-05-27 19:20:18 +00:00
# Hometown
2021-05-07 11:34:21 +00:00
2021-05-27 19:20:18 +00:00
A supported fork of Mastodon that provides local posting and a wider range of content types.
2021-06-23 15:37:00 +00:00
This repository is a copy of [coop-cloud/mastodon](https://git.autonomic.zone/coop-cloud/mastodon) but with a fresh README and some Hometown specific configuration. It seems like a good idea to keep the deployment separate since the apps may diverge in their deployment or configuration instructions at some point despite best wishes to remain as mainline Mastodon as possible.
2021-05-07 11:34:21 +00:00
<!-- metadata -->
2021-05-27 19:20:18 +00:00
- **Category**:
- **Status**:
- **Image**: [`decentral1se/hometown`](https://hub.docker.com/r/decentral1se/hometown)
- **Healthcheck**:
- **Backups**:
- **Email**:
- **Tests**:
- **SSO**:
2021-05-28 10:56:17 +00:00
2021-05-07 11:34:21 +00:00
<!-- endmetadata -->
## Basic usage
1. Set up Docker Swarm and [`abra`]
2021-05-28 10:54:02 +00:00
1. Deploy [`coop-cloud/traefik`]
1. `abra app new mastodon`
2021-05-28 13:36:00 +00:00
1. Follow the [secrets setup docs](#secrets-setup)
1. `abra app YOURAPPDOMAIN config` - be sure to change `DOMAIN` to something that resolves to your Docker swarm box
2021-06-23 15:35:51 +00:00
1. `abra app YOURAPPDOMAIN deploy` to deploy the app
You'll need to run a `docker exec -it <streaming-service-id> /bin/bash` and do the following:
```
export OTP_SECRET=$(cat /run/secrets/otp_secret)
export SECRET_KEY_BASE=$(cat /run/secrets/secret_key_base)
export DB_PASS=$(cat /run/secrets/db_password)
bundle exec rake db:setup
```
Then, on your host (outside of the containers), you'll need to fix permissions for the volume (see [#2](https://git.autonomic.zone/coop-cloud/hometown/issues/2)):
```
chown -R 991:991 /var/lib/docker/volumes/<service-name>_app/_data
```
And finally, within any app container, create an admin account:
```
tootctl accounts create <username> --email <email> --confirmed --role admin
```
2021-05-07 11:34:21 +00:00
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
2021-05-28 10:54:02 +00:00
## Secrets setup
Because Mastodon expects secrets generated by specific tools, we don't support that in `abra` yet. However, you can run these commands yourself using the underlying Docker CLI. You can then load them in as secrets to the swarm using `abra` though and then they will be picked up on the deployment.
First, generate the `SECRET_KEY_BASE` and `OTP_SECRET` and store them in your local shell environment, you'll need them for subsequent commands.
```
$ SECRET_KEY_BASE=$(docker run --rm tootsuite/mastodon:v3.4.0 bundle exec rake secret)
$ OTP_SECRET=$(docker run --rm tootsuite/mastodon:v3.4.0 bundle exec rake secret)
2021-05-28 13:19:58 +00:00
$ abra app YOURAPPDOMAIN secret insert secret_key_base v1 $SECRET_KEY_BASE
$ abra app YOURAPPDOMAIN secret insert otp_secret v1 $OTP_SECRET
2021-05-28 10:54:02 +00:00
```
Then you need to generate the `VAPID_{PUBLIC/PRIVATE}_KEY` values using the `SECRET_KEY_BASE`/`OTP_SECRET`:
```
$ docker run \
-e SECRET_KEY_BASE=$SECRET_KEY_BASE \
-e OTP_SECRET=$OTP_SECRET \
--rm tootsuite/mastodon:v3.4.0 \
bundle exec rake mastodon:webpush:generate_vapid_key
```
Once you see the values generated, you can load the `VAPID_PUBLIC_KEY` into your `.env` file and `VAPID_PRIVATE_KEY` into a secret.
```
2021-05-28 13:19:58 +00:00
$ abra app YOURDOMAIN secret insert vapid_private_key v1 YOURVAPIDPRIVATEKEY
2021-05-28 10:54:02 +00:00
```
And finally, to end your whirlwind secrets loading adventure, get the `DB_PASS` and `SMTP_PASSWORD` loaded.
```
$ abra app YOURAPPDOMAIN secret generate db_password v1
2021-05-28 13:19:58 +00:00
$ abra app YOURDOMAIN secret insert smtp_password v1 YOURSMTPPASSWORD
2021-05-28 10:54:02 +00:00
```