misskey-admin-scripts-n-tips/README.md

150 lines
5.2 KiB
Markdown
Raw Normal View History

2021-12-27 17:59:36 +00:00
# misskey-admin-scripts-n-tips
2021-12-28 13:16:25 +00:00
A collection of scripts and tips to make a Misskey admin's life a little bit easyer.
2021-12-27 18:20:49 +00:00
2021-12-28 13:16:25 +00:00
It is a complement to the [official documentation](https://misskey-hub.net/en/docs/install/docker.html).
2021-12-27 18:26:55 +00:00
2021-12-28 13:16:25 +00:00
Abstract: a VPS with arm64 processor, Docker, a Misskey instance, what could save you some time ?
2021-12-27 18:20:49 +00:00
2021-12-28 13:17:46 +00:00
---
2021-12-28 13:16:25 +00:00
---
2021-12-27 18:26:55 +00:00
# Tips list:
## Separate code and data
2021-12-27 18:40:01 +00:00
The default misskey docker install guide will place misskey code and your instance data in the same directory. Is something goes wrong on a later time, you may accidentally trash your datas (docker volumes mounted for the postgres database, redis cache...).
Separate the misskey code (git clone...) from you container's volumes, something like this should do:
```
/usr/local/misskey/code
/usr/local/misskey/data
```
You will need a custom yaml file for docker-compose, but it's worth it (see sample yaml file).
Manage your misskey instance containers with docker-compose and the right path for code and datas:
```
docker-compose --project-directory=/usr/local/misskey/data -f /usr/local/misskey/data/<your custom docker-compose>.yml
```
2021-12-28 13:16:25 +00:00
## Quickly adjust misskey defaults settings
This particular setting in your instance configuration yaml in the `.config/default.yml` file will raises an error when federating with some (secured) mastodon instances, it's not trivial to find out, activate it to avoid such errors:
```
signToActivityPubGet: true
```
2022-01-06 21:24:16 +00:00
## Set a password to postgresql and redis databases
### Postgresql
The default Misskey configuration files provies all you need to set a user and password for your postgresql container.
Set the exact same values in Misskey's config file `default.yml` and the environment files loaded with the postgresql container `docker.env`
The `.config/default.yml` file should contains:
```
# ┌──────────────────────────┐
#───┘ PostgreSQL configuration └────────────────────────────────
db:
#loclahost
host: db
port: 5432
# Database name
db: misskey
# Auth
user: your_username_goes_here
pass: your_super_password_goes_here
(...)
```
The `.config/docker.env` file should contains:
```
# db settings
POSTGRES_PASSWORD=your_username_goes_here
POSTGRES_USER=your_super_password_goes_here-user
(...)
```
### Redis
Pay attention to the `command:` and `volumes` lines of the redis chapter in the yaml template `miskey-arm64.yml`.
They are added here to help the redis container to load its configuration file (with a required password inside), it will match the reddis password in Misskey's configuration file `default.yml`.
The `.config/default.yml` file should contains:
```
# ┌─────────────────────┐
#───┘ Redis configuration └─────────────────────────────────────
redis:
#localhost
host: redis
port: 6379
pass: your_redis_super_password_goes_here
(...)
```
The `.config/redis.conf` file should contains:
```
requirepass your_redis_super_password_goes_here
```
2022-01-02 12:07:14 +00:00
## Fill your global timeline with relays
Bootstraping a new instance, solo or small sized, is a real pain. You will see only content from people you follow. A solution to fill your TL is to register your instance to relays, that will repeat content from others instances to your TL.
Here is a list of popular relays:
```
https://relay.intahnet.co.uk/inbox
https://relay.pettingzoo.co/inbox
https://relay.blob.cat/inbox
https://relay.fedi.agency/inbox
https://relay.homunyan.com/inbox
```
2021-12-28 13:16:25 +00:00
## Arm64 specific
Deploying your misskey instance on arm64 using docker is pretty straightforward, you will need to use some generic flavor of docker images instead of specific/pined version from the original docker-compose.yml file (see the exemple yaml file in this repository).
2021-12-28 13:17:46 +00:00
---
2021-12-28 13:16:25 +00:00
---
# Scripts list:
2022-01-01 21:13:49 +00:00
## start_misskey.sh stop_misskey.sh
In a small VPS, or a limited computer like the rapsberry, or just because systemd, you may want to start and stop misskey with simple scripts like this.
2021-12-28 13:44:47 +00:00
For automatic start on boot, you may add this to your crontab: `@reboot /usr/local/bin/start_misskey.sh 1>>/var/log/syslog 2>&1`
2022-01-01 21:13:49 +00:00
## check_update_misskey_git.sh
This script tries to determine if an update is needed, without pulling all source code from Misskey's github depot.
Return 1 if an update is detected.
## update_misskey.sh
Handles the grunt work for a git update, and containers rebuild.
It takes care of code base backup, you really should take care of database (and maybe data files) backup before upgrading. To this day Misskey updates have not always been a smooth road.
It may automatically restart your instance to apply the update.
2021-12-28 13:16:25 +00:00
## backup_postgres.sh
A daily backup for your docker postgresql database, run it daily
It will cycle with the day of week (1..7)
Add it to your crontab, when your instances has its lowest activity, ex:
`0 5 * * * /usr/local/bin/backup_postgres.sh`
## cleanup_docker.sh
Prune all orphaned images, and stopped containers
## get_container_id.sh
Get container ID from name (used in other scripts)
2021-12-28 13:17:46 +00:00
---
2021-12-28 13:16:25 +00:00
---
2021-12-27 18:40:01 +00:00
# Ressources list:
## misskey-arm64.yml:
A docker-compose yaml file, for an arm64 (raspberry pi, VPS arm instances)