Verified Commit 607127d2 authored by Jakob Moser's avatar Jakob Moser
Browse files

Incorporate documentation from updater

parent 61c5411a
Loading
Loading
Loading
Loading
+38 −2
Changes for README.md: 38 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -6,14 +6,50 @@ A service for managing services (mostly those which are dockerized) on the Fachs

Replaces [updater](https://gitlab.cl.uni-heidelberg.de/fachschaft/updater) and the restart script from [watchbot](https://gitlab.cl.uni-heidelberg.de/fachschaft/watchbot).

## Restart all services
## Prerequisites

* Git (to clone the repository)
* Python (to run the script)
* Docker
* Docker Compose

To set up, run:

```bash
sudo git clone git@gitlab.cl.uni-heidelberg.de:fachschaft/meta.git /coli/meta
```

## Configuration

Currently, there is not much to be configured. If you ever need to change the base dir, you can change it at the top of `meta.py`

```python
BASE_DIR = Path("/coli")
```

## Usage

### Restart all services

```bash
sudo ./meta.py restart
```

## Update all services
### Update all services

```bash
sudo ./meta.py update
```

When executed, the script iterates over all directories in the base dir `/coli` and does the following:

1. If the directory contains a `.git` folder, execute: `git pull`
2. If the directory has a docker compose file (as indicated by `docker compose config`), execute: `docker compose pull` and `docker compose build --pull`
3. If at least one of the services defined in the said docker compose file is running, execute `docker compose up -d`

**Note:** "Updating" Docker containers is done by only running `docker compose pull`, so you need a dynamic version number in the compose files of your services (e.g. `latest`). If you hardcode the version (e.g. `2.4.1`), the updater script will not do anything exept for trying to pull that exact version (in our example case, `2.4.1`) again.

## Further reading

1. [How to update existing images with docker-compose? - Stack Overflow](https://stackoverflow.com/questions/49316462/how-to-update-existing-images-with-docker-compose)
2. [Scheduling a Docker Compose image auto-update in linux - Techroads](https://techroads.org/scheduling-a-docker-compose-image-auto-update-in-linux/)