diff --git a/test/integration/docker-compose.yml b/test/integration/docker-compose.yml index 01b5152f..ae28e2f0 100644 --- a/test/integration/docker-compose.yml +++ b/test/integration/docker-compose.yml @@ -50,6 +50,13 @@ services: volumes: - shared:/shared + vm3: + privileged: true + build: + context: docker/vm + volumes: + - shared:/shared + load_balancer: build: context: docker/load_balancer diff --git a/test/integration/docker/deployer/Dockerfile b/test/integration/docker/deployer/Dockerfile index 2b49fcb0..de908e6a 100644 --- a/test/integration/docker/deployer/Dockerfile +++ b/test/integration/docker/deployer/Dockerfile @@ -1,6 +1,6 @@ FROM ruby:3.2 -WORKDIR /app +WORKDIR / ENV VERBOSE=true @@ -17,7 +17,7 @@ RUN echo \ RUN apt-get update --fix-missing && apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin COPY *.sh . -COPY app/ . +COPY app/ app/ RUN rm -rf /root/.ssh RUN ln -s /shared/ssh /root/.ssh @@ -25,7 +25,7 @@ RUN mkdir -p /etc/docker/certs.d/registry:4443 && ln -s /shared/certs/domain.crt RUN git config --global user.email "deployer@example.com" RUN git config --global user.name "Deployer" -RUN git init && echo ".env" >> .gitignore && git add . && git commit -am "Initial version" +RUN cd app && git init && echo ".env" >> .gitignore && git add . && git commit -am "Initial version" HEALTHCHECK --interval=1s CMD pgrep sleep diff --git a/test/integration/docker/deployer/update_app_rev.sh b/test/integration/docker/deployer/update_app_rev.sh index db7fd220..4214ffb2 100755 --- a/test/integration/docker/deployer/update_app_rev.sh +++ b/test/integration/docker/deployer/update_app_rev.sh @@ -1,3 +1,3 @@ #!/bin/bash -git commit -am 'Update rev' --amend +cd $1 && git commit -am 'Update rev' --amend diff --git a/test/integration/integration_test.rb b/test/integration/integration_test.rb index 251e9641..bd62c474 100644 --- a/test/integration/integration_test.rb +++ b/test/integration/integration_test.rb @@ -7,6 +7,7 @@ class IntegrationTest < ActiveSupport::TestCase docker_compose "up --build -d" wait_for_healthy setup_deployer + @app = "app" end teardown do @@ -34,8 +35,9 @@ class IntegrationTest < ActiveSupport::TestCase result end - def deployer_exec(*commands, **options) - docker_compose("exec deployer #{commands.join(" ")}", **options) + def deployer_exec(*commands, workdir: nil, **options) + workdir ||= "/#{@app}" + docker_compose("exec --workdir #{workdir} deployer #{commands.join(" ")}", **options) end def kamal(*commands, **options) @@ -72,7 +74,7 @@ class IntegrationTest < ActiveSupport::TestCase end def update_app_rev - deployer_exec "./update_app_rev.sh" + deployer_exec "./update_app_rev.sh #{@app}", workdir: "/" latest_app_version end @@ -115,7 +117,7 @@ class IntegrationTest < ActiveSupport::TestCase end def setup_deployer - deployer_exec("./setup.sh") unless $DEPLOYER_SETUP + deployer_exec("./setup.sh", workdir: "/") unless $DEPLOYER_SETUP $DEPLOYER_SETUP = true end