gbv / coli-conc-server

Home folder, setup, and configuration for the server hosting public coli-conc software.
0 stars 1 forks source link

Prevent issues with duplicate service names and orphaned containers #12

Open stefandesu opened 1 week ago

stefandesu commented 1 week ago

There have been issues in the past when either an existing container was renamed, or a new service was added accidentally with the same name as an existing container.

In the former case, the container with the previous name will continue to run and cause issues with the proxy.

In the latter case, there are now two containers running with the same name, also causing proxy and other issues. And after fixing this (= renaming the new container), we will have the former case, where the previous container is still running.

I would like to implement two fixes:

This should prevent most issues of having to manually fiddle with Docker commands.

stefandesu commented 9 hours ago

Orphaned containers are now removed on start/restart.

Currently, it will still allow duplicate service names to exist, but 1) I added a check script in ./src/check.ts which checks for this specifically, and 2) this check script is now run in GitHub Actions and will fail if there are duplicates. (Ideally, you'd check this before committing though.)

I will leave this issue open because further improvements would be good.