dokku / ci-docker-image

A Docker Image meant for use with CI/CD pipelines
MIT License
35 stars 24 forks source link

Deploy from image not working, results in: git:from-image: command not found #103

Closed rikvanderkemp closed 6 months ago

rikvanderkemp commented 6 months ago

Description of problem

How reproducible

Use deploy_docker_image to deploy an docker image from ghcr.io

Steps to Reproduce

  1. Create a workflow with the following step
  deploy-to-dokku:
    runs-on: ubuntu-latest
    needs: build-and-push-image
    steps:
      - name: Push to dokku
        uses: dokku/github-action@master
        with:
          git_remote_url: 'ssh://dokku@MY_IP_ADDRESS:22/my-app'
          ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
          deploy_docker_image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}

Actual Results

bash: line 1: git:from-image: command not found

Expected Results

deployed 🎉

Environment Information

dokku report MYAPP output

Details

``` -----> uname: Linux racknerd-5b1c8c 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux -----> memory: total used free shared buff/cache available Mem: 7937 2339 399 38 5198 5252 Swap: 2303 531 1772 -----> docker version: Client: Docker Engine - Community Version: 24.0.7 API version: 1.43 Go version: go1.20.10 Git commit: afdd53b Built: Thu Oct 26 09:07:41 2023 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 24.0.7 API version: 1.43 (minimum version 1.12) Go version: go1.20.10 Git commit: 311b9ff Built: Thu Oct 26 09:07:41 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.25 GitCommit: d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f runc: Version: 1.1.10 GitCommit: v1.1.10-0-g18a0cb0 docker-init: Version: 0.19.0 GitCommit: de40ad0 -----> docker daemon info: Client: Docker Engine - Community Version: 24.0.7 Context: default Debug Mode: true Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.11.2 Path: /usr/libexec/docker/cli-plugins/docker-buildx compose: Docker Compose (Docker Inc.) Version: v2.21.0 Path: /usr/libexec/docker/cli-plugins/docker-compose Server: Containers: 7 Running: 7 Paused: 0 Stopped: 0 Images: 17 Server Version: 24.0.7 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Using metacopy: false Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: systemd Cgroup Version: 2 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: io.containerd.runc.v2 runc Default Runtime: runc Init Binary: docker-init containerd version: d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f runc version: v1.1.10-0-g18a0cb0 init version: de40ad0 Security Options: apparmor seccomp Profile: builtin cgroupns Kernel Version: 5.15.0-89-generic Operating System: Ubuntu 22.04.3 LTS OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 7.751GiB Name: racknerd-5b1c8c ID: ********************************** Docker Root Dir: /var/lib/docker Debug Mode: false File Descriptors: 72 Goroutines: 66 System Time: 2024-03-03T22:20:25.628655117Z EventsListeners: 0 Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false -----> herokuish version: herokuish: v0.7.2 buildpacks: heroku-buildpack-multi v1.2.0 heroku-buildpack-ruby v259 heroku-buildpack-nodejs v224 heroku-buildpack-clojure v91 heroku-buildpack-python v237 heroku-buildpack-java v73 heroku-buildpack-gradle v39 heroku-buildpack-scala v96 heroku-buildpack-play v26 heroku-buildpack-php v239 heroku-buildpack-go v181 heroku-buildpack-nginx v24 buildpack-null v3 -----> dokku version: dokku version 0.32.3 -----> dokku-event-listener version: 0.15.0build+5268732 -----> dokku-update version: dokku-update 0.7.2 -----> docker-container-healthchecker version: 0.7.2 -----> docker-image-labeler version: 0.6.1build+c6e15a9 -----> git version: git version 2.34.1 -----> lambda-builder version: 0.5.0 -----> netrc version: 0.7.1build+677c033 -----> plugn version: plugn: 0.13.0build+fd5297a -----> sigil version: 0.10.1build+e443be0 -----> sshcommand version: sshcommand 0.17.1 -----> dokku plugins: 00_dokku-standard 0.32.3 enabled dokku core standard plugin 20_events 0.32.3 enabled dokku core events logging plugin app-json 0.32.3 enabled dokku core app-json plugin apps 0.32.3 enabled dokku core apps plugin builder 0.32.3 enabled dokku core builder plugin builder-dockerfile 0.32.3 enabled dokku core builder-dockerfile plugin builder-herokuish 0.32.3 enabled dokku core builder-herokuish plugin builder-lambda 0.32.3 enabled dokku core builder-lambda plugin builder-nixpacks 0.32.3 enabled dokku core builder-nixpacks plugin builder-null 0.32.3 enabled dokku core builder-null plugin builder-pack 0.32.3 enabled dokku core builder-pack plugin buildpacks 0.32.3 enabled dokku core buildpacks plugin caddy-vhosts 0.32.3 enabled dokku core caddy-vhosts plugin certs 0.32.3 enabled dokku core certificate management plugin checks 0.32.3 enabled dokku core checks plugin common 0.32.3 enabled dokku core common plugin config 0.32.3 enabled dokku core config plugin cron 0.32.3 enabled dokku core cron plugin docker-options 0.32.3 enabled dokku core docker-options plugin domains 0.32.3 enabled dokku core domains plugin elasticsearch 1.35.0 enabled dokku elasticsearch service plugin enter 0.32.3 enabled dokku core enter plugin git 0.32.3 enabled dokku core git plugin haproxy-vhosts 0.32.3 enabled dokku core haproxy-vhosts plugin letsencrypt 0.20.3 enabled Automated installation of let's encrypt TLS certificates logs 0.32.3 enabled dokku core logs plugin mongo 1.36.6 enabled dokku mongo service plugin network 0.32.3 enabled dokku core network plugin nginx-vhosts 0.32.3 enabled dokku core nginx-vhosts plugin openresty-vhosts 0.32.3 enabled dokku core openresty-vhosts plugin plugin 0.32.3 enabled dokku core plugin plugin ports 0.32.3 enabled dokku core ports plugin postgres 1.36.0 enabled dokku postgres service plugin proxy 0.32.3 enabled dokku core proxy plugin ps 0.32.3 enabled dokku core ps plugin redis 1.37.1 enabled dokku redis service plugin registry 0.32.3 enabled dokku core registry plugin repo 0.32.3 enabled dokku core repo plugin resource 0.32.3 enabled dokku core resource plugin run 0.32.3 enabled dokku core run plugin scheduler 0.32.3 enabled dokku core scheduler plugin scheduler-docker-local 0.32.3 enabled dokku core scheduler-docker-local plugin scheduler-null 0.32.3 enabled dokku core scheduler-null plugin shell 0.32.3 enabled dokku core shell plugin ssh-keys 0.32.3 enabled dokku core ssh-keys plugin storage 0.32.3 enabled dokku core storage plugin trace 0.32.3 enabled dokku core trace plugin traefik-vhosts 0.32.3 enabled dokku core traefik-vhosts plugin =====> my-admin app-json information App json computed selected: app.json App json global selected: app.json App json selected: =====> my-admin app information App created at: 1705004240 App deploy source: docker-image App deploy source metadata: ghcr.io/myapp/lungo-prod:latest App dir: /home/dokku/my-admin App locked: false =====> my-admin builder information Builder build dir: Builder computed build dir: Builder computed selected: Builder global build dir: Builder global selected: Builder selected: =====> my-admin builder-dockerfile information Builder dockerfile computed dockerfile path: Dockerfile Builder dockerfile global dockerfile path: Dockerfile Builder dockerfile dockerfile path: =====> my-admin builder-herokuish information Builder herokuish computed allowed: true Builder herokuish global allowed: true Builder herokuish allowed: =====> my-admin builder-lambda information Builder lambda computed lambdayml path: lambda.yml Builder lambda global lambdayml path: lambda.yml Builder lambda lambdayml path: =====> my-admin builder-nixpacks information Builder nixpacks computed nixpackstoml path: nixpacks.toml Builder nixpacks global nixpackstoml path: nixpacks.toml Builder nixpacks nixpackstoml path: Builder nixpacks computed no cache: false Builder nixpacks global no cache: false Builder nixpacks no cache: =====> my-admin builder-pack information Builder pack computed projecttoml path: project.toml Builder pack global projecttoml path: project.toml Builder pack projecttoml path: =====> my-admin buildpacks information Buildpacks computed stack: gliderlabs/herokuish:latest-22 Buildpacks global stack: Buildpacks list: Buildpacks stack: =====> my-admin caddy information Caddy image: lucaslorentz/caddy-docker-proxy:2.8 Caddy letsencrypt email: Caddy letsencrypt server: https://acme-v02.api.letsencrypt.org/directory Caddy log level: ERROR Caddy polling interval: 5s Caddy tls internal: false =====> my-admin ssl information Ssl dir: /home/dokku/my-admin/tls Ssl enabled: true Ssl hostnames: my-admin.upto11.nl lungo.myapp.com Ssl expires at: May 18 07:41:39 2024 GMT Ssl issuer: C = US, O = Let's Encrypt, CN = R3 Ssl starts at: Feb 18 07:41:40 2024 GMT Ssl subject: subject=CN = my-admin.upto11.nl Ssl verified: verified by a certificate authority =====> my-admin checks information Checks disabled list: none Checks skipped list: none Checks computed wait to retire: 60 Checks global wait to retire: 60 Checks wait to retire: =====> my-admin docker options information Docker options build: --link dokku.postgres.my-admin-pgsql:dokku-postgres-my-admin-pgsql Docker options deploy: --link dokku.postgres.my-admin-pgsql:dokku-postgres-my-admin-pgsql --restart=on-failure:10 -v /var/lib/dokku/data/storage/my-admin-uploads:/opt/app/public/uploads Docker options run: --link dokku.postgres.my-admin-pgsql:dokku-postgres-my-admin-pgsql -v /var/lib/dokku/data/storage/my-admin-uploads:/opt/app/public/uploads =====> my-admin domains information Domains app enabled: true Domains app vhosts: my-admin.upto11.nl lungo.myapp.com Domains global enabled: true Domains global vhosts: upto11.nl =====> my-admin git information Git deploy branch: main Git global deploy branch: master Git keep git dir: false Git rev env var: GIT_REV Git sha: f1961ce Git source image: ghcr.io/myapp/lungo-prod:latest Git last updated at: 1709499180 =====> my-admin haproxy information Haproxy image: byjg/easy-haproxy:4.3.0 Haproxy letsencrypt email: Haproxy letsencrypt server: https://acme-v02.api.letsencrypt.org/directory Haproxy log level: ERROR =====> my-admin letsencrypt information Letsencrypt active: true Letsencrypt autorenew: false Letsencrypt computed dns provider: Letsencrypt global dns provider: Letsencrypt dns provider: Letsencrypt computed email: ***@***.nl Letsencrypt global email: Letsencrypt email: ***@***.nl Letsencrypt expiration: 1716018099 Letsencrypt computed graceperiod: 2592000 Letsencrypt global graceperiod: Letsencrypt graceperiod: Letsencrypt computed lego docker args: Letsencrypt global lego docker args: Letsencrypt lego docker args: Letsencrypt computed server: https://acme-v02.api.letsencrypt.org/directory Letsencrypt global server: Letsencrypt server: =====> my-admin logs information Logs computed max size: 10m Logs global max size: 10m Logs global vector sink: Logs max size: Logs vector sink: =====> my-admin network information Network attach post create: Network attach post deploy: Network bind all interfaces: false Network computed attach post create: Network computed attach post deploy: Network computed bind all interfaces: false Network computed initial network: Network computed tld: Network global attach post create: Network global attach post deploy: Network global bind all interfaces: false Network global initial network: Network global tld: Network initial network: Network static web listener: Network tld: Network web listeners: 172.17.0.9:1337 =====> my-admin nginx information Nginx access log format: Nginx access log path: /var/log/nginx/my-admin-access.log Nginx bind address ipv4: Nginx bind address ipv6: :: Nginx client max body size: Nginx disable custom config: false Nginx error log path: /var/log/nginx/my-admin-error.log Nginx global hsts: true Nginx computed hsts: true Nginx hsts: Nginx hsts include subdomains: true Nginx hsts max age: 15724800 Nginx hsts preload: false Nginx computed nginx conf sigil path: nginx.conf.sigil Nginx global nginx conf sigil path: nginx.conf.sigil Nginx nginx conf sigil path: Nginx proxy buffer size: 4096 Nginx proxy buffering: on Nginx proxy buffers: 8 4096 Nginx proxy busy buffers size: 8192 Nginx proxy read timeout: 60s Nginx last visited at: 1709499395 Nginx x forwarded for value: $remote_addr Nginx x forwarded port value: $server_port Nginx x forwarded proto value: $scheme Nginx x forwarded ssl: =====> my-admin openresty information Openresty access log format: Openresty access log path: /var/log/nginx/my-admin-access.log Openresty bind address ipv4: Openresty bind address ipv6: :: Openresty client max body size: Openresty error log path: /var/log/nginx/my-admin-error.log Openresty global hsts: true Openresty computed hsts: true Openresty hsts: Openresty hsts include subdomains: true Openresty hsts max age: 15724800 Openresty hsts preload: false Openresty image: dokku/openresty-docker-proxy:0.6.0 Openresty letsencrypt email: Openresty letsencrypt server: https://acme-v02.api.letsencrypt.org/directory Openresty proxy buffer size: 4096 Openresty proxy buffering: on Openresty proxy buffers: 8 4096 Openresty proxy busy buffers size: 8192 Openresty proxy read timeout: 60s Openresty x forwarded for value: $remote_addr Openresty x forwarded port value: $server_port Openresty x forwarded proto value: $scheme Openresty x forwarded ssl: =====> my-admin ports information Ports map: http:80:1337 https:443:1337 Ports map detected: https:1337:1337 =====> my-admin proxy information Proxy enabled: true Proxy type: nginx =====> my-admin ps information Deployed: true Processes: 1 Ps can scale: true Ps computed procfile path: Procfile Ps global procfile path: Procfile Ps procfile path: Ps restart policy: on-failure:10 Restore: true Running: true Status web 1: running (CID: 97bc1cb4384) =====> my-admin registry information Registry computed image repo: myapp/lungo-prod Registry computed push on release: true Registry computed server: ghcr.io/ Registry global push on release: Registry global server: Registry image repo: myapp/lungo-prod Registry push on release: true Registry server: ghcr.io Registry tag version: =====> my-admin resource information =====> my-admin scheduler information Scheduler computed selected: docker-local Scheduler global selected: docker-local Scheduler selected: =====> my-admin scheduler-docker-local information Scheduler docker local disable chown: Scheduler docker local init process: true Scheduler docker local parallel schedule count: =====> my-admin storage information Storage build mounts: Storage deploy mounts: -v /var/lib/dokku/data/storage/my-admin-uploads:/opt/app/public/uploads Storage run mounts: -v /var/lib/dokku/data/storage/my-admin-uploads:/opt/app/public/uploads =====> my-admin traefik information Traefik api enabled: false Traefik api vhost: traefik.dokku.me Traefik basic auth password: Traefik basic auth username: Traefik dashboard enabled: false Traefik image: traefik:v2.10 Traefik letsencrypt email: Traefik letsencrypt server: https://acme-v02.api.letsencrypt.org/directory Traefik log level: ERROR Traefik priority: ```

How (deb/make) and where (AWS, VirtualBox, physical, etc.) was Dokku installed?:

Using the instructions on the website. Nothing fancy.

Additional information

My guess would be that the deploy action is invalid. If I look in https://github.com/dokku/ci-docker-image/blob/master/bin/dokku-deploy#L100 I see that the cli dokku isn't being called.

So, maybe I am missing somehting in my configuration, or, should the line read as follows?

if [ -n "$DEPLOY_DOCKER_IMAGE" ]; then
  log-info "Deploying image to Dokku Host"
  ssh "$ssh_remote" -- dokku git:from-image "$remote_app_name" "$DEPLOY_DOCKER_IMAGE" "$DEPLOY_USER_NAME" "$DEPLOY_USER_EMAIL"
else
  # OMITTED
fi
josegonzalez commented 6 months ago

Can you paste the contents of the following file from your server? It should only contain public keys and is therefore fine to paste as is.

/home/dokku/.ssh/authorized_keys

rikvanderkemp commented 6 months ago

Can you paste the contents of the following file from your server? It should only contain public keys and is therefore fine to paste as is.

/home/dokku/.ssh/authorized_keys

Sure:

command="FINGERPRINT=SHA256:jHj9xDySI7uBCM2T+eMfOPuEQHfULAooStr+fQ5fCoE NAME=\"admin\" `cat /home/dokku/.sshcommand` $SSH_ORIGINAL_COMMAND",no-agent-forwarding,no-user-rc,no-X11-forwarding,no-port-forwarding ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE1wsLVxhl28w4geftcdUZwvjGAHu6sGP3GGnDcpW2xp rik@mief.nl
command="FINGERPRINT=SHA256:O5+lHW8LXKYQuzvmXeDhKqKFBl3e2bcRGE7MUB7tM/4 NAME=\"michael\" `cat /home/dokku/.sshcommand` $SSH_ORIGINAL_COMMAND",no-agent-forwarding,no-user-rc,no-X11-forwarding,no-port-forwarding ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGDNTacMUFmrWSbbgAal+VpioBEBiNaxtxE2wTwQ/rQR github
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDmt1/ERqRJfMNyYBJFYtgXaboIhbY3GWIsMAgC/Pfxr7EZ1R0TZ7OylIVlU9eZOiuOTlNg6YiDC8UhhCOyur5FY16aw4BaVSfCsyEvEBhUyqQ4fVVjfXh6srMy6pdXtLw3NADLXss7c2m8XEgkHFXbu8IGUbY3vNnSLpIyBNrG6UudaDRXP4HXG4RFql8MUDTT+r0Q07C40EZJWxKYyFRGNJ3bMriqFvINFH0zgWkjn3DQ48GjmI/jW4uJxbfBy8kJ2dB89LS1dnHImjHxmS5DX3LiapFwV08bfzPxDpDkg+oXutIKnOmbEoUDg2VBiXoEpp2yB76sPD1iyAWd5xf0Rgno8PhvKbNfXDMBxcJUVU9iG2y8vGprY0VlclB0XpvJWiqEjaPRxYdyrHxQkeJ3LlDNYPY/1kd2dqX+k2L7OLcahtKNpXX4Vn373cxYCnzG2SJT8ZeRl9zPu7fThtpKywU0XfXJRXO2NAGUDDEBdH+lgVCSrU3IVWWYYFlc2JmHJvg6298RsS/CETcVDNcJ8eMPd72c6bNMCYCrVK4WScAQQCPM4zRtoS9P+/H9jNhq3hj8YV9D/QG1szOE31BVwikyUQL55eF16KRSfY0dtTf7mrJ/2kJjrKXOthb/0g5OshqXzhZbDLzMHMi4Tjo6HS0ayvAq2wjpdtvmj4rpPw== rik@mief.nl
=
josegonzalez commented 6 months ago

Those last two lines are bad entries (one is just an equals sign). Remove them. That file is meant to be managed by the ssh-keys plugin. Please see the user management docs on the dokku site for more details.

rikvanderkemp commented 6 months ago

Those last two lines are bad entries (one is just an equals sign). Remove them. That file is meant to be managed by the ssh-keys plugin. Please see the user management docs on the dokku site for more details.

Hero! I indeed messed up here. Thanks for your fast response and help.