Fix(agent): Improve tunnel preservation during agent upgrade when using tunnel. Housekeeping of shellhub-agent files in own directory#5943
Conversation
fbab19e to
a7beeba
Compare
a7beeba to
1e42d5b
Compare
1e42d5b to
50f40b7
Compare
otavio
left a comment
There was a problem hiding this comment.
The biggest problem I foresee here is migrating the field-deployed agents.
So even though I agree with the idea of this change, we need to consider how we will migrate the existing agents to work with this new approach or provide a backward-compatible way for them to keep working.
How do you foresee solving this issue?
|
With all the testing. I've stumbled upon this myself. The only persistent remaining file is just Two methods for transition:
@otavio someone should be able to replicate my findings for confirmation. EDIT: |
|
@otavio You are correct that users using the tunnel to upgrade their agent will have their tunnel ceremoniously terminated when migrating from the runc binary to go-native binary. I tried sending the shell install script to background and including using nohup to ignore sighup. However still no luck as the child process executing the agent install did not appear to initiate. This observation was the same for an standalone agent upgrade made through the tunnel for the following situations
With all tunnels terminated when users used shellhub tunnel to upgrade the agent |
|
Found a work around, can someone review please and test the containerised installation/upgrade. Problem: Running the installation under systemd-run worked, but once again was not verbose, and increased complexity in managing the existing service once finished. Solution: Changes: |
ad7c9d8 to
0d222f4
Compare
88ffb2d to
0d222f4
Compare
Create directory if doesn't exist.
0d222f4 to
0d6ec33
Compare
@otavio I noticed that the migration from non native shellhub-agent to the go-native shellhub-agent triggers the same issue of a new pending device join request due to the change in location of shellhub.key from I have provided a migration path for users who don't wish to deal with just removing old device and re-accepting the new device above. By moving the shellhub-agent service restart to end of installation, this allows users to upgrade the agent over a shellhub tunnel as the tunnel is not terminated when the service is stopped at the start of the installation process. |
agent installer: avoid service disruption during upgrade over SSH tunnel - Remove pre-install service disable step - Enable service without starting it immediately - Restart service only after install completes Allows upgrades to run over an active SSH tunnel and ensures the tunnel is re-established after the service restarts with the updated binary.
0d6ec33 to
35b4a99
Compare
What kind of change does this PR introduce?
Description:
/etc/shellhub-agent//etc/shellhub.keyand/etc/shellhub-agent.envor/opt/shellhub/shellhub.keyto/etc/shellhub-agent/shellhub.keyprior to performing installation/upgrade/etc/shellhub-agentMigration Guide *Optional*
The following guide also applies to migration from
runc-shellhub-agenttonative go-shellhub-agentThe following steps is only needed if want to retain same device unique id in shellhub (no pending request). If migration steps is not performed. A new pending request for the device will need to be accepted.
/etc/shellhub-agent/directoryshellhub.keyfrom/opt/shellhub-agent/shelhlub.keyor/etc/shellhub.keyto/etc/shellhub-agent/shellhub.key/opt/shellhub-agent/and/etc/shellhub.keyand/etc/shellhub-agent.env