Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Feature Enhancement】Quickly update the dokemon-agent version on servers #27

Open
aaro-n opened this issue Jan 14, 2024 · 1 comment

Comments

@aaro-n
Copy link

aaro-n commented Jan 14, 2024

Issue

When the dokemon server version is updated, the corresponding dokemon-agent version on VPS is not automatically updated. Manual updating of dokemon-agent is cumbersome, especially when dealing with a large number of VPS.

Result

The dokemon server can now update the dokemon-agent version on managed VPS with a single click.

Practice

  1. Deploy dokemon-agent on the respective VPS using docker-compose.yml. The docker-compose.yml content is as follows:
version: '3.3'

services:
  dokemon-agent:
    image: productiveops/dokemon-agent:latest
    container_name: dokemon-agent
    restart: always
    environment:
      - SERVER_URL=https://xxx.xxx.xxx
      - TOKEN=112222222
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

Run docker-compose up -d to run in the background. On the dokemon server, you can see that the corresponding VPS is connected.

  1. Add the corresponding VPS's dokemon-agent to the dokemon server. The dokemon server Definition configuration is as follows:
version: '3.3'
services:
  dokemon-agent-zhu:
    image: productiveops/dokemon-agent:latest
    container_name: dokemon-agent-zhu
    restart: always
    environment:
      - SERVER_URL=https://xxx.xxx.xxx
      - TOKEN=11111111
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

Now you can deploy it like a regular Docker image. After running, you can use docker-compose down to shut down the containers from step 1.

  1. Create a backup Definition configuration on the dokemon server, as follows:
version: '3.3'
services:
  dokemon-agent-fu:
    image: productiveops/dokemon-agent:latest
    container_name: dokemon-agent-fu
    restart: always
    environment:
      - SERVER_URL=https://xxx.xxx.xxx
      - TOKEN=11111111
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

Just create it but do not run it.

  1. Update the dokemon-agent on VPS.
    4.1 Update the dokemon-agent image for the corresponding VPS on the dokemon server.
    4.2 Run the backup Definition configuration from step 3 and observe the logs to check if the running version is the latest dokemon-agent.
    4.3 Stop and remove the containers from step 2. At this point, the VPS is running the latest version of dokemon-agent (from step 3).
    4.4 Re-run step 2. The containers created should now run the latest version of dokemon-agent. Stop the containers from step 3 to complete the update of dokemon-agent on VPS.

Other

It would be beneficial to selectively update dokemon-agent on specific VPS instances. It would be ideal to have an environment variable to determine which Definition configuration the VPS is running (identifying the containers from steps 2 and 3).

@aaro-n
Copy link
Author

aaro-n commented Jan 14, 2024

Translated by GPT-3.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant