qpixel icon indicating copy to clipboard operation
qpixel copied to clipboard

Improvements for Docker setup

Open Oaphi opened this issue 1 year ago • 0 comments

Closes #1398

This PR is an overhaul of our Docker setup to make it more flexible and resilient. It includes:

  • change of container restart policy to on-failure:3 (meaning 3 consequent failures cause containers to exit). Our current policy of always sends containers in a restart loop if there is a fatal error, making it hard to debug and resolve issues;
  • removed obsolete version field from docker-compose (just getting rid of an annoying warning);
  • removed mention of sleep command from Docker docs as there is none (probably legacy?);
  • added Dockerfile.dev for setting up Docker specifically for local development purposes;
  • when built with Dockerfile.dev, the uwsgi container no longer automatically starts Rails when run;
  • made Dockerfile configurable via .env (automatically created by local-setup.sh from compose-env).

Rationale for no longer auto-starting Rails when building with Dockerfile.dev:

  • allows for live debugging in case there are issues that cause hard failures (currently, the container exits);
  • prevents restart loops in case of hard failures (partially mitigated already by the restart policy change);
  • the additional step (connecting to the container & running a single command) is fully documented in README.md.

Rationale for making Dockerfile used for the uwsgi container configurable:

  • allows use of custom Docker build configurations as one sees fit as long as they set the CLIENT_DOCKERFILE environment variable;
  • required to facilitate the use of Dockerfile.dev for development setups without the need to hard-code the changes;
  • is backwards-compatible due to the default value of compose-env set to docker/Dockerfile;

Oaphi avatar Oct 12 '24 06:10 Oaphi