Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(server): remove docker-compose and cleanup #1484

Merged
merged 41 commits into from
Jan 30, 2024
Merged

chore(server): remove docker-compose and cleanup #1484

merged 41 commits into from
Jan 30, 2024

Conversation

fortuna
Copy link
Collaborator

@fortuna fortuna commented Jan 27, 2024

In this PR:

  • I'm removing Docker Compose. It was a bit of work to figure out the commands, but now the test is more self-contained and it's one less dependency to install.
  • Added cache to the npm ci run on Docker build
  • Started using fully-qualified image names, so it's not Docker-centric.
  • Made the integration_test/test.sh runnable directly. Great for development or testing any image.
  • Stopped running a util container. It's not needed because it doesn't run a service.
  • Added STOPSIGNAL entries, so we don't need to specify on docker run
  • Added a missing dev dependency, minimist.

@fortuna fortuna requested a review from a team as a code owner January 27, 2024 00:07
@fortuna fortuna changed the title Replace Docker with Podman cleanup(server): Replace Docker with Podman for development Jan 27, 2024
@fortuna fortuna changed the title cleanup(server): Replace Docker with Podman for development chore(server): Replace Docker with Podman for development Jan 27, 2024
@fortuna fortuna changed the title chore(server): Replace Docker with Podman for development chore(server): replace Docker with Podman for development Jan 27, 2024
function setup() {
shutdown_containers

podman network create -d bridge "${NET_OPEN}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry slightly that we'll have to roll our own "docker compose" every time we need something like this w/ podman.

Is there any way we could at least surface this example for posterity? So future devs know how to do it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is standard Docker networking: https://docs.docker.com/network/
There's really nothing special about it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our standup today you mentioned it took you a while to figure out how to do this. We should document the methodology so people don't have to keep re-inventing what you already invented

podman rm -f -v "${SHADOWBOX_CONTAINER}" || true
podman rm -f -v "${CLIENT_CONTAINER}" || true
podman network rm -f "${NET_OPEN}" || true
podman network rm -f "${NET_BLOCKED}" || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I like to do for cleanups is add a consistent tag to all containers, images, and networks. Then you can remove everything by tag, e.g. docker network rm -f $(docker network ls -q --filter "label=org.getoutline.tag=${TAG}"). (I assume podman can do the same thing?) I wonder if that could help scale this? Just a thought.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea, but the integration test should be able to test the image without affecting the image building. So no labels. That could break an existing container, for instance.
However, we can probably use the names the same way. I already have the names with a prefix

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't realize we can set labels at run time. I thought it was build time only. We should consider that, but not for this PR.

@fortuna fortuna marked this pull request as draft January 29, 2024 20:26
@fortuna fortuna changed the title chore(server): replace Docker with Podman for development chore(server): remove docker-compose and cleanup Jan 29, 2024
@fortuna fortuna marked this pull request as ready for review January 29, 2024 23:51
@fortuna fortuna requested a review from sbruens January 29, 2024 23:51
@fortuna
Copy link
Collaborator Author

fortuna commented Jan 29, 2024

This is ready for review now. We're sticking to Docker, but not docker-compose

docker build --force-rm -t "${UTIL_IMAGE}" "$(dirname "$0")/util"
}

function shutdown_containers() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't just shutting down containers, it's also removing them. Maybe rename this function to reflect that or at least leave a comment for people less familiar with what docker rm -f does?

@fortuna fortuna merged commit 71e4b52 into master Jan 30, 2024
14 checks passed
@fortuna fortuna deleted the fortuna-fix branch January 30, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants