Can't access Rails app in production after Kamal deploy

476 views Asked by At

I'm using Kamal (old MRSK) with Rails and I'm able to run kamal deploy with success.

However, I'm having issues accessing the website in production after deployment: when I access the website URL www.theaddress.com (or the IP of the set up NodeBalancer at 139.144.161.121), I get "This site can't be reached" in the browser.

How to solve the issue? What to check?

This is the deploy.yml:

service: my-app

image: myusername/my-app

servers:
  web:
    hosts:
      - 172.104.234.79
    labels:
      traefik.http.routers.domain.rule: "Host(`www.theaddress.com`) || Host(`theaddress.com`)"
      traefik.http.routers.domain.entrypoints: websecure
      traefik.http.routers.domain.tls.certresolver: letsencrypt
    options:
      "add-host": host.docker.internal:host-gateway
    cmd: "./bin/rails server"

# Credentials for your image host.
registry:
  # Specify the registry server, if you're not using Docker Hub
  # server: registry.digitalocean.com / ghcr.io / ...
  username: myusername
  # Always use an access token rather than real password when possible.
  password:
    - KAMAL_REGISTRY_PASSWORD

# Inject ENV variables into containers (secrets come from .env).
# Remember to run `kamal env push` after making changes!
env:
  clear:
    DB_HOST: 172.105.246.172
  secret:
    - RAILS_MASTER_KEY
    - MYSQL_ROOT_PASSWORD

# Use accessory services (secrets come from .env).
accessories:
  db:
    image: mysql:8.0
    host: 172.105.246.172
    port: 3306
    env:
      clear:
        MYSQL_ROOT_HOST: '%'
      secret:
        - MYSQL_ROOT_PASSWORD
    files:
      # - config/mysql/production.cnf:/etc/mysql/my.cnf
      - db/production.sql:/docker-entrypoint-initdb.d/setup.sql
    directories:
      - data:/var/lib/mysql
    command: 'mysqld'

# Configure custom arguments for Traefik
traefik:
  options:
    publish:
      - "443:443"
    volume:
      - "/letsencrypt/acme.json:/letsencrypt/acme.json"
  args:
    entryPoints.web.address: ":80"
    entryPoints.websecure.address: ":443"
    entryPoints.web.http.redirections.entryPoint.to: websecure
    entryPoints.web.http.redirections.entryPoint.scheme: https
    entryPoints.web.http.redirections.entrypoint.permanent: true
    certificatesResolvers.letsencrypt.acme.email: "[email protected]"
    certificatesResolvers.letsencrypt.acme.storage: "/letsencrypt/acme.json"
    certificatesResolvers.letsencrypt.acme.httpchallenge: true
    certificatesResolvers.letsencrypt.acme.httpchallenge.entrypoint: web
    # accesslog: true
    # accesslog.format: json

volumes:
  - "/storage:/rails/storage"

This is the deployment logs:

Mac:my-app MyUser$ kamal deploy
  INFO [53a9c61c] Running /usr/bin/env mkdir -p .kamal on 172.104.234.79
  INFO [53a9c61c] Finished in 1.014 seconds with exit status 0 (successful).
Acquiring the deploy lock...
Log into image registry...
  INFO [184dab6a] Running docker login -u [REDACTED] -p [REDACTED] as MyUser@localhost
  INFO [184dab6a] Finished in 1.489 seconds with exit status 0 (successful).
  INFO [5ee83758] Running docker login -u [REDACTED] -p [REDACTED] on 172.104.234.79
  INFO [5ee83758] Finished in 1.080 seconds with exit status 0 (successful).
Build and push app image...
  INFO [8a5f900e] Running docker --version && docker buildx version as MyUser@localhost
  INFO [8a5f900e] Finished in 0.165 seconds with exit status 0 (successful).
  INFO [5eabb8dd] Running docker buildx build --push --platform linux/amd64,linux/arm64 --builder kamal-my-app-multiarch -t myusername/my-app:14ef25d341406b48b05911ddeb90aaf374f7fc90 -t myusername/my-app:latest --label service="my-app" --file Dockerfile . as MyUser@localhost
 DEBUG [5eabb8dd] Command: docker buildx build --push --platform linux/amd64,linux/arm64 --builder kamal-my-app-multiarch -t myusername/my-app:14ef25d341406b48b05911ddeb90aaf374f7fc90 -t myusername/my-app:latest --label service="my-app" --file Dockerfile .
 DEBUG [5eabb8dd]   #0 building with "kamal-my-app-multiarch" instance using docker-container driver
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #1 [internal] load build definition from Dockerfile
 DEBUG [5eabb8dd]   #1 DONE 0.0s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #1 [internal] load build definition from Dockerfile
 DEBUG [5eabb8dd]   #1 transferring dockerfile: 2.66kB done
 DEBUG [5eabb8dd]   #1 DONE 0.0s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #2 [auth] docker/dockerfile:pull token for registry-1.docker.io
 DEBUG [5eabb8dd]   #2 DONE 0.0s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #3 resolve image config for docker.io/docker/dockerfile:1
 DEBUG [5eabb8dd]   #3 DONE 1.0s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #4 docker-image://docker.io/docker/dockerfile:1@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021
 DEBUG [5eabb8dd]   #4 resolve docker.io/docker/dockerfile:1@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021 done
 DEBUG [5eabb8dd]   #4 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #5 [auth] library/ruby:pull token for registry-1.docker.io
 DEBUG [5eabb8dd]   #5 DONE 0.0s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #6 [linux/arm64 internal] load metadata for docker.io/library/ruby:3.2.2-slim
 DEBUG [5eabb8dd]   #6 DONE 1.2s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #7 [linux/amd64 internal] load metadata for docker.io/library/ruby:3.2.2-slim
 DEBUG [5eabb8dd]   #7 DONE 1.2s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #8 [internal] load .dockerignore
 DEBUG [5eabb8dd]   #8 transferring context: 782B done
 DEBUG [5eabb8dd]   #8 DONE 0.0s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #9 [linux/arm64 base 1/5] FROM docker.io/library/ruby:3.2.2-slim@sha256:96a9448e3831916d0cfff20a1283d1266558cea4ee3b9969f63733b254ee8f6b
 DEBUG [5eabb8dd]   #9 resolve docker.io/library/ruby:3.2.2-slim@sha256:96a9448e3831916d0cfff20a1283d1266558cea4ee3b9969f63733b254ee8f6b 0.0s done
 DEBUG [5eabb8dd]   #9 DONE 0.0s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #10 [linux/amd64 base 1/5] FROM docker.io/library/ruby:3.2.2-slim@sha256:96a9448e3831916d0cfff20a1283d1266558cea4ee3b9969f63733b254ee8f6b
 DEBUG [5eabb8dd]   #10 resolve docker.io/library/ruby:3.2.2-slim@sha256:96a9448e3831916d0cfff20a1283d1266558cea4ee3b9969f63733b254ee8f6b 0.0s done
 DEBUG [5eabb8dd]   #10 DONE 0.0s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #11 [internal] load build context
 DEBUG [5eabb8dd]   #11 transferring context: 368.06kB 0.2s done
 DEBUG [5eabb8dd]   #11 DONE 0.2s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #12 [linux/arm64 build 5/6] RUN bundle exec bootsnap precompile app/ lib/
 DEBUG [5eabb8dd]   #12 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #13 [linux/arm64 base 4/5] RUN apt-get update -qq &&     apt-get install --no-install-recommends -y curl &&     rm -rf /var/lib/apt/lists /var/cache/apt/archives
 DEBUG [5eabb8dd]   #13 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #14 [linux/arm64 build 2/6] COPY --link Gemfile Gemfile.lock ./
 DEBUG [5eabb8dd]   #14 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #15 [linux/arm64 stage-2 1/4] RUN apt-get update -qq &&     apt-get install --no-install-recommends -y curl default-mysql-client imagemagick libvips &&     rm -rf /var/lib/apt/lists /var/cache/apt/archives
 DEBUG [5eabb8dd]   #15 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #16 [linux/arm64 stage-2 3/4] COPY --from=build /rails /rails
 DEBUG [5eabb8dd]   #16 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #17 [linux/arm64 build 6/6] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
 DEBUG [5eabb8dd]   #17 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #18 [linux/arm64 build 3/6] RUN bundle install &&     bundle exec bootsnap precompile --gemfile &&     rm -rf ~/.bundle/ "/usr/local/bundle"/ruby/*/cache "/usr/local/bundle"/ruby/*/bundler/gems/*/.git
 DEBUG [5eabb8dd]   #18 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #19 [linux/arm64 base 3/5] RUN gem update --system --no-document &&     gem install -N bundler
 DEBUG [5eabb8dd]   #19 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #20 [linux/arm64 base 2/5] WORKDIR /rails
 DEBUG [5eabb8dd]   #20 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #21 [linux/arm64 build 1/6] RUN apt-get update -qq &&     apt-get install --no-install-recommends -y build-essential default-libmysqlclient-dev git libvips
 DEBUG [5eabb8dd]   #21 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #22 [linux/arm64 build 4/6] COPY --link . .
 DEBUG [5eabb8dd]   #22 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #23 [linux/arm64 stage-2 2/4] COPY --from=build /usr/local/bundle /usr/local/bundle
 DEBUG [5eabb8dd]   #23 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #24 [linux/arm64 base 5/5] RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ &&     /tmp/node-build-master/bin/node-build "16.19.1" /usr/local/node &&     rm -rf /tmp/node-build-master
 DEBUG [5eabb8dd]   #24 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #25 [linux/arm64 stage-2 4/4] RUN groupadd --system --gid 1000 rails &&     useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash &&     chown -R 1000:1000 db log storage tmp
 DEBUG [5eabb8dd]   #25 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #26 [linux/amd64 build 3/6] RUN bundle install &&     bundle exec bootsnap precompile --gemfile &&     rm -rf ~/.bundle/ "/usr/local/bundle"/ruby/*/cache "/usr/local/bundle"/ruby/*/bundler/gems/*/.git
 DEBUG [5eabb8dd]   #26 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #27 [linux/amd64 stage-2 1/4] RUN apt-get update -qq &&     apt-get install --no-install-recommends -y curl default-mysql-client imagemagick libvips &&     rm -rf /var/lib/apt/lists /var/cache/apt/archives
 DEBUG [5eabb8dd]   #27 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #28 [linux/amd64 build 1/6] RUN apt-get update -qq &&     apt-get install --no-install-recommends -y build-essential default-libmysqlclient-dev git libvips
 DEBUG [5eabb8dd]   #28 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #29 [linux/amd64 build 4/6] COPY --link . .
 DEBUG [5eabb8dd]   #29 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #30 [linux/amd64 stage-2 2/4] COPY --from=build /usr/local/bundle /usr/local/bundle
 DEBUG [5eabb8dd]   #30 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #31 [linux/amd64 base 2/5] WORKDIR /rails
 DEBUG [5eabb8dd]   #31 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #32 [linux/amd64 base 4/5] RUN apt-get update -qq &&     apt-get install --no-install-recommends -y curl &&     rm -rf /var/lib/apt/lists /var/cache/apt/archives
 DEBUG [5eabb8dd]   #32 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #33 [linux/amd64 base 3/5] RUN gem update --system --no-document &&     gem install -N bundler
 DEBUG [5eabb8dd]   #33 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #34 [linux/amd64 base 5/5] RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ &&     /tmp/node-build-master/bin/node-build "16.19.1" /usr/local/node &&     rm -rf /tmp/node-build-master
 DEBUG [5eabb8dd]   #34 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #35 [linux/amd64 build 5/6] RUN bundle exec bootsnap precompile app/ lib/
 DEBUG [5eabb8dd]   #35 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #36 [linux/amd64 stage-2 3/4] COPY --from=build /rails /rails
 DEBUG [5eabb8dd]   #36 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #37 [linux/amd64 build 6/6] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
 DEBUG [5eabb8dd]   #37 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #38 [linux/amd64 build 2/6] COPY --link Gemfile Gemfile.lock ./
 DEBUG [5eabb8dd]   #38 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #39 [linux/amd64 stage-2 4/4] RUN groupadd --system --gid 1000 rails &&     useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash &&     chown -R 1000:1000 db log storage tmp
 DEBUG [5eabb8dd]   #39 CACHED
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #40 exporting to image
 DEBUG [5eabb8dd]   #40 exporting layers done
 DEBUG [5eabb8dd]   #40 exporting manifest sha256:1d69c2bb5b4f1293b4921d7b14e65831d1bc76cc79ac8cb7199e136a5646724d done
 DEBUG [5eabb8dd]   #40 exporting config sha256:bbcc7b99c47fda160ac584fa28612e05cad004b48bb13305b7670a54637dd870 done
 DEBUG [5eabb8dd]   #40 exporting attestation manifest sha256:3b5eb2f3905f0ae37058165202d78fc1f61eafea87f015957513c6949f1490e6 done
 DEBUG [5eabb8dd]   #40 exporting manifest sha256:5e137dbcce070ead929bd932299d11356bf1edbef2c2ac2c8e3b3f7d51b9e7ec done
 DEBUG [5eabb8dd]   #40 exporting config sha256:042a2461aa1509f0108c19de3fb8faeb6b593332bc06a256a76862fa3b1656a6 done
 DEBUG [5eabb8dd]   #40 exporting attestation manifest sha256:f6380a15792a601c4e109722038d085299bf8021e55b09a04ad3ecf90637301a done
 DEBUG [5eabb8dd]   #40 exporting manifest list sha256:48dd67afb9c520946ab1831b3cdb8c43ef145bc561795d2f8f1db236922f2263
 DEBUG [5eabb8dd]   #40 ...
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #41 [auth] myusername/my-app:pull,push token for registry-1.docker.io
 DEBUG [5eabb8dd]   #41 DONE 0.0s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   #40 exporting to image
 DEBUG [5eabb8dd]   #40 exporting manifest list sha256:48dd67afb9c520946ab1831b3cdb8c43ef145bc561795d2f8f1db236922f2263 done
 DEBUG [5eabb8dd]   #40 pushing layers
 DEBUG [5eabb8dd]   #40 pushing layers 3.0s done
 DEBUG [5eabb8dd]   #40 pushing manifest for docker.io/myusername/my-app:14ef25d341406b48b05911ddeb90aaf374f7fc90@sha256:48dd67afb9c520946ab1831b3cdb8c43ef145bc561795d2f8f1db236922f2263
 DEBUG [5eabb8dd]   #40 pushing manifest for docker.io/myusername/my-app:14ef25d341406b48b05911ddeb90aaf374f7fc90@sha256:48dd67afb9c520946ab1831b3cdb8c43ef145bc561795d2f8f1db236922f2263 2.3s done
 DEBUG [5eabb8dd]   #40 pushing layers 1.8s done
 DEBUG [5eabb8dd]   #40 pushing manifest for docker.io/myusername/my-app:latest@sha256:48dd67afb9c520946ab1831b3cdb8c43ef145bc561795d2f8f1db236922f2263
 DEBUG [5eabb8dd]   #40 pushing manifest for docker.io/myusername/my-app:latest@sha256:48dd67afb9c520946ab1831b3cdb8c43ef145bc561795d2f8f1db236922f2263 1.3s done
 DEBUG [5eabb8dd]   #40 DONE 8.4s
 DEBUG [5eabb8dd]   
 DEBUG [5eabb8dd]   View build details: docker-desktop://dashboard/build/kamal-my-app-multiarch/kamal-my-app-multiarch0/t8qe2yzq6o9xzt3co3q153rgb
  INFO [5eabb8dd] Finished in 11.154 seconds with exit status 0 (successful).
  INFO [5a2d3c5e] Running docker image rm --force myusername/my-app:14ef25d341406b48b05911ddeb90aaf374f7fc90 on 172.104.234.79
  INFO [5a2d3c5e] Finished in 3.140 seconds with exit status 0 (successful).
  INFO [e168f3fc] Running docker pull myusername/my-app:14ef25d341406b48b05911ddeb90aaf374f7fc90 on 172.104.234.79
  INFO [e168f3fc] Finished in 38.731 seconds with exit status 0 (successful).
  INFO [b1584e2a] Running docker inspect -f '{{ .Config.Labels.service }}' myusername/my-app:14ef25d341406b48b05911ddeb90aaf374f7fc90 | grep -x my-app || (echo "Image myusername/my-app:14ef25d341406b48b05911ddeb90aaf374f7fc90 is missing the `service` label" && exit 1) on 172.104.234.79
  INFO [b1584e2a] Finished in 0.284 seconds with exit status 0 (successful).
