Skip to content

[Solution?] how to remote update the hawser agent? i do it like this #56

@zandadoum

Description

@zandadoum

Hello,

I use dockhand on my main host and the hawser agent on 10+ VMs each with their own docker (homelab, each project gets it's own VM)

The recurring problem I found, is that I had to manually SSH into each VM to update the hawser agent, as I didn't find a way to do it through the GUI easily.

If there is such solution in place, please tell me how to do it properly, as I didn't find such information

If there is no such solution in place, I'd like to share how I am doing it right now.

in first place, I installed the hawser agent in docker compose on each VM as I like compose:

services:
  hawser:
    container_name: hawser
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 2376:2376
    environment:
      - TOKEN=*mysecret*
    image: ghcr.io/finsys/hawser:latest
networks: {}

after a few days I realised that I would have to SSH into each VM to update this, because when I try to do it within the dockhand GUI, it would hang and not update at all, as it requires the agent to connect

as dockhand has a self update feature that basically runs a second compose temporarily to update itself, I thought I could to the same for hawser.
because I am not a coder myself, I asked chatgpt for a couple of commands and in the end this is what I came up with:

services:
  hawser-updater:
    image: docker:24-cli
    container_name: hawser-updater
    restart: "no"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /*your path to the compose*/hawser:/host/hawser:ro
    working_dir: /host/hawser
    entrypoint: >
      sh -c "
        echo 'Pulling Hawser image...';
        docker compose pull hawser;
        echo 'Restarting Hawser container...';
        docker compose up -d hawser;
        echo 'Updater done, exiting...';
      "

so what this compose does is simply run once, docker pull and restart hawser and then exit. all you have to do in dockhand is click the start button and wait a few seconds. possibly also refresh the screen with F5

anyways, this works for me, so I wanted to share it both here and on the dockhand git. if there's a proper/better way please let me know and I'll delete this.

thx.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions