Adds a simple integration test to ensure that `mrsk deploy` works. Everything required is spun up with docker compose: - shared: a container that contains an ssh key and a self signed cert to be shared between the images - deployer: the image we will deploy from - registry: a docker registry - two vm images to deploy into - load_balancer: an nginx load balancer to use between our images The other images are in privileged mode so that we can run docker-in-docker. We need to run docker inside the images - mapping in the docker socket doesn't work because both VMs would share the host daemon. The docker registry requires a self signed cert as you cannot use basic auth over HTTP except on localhost. It runs on port 4443 rather than 443 because docker refused to accept that "registry" is a docker host and tries to push images to docker.io/registry. "registry:4443" works fine. The shared container contains the ssh keys for the deployer and vms, and the self signed cert for the registry. When the shared container boots, it copies them into a shared volume. The other deployer and vm images are built with soft links from the shared volume to the require locations. Their boot scripts wait for the files to be copied in before continuing. The root mrsk folder is mapped into the deployer container. On boot it builds the gem and installs it. Right now there's just a single test. We confirm that the load balancer is returning a 502, run `mrsk deploy` and then confirm it returns 200.
15 lines
417 B
Docker
15 lines
417 B
Docker
FROM ubuntu:22.10
|
|
|
|
WORKDIR /work
|
|
|
|
RUN apt-get update && apt-get -y install openssh-client openssl
|
|
|
|
RUN mkdir ssh && \
|
|
ssh-keygen -t rsa -f ssh/id_rsa -N ""
|
|
|
|
COPY registry-dns.conf .
|
|
|
|
RUN mkdir certs && openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key -x509 -days 365 -out certs/domain.crt -subj '/CN=registry' -extensions EXT -config registry-dns.conf
|
|
|
|
CMD ["bash", "-c", "cp -r * /shared"]
|