Ensure Traefik is running...
  INFO [274367b8] Running docker login -u [REDACTED] -p [REDACTED] on 172.104.234.79
  INFO [274367b8] Finished in 1.338 seconds with exit status 0 (successful).
  INFO [38885fe7] Running docker container start traefik || docker run --name traefik --detach --restart unless-stopped --publish 80:80 --volume /var/run/docker.sock:/var/run/docker.sock --env-file .kamal/env/traefik/traefik.env --log-opt max-size="10m" --label traefik.http.routers.catchall.entryPoints="http" --label traefik.http.routers.catchall.rule="PathPrefix(\`/\`)" --label traefik.http.routers.catchall.service="unavailable" --label traefik.http.routers.catchall.priority="1" --label traefik.http.services.unavailable.loadbalancer.server.port="0" --publish "443:443" --volume "/letsencrypt/acme.json:/letsencrypt/acme.json" traefik:v2.9 --providers.docker --log.level="DEBUG" --entryPoints.web.address=":80" --entryPoints.websecure.address=":443" --entryPoints.web.http.redirections.entryPoint.to="websecure" --entryPoints.web.http.redirections.entryPoint.scheme="https" --entryPoints.web.http.redirections.entrypoint.permanent --certificatesResolvers.letsencrypt.acme.email="[email protected]" --certificatesResolvers.letsencrypt.acme.storage="/letsencrypt/acme.json" --certificatesResolvers.letsencrypt.acme.httpchallenge --certificatesResolvers.letsencrypt.acme.httpchallenge.entrypoint="web" on 172.104.234.79
  INFO [38885fe7] Finished in 0.276 seconds with exit status 0 (successful).
Ensure app can pass healthcheck...
  INFO [f688f569] Running docker run --detach --name healthcheck-my-app-14ef25d341406b48b05911ddeb90aaf374f7fc90 --publish 3999:3000 --label service=healthcheck-my-app -e KAMAL_CONTAINER_NAME="healthcheck-my-app" --env-file .kamal/env/roles/my-app-web.env --health-cmd "curl -f http://localhost:3000/up || exit 1" --health-interval "1s" --volume /storage:/rails/storage --add-host "host.docker.internal:host-gateway" myusername/my-app:14ef25d341406b48b05911ddeb90aaf374f7fc90 ./bin/rails server on 172.104.234.79
  INFO [f688f569] Finished in 1.214 seconds with exit status 0 (successful).
  INFO [ce71d1e9] Running docker container ls --all --filter name=^healthcheck-my-app-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [ce71d1e9] Finished in 0.332 seconds with exit status 0 (successful).
  INFO container not ready (starting), retrying in 1s (attempt 1/7)...
  INFO [f7f5ee86] Running docker container ls --all --filter name=^healthcheck-my-app-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [f7f5ee86] Finished in 0.243 seconds with exit status 0 (successful).
  INFO container not ready (starting), retrying in 2s (attempt 2/7)...
  INFO [16473e92] Running docker container ls --all --filter name=^healthcheck-my-app-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [16473e92] Finished in 0.309 seconds with exit status 0 (successful).
  INFO container not ready (starting), retrying in 3s (attempt 3/7)...
  INFO [e307e898] Running docker container ls --all --filter name=^healthcheck-my-app-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [e307e898] Finished in 0.272 seconds with exit status 0 (successful).
  INFO container not ready (unhealthy), retrying in 4s (attempt 4/7)...
  INFO [b8e26cf8] Running docker container ls --all --filter name=^healthcheck-my-app-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [b8e26cf8] Finished in 0.245 seconds with exit status 0 (successful).
  INFO container not ready (unhealthy), retrying in 5s (attempt 5/7)...
  INFO [71c8ccd7] Running docker container ls --all --filter name=^healthcheck-my-app-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [71c8ccd7] Finished in 0.242 seconds with exit status 0 (successful).
  INFO container not ready (unhealthy), retrying in 6s (attempt 6/7)...
  INFO [578edb76] Running docker container ls --all --filter name=^healthcheck-my-app-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [578edb76] Finished in 0.193 seconds with exit status 0 (successful).
  INFO Container is healthy!
  INFO [ae4cb242] Running docker container ls --all --filter name=^healthcheck-my-app-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker stop on 172.104.234.79
  INFO [ae4cb242] Finished in 0.607 seconds with exit status 0 (successful).
  INFO [e4f32e2d] Running docker container ls --all --filter name=^healthcheck-my-app-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker container rm on 172.104.234.79
  INFO [e4f32e2d] Finished in 0.417 seconds with exit status 0 (successful).
Detect stale containers...
  INFO [dfd984d8] Running docker ps --filter label=service=my-app --filter label=role=web --format "{{.Names}}" | while read line; do echo ${line#my-app-web-}; done on 172.104.234.79
  INFO [dfd984d8] Finished in 0.216 seconds with exit status 0 (successful).
Start container with version 14ef25d341406b48b05911ddeb90aaf374f7fc90 using a 7s readiness delay (or reboot if already running)...
  INFO [97569318] Running docker tag myusername/my-app:14ef25d341406b48b05911ddeb90aaf374f7fc90 myusername/my-app:latest on 172.104.234.79
  INFO [97569318] Finished in 0.216 seconds with exit status 0 (successful).
  INFO [92a3826c] Running docker container ls --all --filter name=^my-app-web-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet on 172.104.234.79
  INFO [92a3826c] Finished in 0.210 seconds with exit status 0 (successful).
  INFO [dbc51130] Running docker ps --filter label=service=my-app --filter label=role=web --filter status=running --filter status=restarting --latest --format "{{.Names}}" | while read line; do echo ${line#my-app-web-}; done on 172.104.234.79
  INFO [dbc51130] Finished in 0.215 seconds with exit status 0 (successful).
  INFO [949466e0] Running /usr/bin/env mkdir -p .kamal/cords/my-app-web-40814293ac0aac3709d68c7d70fbe265 ; touch .kamal/cords/my-app-web-40814293ac0aac3709d68c7d70fbe265/cord on 172.104.234.79
  INFO [949466e0] Finished in 0.181 seconds with exit status 0 (successful).
  INFO [94988e3a] Running docker run --detach --restart unless-stopped --name my-app-web-14ef25d341406b48b05911ddeb90aaf374f7fc90 --hostname 172.104.234.79-a386542f4b38 -e KAMAL_CONTAINER_NAME="my-app-web-14ef25d341406b48b05911ddeb90aaf374f7fc90" -e KAMAL_VERSION="14ef25d341406b48b05911ddeb90aaf374f7fc90" --env-file .kamal/env/roles/my-app-web.env --health-cmd "(curl -f http://localhost:3000/up || exit 1) && (stat /tmp/kamal-cord/cord > /dev/null || exit 1)" --health-interval "1s" --volume $(pwd)/.kamal/cords/my-app-web-40814293ac0aac3709d68c7d70fbe265:/tmp/kamal-cord --log-opt max-size="10m" --volume /storage:/rails/storage --label service="my-app" --label role="web" --label traefik.http.services.my-app-web.loadbalancer.server.scheme="http" --label traefik.http.routers.my-app-web.rule="PathPrefix(\`/\`)" --label traefik.http.routers.my-app-web.priority="2" --label traefik.http.middlewares.my-app-web-retry.retry.attempts="5" --label traefik.http.middlewares.my-app-web-retry.retry.initialinterval="500ms" --label traefik.http.routers.my-app-web.middlewares="my-app-web-retry@docker" --label traefik.http.routers.domain.rule="Host(\`themy.com\`)" --label traefik.http.routers.domain.entrypoints="websecure" --label traefik.http.routers.domain.tls.certresolver="letsencrypt" --add-host "host.docker.internal:host-gateway" myusername/my-app:14ef25d341406b48b05911ddeb90aaf374f7fc90 ./bin/rails server on 172.104.234.79
  INFO [94988e3a] Finished in 0.713 seconds with exit status 0 (successful).
  INFO [29666cce] Running docker container ls --all --filter name=^my-app-web-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [29666cce] Finished in 0.350 seconds with exit status 0 (successful).
  INFO container not ready (starting), retrying in 1s (attempt 1/7)...
  INFO [8a5f4743] Running docker container ls --all --filter name=^my-app-web-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [8a5f4743] Finished in 0.242 seconds with exit status 0 (successful).
  INFO container not ready (starting), retrying in 2s (attempt 2/7)...
  INFO [215cb1c4] Running docker container ls --all --filter name=^my-app-web-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [215cb1c4] Finished in 0.290 seconds with exit status 0 (successful).
  INFO container not ready (unhealthy), retrying in 3s (attempt 3/7)...
  INFO [cdcb2c17] Running docker container ls --all --filter name=^my-app-web-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [cdcb2c17] Finished in 0.273 seconds with exit status 0 (successful).
  INFO container not ready (unhealthy), retrying in 4s (attempt 4/7)...
  INFO [94b6e11e] Running docker container ls --all --filter name=^my-app-web-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [94b6e11e] Finished in 0.286 seconds with exit status 0 (successful).
  INFO container not ready (unhealthy), retrying in 5s (attempt 5/7)...
  INFO [e0c735ca] Running docker container ls --all --filter name=^my-app-web-14ef25d341406b48b05911ddeb90aaf374f7fc90$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' on 172.104.234.79
  INFO [e0c735ca] Finished in 0.250 seconds with exit status 0 (successful).
  INFO Container is healthy!
Prune old containers and images...
  INFO [51e81670] Running docker ps -q -a --filter label=service=my-app --filter status=created --filter status=exited --filter status=dead | tail -n +6 | while read container_id; do docker rm $container_id; done on 172.104.234.79
  INFO [51e81670] Finished in 0.259 seconds with exit status 0 (successful).
  INFO [8a14540d] Running docker container prune --force --filter label=service=healthcheck-my-app on 172.104.234.79
  INFO [8a14540d] Finished in 0.244 seconds with exit status 0 (successful).
  INFO [0f1fe558] Running docker image prune --force --filter label=service=my-app on 172.104.234.79
  INFO [0f1fe558] Finished in 0.244 seconds with exit status 0 (successful).
  INFO [289eab55] Running docker image ls --filter label=service=my-app --format '{{.ID}} {{.Repository}}:{{.Tag}}' | grep -v -w "$(docker container ls -a --format '{{.Image}}\|' --filter label=service=my-app | tr -d '\n')myusername/my-app:latest\|myusername/my-app:<none>" | while read image tag; do docker rmi $tag; done on 172.104.234.79
  INFO [289eab55] Finished in 0.348 seconds with exit status 0 (successful).
Releasing the deploy lock...
  Finished all in 109.8 seconds

More info:

$ kamal app exec -i bash
Get most recent version available as an image...
Launching interactive command with version latest via SSH from new container on 172.104.234.79...
rails@cbffec8f3246:/rails$ bin/rails server
=> Booting Puma
=> Rails 7.1.2 application starting in production 
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 6.4.0 (ruby 3.2.2-p53) ("The Eagle of Durango")
*  Min threads: 5
*  Max threads: 5
*  Environment: production
*          PID: 8
* Listening on http://0.0.0.0:3000
$ kamal app exec 'bin/rails about'
Get most recent version available as an image...
Launching command with version latest from new container...
  INFO [1817bbb8] Running docker run --rm --env-file .kamal/env/roles/my-app-web.env --volume /storage:/rails/storage --add-host "host.docker.internal:host-gateway" myusername/my-app:latest bin/rails about on 172.104.234.79
  INFO [1817bbb8] Finished in 11.727 seconds with exit status 0 (successful).
App Host: 172.104.234.79
About your application's environment
Rails version             7.1.2
Ruby version              ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
RubyGems version          3.5.1
Rack version              3.0.8
JavaScript Runtime        Node.js (V8)
Middleware                ActionDispatch::AssumeSSL, Rack::Sendfile, ActionDispatch::Executor, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::Callbacks, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, ActionDispatch::PermissionsPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper, Rack::LocaleMemorable, Warden::Manager, Rack::Attack
Application root          /rails
Environment               production
Database adapter          mysql2
Database schema version   20231213030434
0

There are 0 answers