fablabbcn / smartcitizen-api

The Smart Citizen Engine
https://developer.smartcitizen.me
GNU Affero General Public License v3.0
10 stars 4 forks source link

Docker compose upgrade #235

Closed oscgonfer closed 7 months ago

oscgonfer commented 1 year ago

Current version of docker-compose is on 3.3, which is not needed as we are not using swarm. We should move to the unified version, supporting memory limitations per container.

As well, as of June 2023, the docker-compose will migrate to V2 (see here) so it would be worth checking.

oscgonfer commented 1 year ago

Adding to this, on the staging machine, we are already running the following versions:

$ docker --version
Docker version 20.10.12, build 20.10.12-0ubuntu2~20.04.1
$ docker-compose --version
Docker Compose version v2.14.0

With the following addition to the app service:

    restart: always
    deploy:
      resources:
        limits:
          memory: 2gb

Which successfully limits the memory usage of the app container to 2GiB as seen in the docker stats. This avoids the oom_killer to kick in when an issue happens.

imagen