I'm newbie in kamal.
It's really a great tool for deployment. Thanks to @dhh .But I have some difficulties deploying despite having read the documentation.
After configuring the deploy.yml file like this:
# Name of your application. Used to uniquely configure containers.service: soe# Name of the container image.image: noumedem/soe# Deploy to these servers.servers: web: hosts: - 51.68.124.156 labels: traefik.http.routers.soe.entrypoints: websecure traefik.http.routers.soe.rule: Host(`www.jeteste.site`) traefik.http.routers.soe.tls.certresolver: letsencrypt options: network: 'private'# Credentials for your image host.registry: # Specify the registry server, if you're not using Docker Hub # server: registry.digitalocean.com / ghcr.io / ... username: noumedem # 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: RUBY_YJIT_ENABLE: 1 RAILS_SERVE_STATIC_FILES: true POSTGRES_USER: "soe_app" POSTGRES_DB: "soe_production" POSTGRES_HOST: "soe_app-db" # With the pattern: <service_name>-<accessory_name> secret: - RAILS_MASTER_KEY - POSTGRES_PASSWORD# Use a different ssh user than rootssh: user: ubuntu# Configure builder setup.#builder:# args:# RUBY_VERSION: 3.3.0# secrets:# - GITHUB_TOKEN# remote:# arch: amd64# host: ssh://ubuntu@192.168.0.1# Use accessory services (secrets come from .env).accessories: db: image: postgres:16 host: 192.168.0.1 env: clear: POSTGRES_USER: "soe_app" POSTGRES_DB: "soe_production" # The database will be created automatically on first boot. secret: - POSTGRES_PASSWORD directories: - data:/var/lib/postgresql/data options: network: "private"# Configure custom arguments for Traefiktraefik: options: publish: - "443:443" volume: - "/letsencrypt/acme.json:/letsencrypt/acme.json" # To save the configuration file. args: entryPoints.web.address: ":80" entryPoints.websecure.address: ":443" entryPoints.web.http.redirections.entryPoint.to: websecure # We want to force https entryPoints.web.http.redirections.entryPoint.scheme: https entryPoints.web.http.redirections.entrypoint.permanent: true certificatesResolvers.letsencrypt.acme.email: "me@example.com" certificatesResolvers.letsencrypt.acme.storage: "/letsencrypt/acme.json" # Must match the path in `volume` certificatesResolvers.letsencrypt.acme.httpchallenge: true certificatesResolvers.letsencrypt.acme.httpchallenge.entrypoint: web # Must match the role in `servers`healthcheck: interval: 5s# Configure a custom healthcheck (default is /up on port 3000)# healthcheck:# path: /healthz# port: 4000# Bridge fingerprinted assets, like JS and CSS, between versions to avoid# hitting 404 on in-flight requests. Combines all files from new and old# version inside the asset_path.## If your app is using the Sprockets gem, ensure it sets `config.assets.manifest`.# See https://github.com/basecamp/kamal/issues/626 for details## asset_path: /rails/public/assets# Configure rolling deploys by setting a wait time between batches of restarts.# boot:# limit: 10 # Can also specify as a percentage of total hosts, such as "25%"# wait: 2# Configure the role used to determine the primary_host. This host takes# deploy locks, runs health checks during the deploy, and follow logs, etc.## Caution: there's no support for role renaming yet, so be careful to cleanup# the previous role on the deployed hosts.# primary_role: web# Controls if we abort when see a role with no hosts. Disabling this may be# useful for more complex deploy configurations.## allow_empty_roles: false
When I run kamal setup
, I get this errors: ERROR (Net::SSH::ConnectionTimeout): Exception while executing on host 192.168.0.1: Net::SSH::ConnectionTimeout
kamal setup -> ouput:
INFO [52cb1c24] Running /usr/bin/env mkdir -p .kamal on 51.68.124.156 INFO [52cb1c24] Finished in 0.935 seconds with exit status 0 (successful).Acquiring the deploy lock...Ensure Docker is installed... INFO [97718e48] Running docker -v on 51.68.124.156 INFO [a381a0cc] Running docker -v on 192.168.0.1 INFO [97718e48] Finished in 0.232 seconds with exit status 0 (successful). INFO [718f8a03] Running /usr/bin/env mkdir -p .kamal on 51.68.124.156 INFO [718f8a03] Finished in 0.101 seconds with exit status 0 (successful).Releasing the deploy lock... Finished all in 76.1 seconds ERROR (Net::SSH::ConnectionTimeout): Exception while executing on host 192.168.0.1: Net::SSH::ConnectionTimeout
Before running kamal setup in local, I did these steps in my VPS:
sudo apt updatesudo apt upgrade -ysudo apt install -y docker.io curl gitsudo usermod -a -G docker ubuntusudo docker network create --driver bridge privatesudo mkdir -p /letsencrypt && sudo touch /letsencrypt/acme.json && sudo chmod 600 /letsencrypt/acme.json
How can I solve this problem? Please help.