trashposs/docs/docker-compose-install.md

93 lines
3.4 KiB
Markdown
Raw Permalink Normal View History

2024-04-06 22:37:46 +02:00
# Installing TrashPoss with Docker
2023-08-13 17:58:41 +02:00
2023-08-15 22:35:22 +02:00
This guide is based on `docker compose`/Docker Compose v2, but `docker-compose`/Docker Compose v1 should work as well. Docker 20.10+ is required for building your own images because of BuildKit usage, and Docker 20.10 users need to [enable BuildKit first](https://docs.docker.com/build/buildkit/#getting-started), or [upgrade to latest Docker](https://docs.docker.com/engine/install/#server).
2023-08-13 17:58:41 +02:00
## Preparations
### Getting needed files
2023-11-08 15:59:52 +01:00
If you want to use the prebuilt images:
```sh
2024-04-06 22:37:46 +02:00
GIT_LFS_SKIP_SMUDGE=1 git clone https://iceshrimp.dev/Crimekillz/trashposs.git --depth=1
2023-11-08 15:59:52 +01:00
```
If you want to build your own images (make sure to install `git-lfs` and to run `git lfs install` before running the command):
2023-11-08 15:59:52 +01:00
```sh
2024-04-06 22:37:46 +02:00
git clone https://iceshrimp.dev/Crimekillz/trashposs.git
2023-11-08 15:59:52 +01:00
```
2023-08-13 17:58:41 +02:00
### docker-compose.yml
2024-04-06 22:37:46 +02:00
First, run `cp docs/examples/docker-compose.yml docker-compose.yml`, and edit `docker-compose.yml` if you want to build the image yourself or choose a [different tag](https://iceshrimp.dev/Crimekillz/-/packages/container/trashposs/versions)
2023-08-13 17:58:41 +02:00
### .config
Run `cp .config/docker_example.env .config/docker.env`, and edit `.config/docker.env` and fill it with the database credentials you want.
Run `cp .config/example-docker.yml .config/default.yml`, and edit `.config/default.yml`
- Replace example database credentials with the ones you entered in `.config/docker.env`
- Change other configuration
2024-04-06 22:37:46 +02:00
If you are running TrashPoss on a system with more than one CPU thread, you might want to set the `clusterLimit` config option to about half of your thread count, depending on your system configuration. Please note that each worker requires around 10 PostgreSQL connections, so be sure to set `max_connections` appropriately. To do this with docker-compose, add `args: ["-c", "max_connections=n"]` to the `db:` section of `docker-compose.yml`, with `n` being `(10 * no_workers) + 10`.
2023-08-13 17:58:41 +02:00
## Installation and first start
Choose a method, whether you chose to build the image yourself or not.
2024-04-06 22:37:46 +02:00
Note: Ctrl-C will shut down TrashPoss gracefully.
2023-08-13 17:58:41 +02:00
### Pulling the image
```sh
docker compose pull
docker compose up
```
### Building the image
Depending on your machine specs, this can take well over 30 minutes
2023-08-15 22:35:22 +02:00
2023-08-13 17:58:41 +02:00
```sh
docker compose build
docker compose up
```
2024-04-06 22:37:46 +02:00
## Starting TrashPoss automatically
2023-08-13 17:58:41 +02:00
2024-04-06 22:37:46 +02:00
Run `docker compose up -d` and TrashPoss will start automatically on boot.
2023-08-13 17:58:41 +02:00
2024-04-06 22:37:46 +02:00
## Updating TrashPoss
2023-08-13 17:58:41 +02:00
### Pulling the image
```sh
docker compose pull
docker compose down
docker compose up -d
```
### Building the image
```sh
## Run git stash commands only if you have uncommitted changes
git stash
git pull
git stash pop
docker compose build
docker compose down
docker compose up -d
```
## Post-install
See [post-install](post-install.md).
## Troubleshooting
```WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition.```
If you see a warning like this, you have to enable overcommit on your host machine (outside docker, since /proc is read-only for redis).
Solution
```
echo "vm.overcommit_memory = 1" | sudo tee /etc/sysctl.d/trashposs-memory-overcommit.conf should be set, to enable Memory overcommit on reboot, change will apply after reboot or see the line below how to activate it temporary without reboot
sysctl "vm.overcommit_memory=1" enables Memory overcommit on-the-fly, you can then start TrashPoss with "docker-compose up -d"
```