Added upgrade.rsc script
Updated README
This commit is contained in:
Frank Edwards 2022-12-13 10:10:42 +10:00
parent 82dd9d1165
commit 67a1c8cc61
2 changed files with 84 additions and 0 deletions

View file

@ -120,6 +120,7 @@ The container exposes a SSH server for management purposes using root credential
## Upgrading
### Manual
To upgrade, first stop and remove the container.
```
@ -131,6 +132,40 @@ Create a new container as per Step 6. The tailscale.sh script detects if the tai
In the Tailscale console, check the router is authenticated and enable the subnet routes.
### Via Script
The script **upgrade.rsc** automates the upgrade process. To use the script, edit the *hostname* variable to match your container
and import the script - note the script assumes the container repository is being used.
```
/system script add name=upgrade source=[ /file get upgrade.rsc contents];
```
Run the script:
```
/system script
run [find name="upgrade"];
Stopping the container...
Waiting for the container to stop...
Waiting for the container to stop...
Waiting for the container to stop...
Stopped.
Removing the container...
Waiting for the container to be removed...
Removed.
Adding the container...
Waiting for the container to be added...
Waiting for the container to be added...
Waiting for the container to be added...
Waiting for the container to be added...
Waiting for the container to be added...
Waiting for the container to be added...
Added.
Starting the container.
```
Note the script will continue to run if you are connecting over the tailnet. When completed, check the router is authenticated and enable the subnet routes in the Tailscale console.
## Contributing
We welcome suggestions and feedback from people interested in integrating Tailscale on the RouterOS platform. Please send a PR or create an issue if you're having any problems.

49
upgrade.rsc Normal file
View file

@ -0,0 +1,49 @@
# Container identifier
:global hostname "mikrotik-west-1";
/container
:global id [find where hostname=$hostname];
:global rootdir [get $id root-dir];
:global dns [get $id dns];
:global logging [get $id logging];
:global status [get $id status];
# Stop the container
stop $id
:put "Stopping the container...";
:while ($status != "stopped") do={
:put "Waiting for the container to stop...";
:delay 5;
:set status [get $id status];
}
:put "Stopped.";
# Remove the container
remove $id
:put "Removing the container...";
:while ($status = "stopped") do={
:put "Waiting for the container to be removed...";
:delay 5;
:set status [get $id status];
}
:put "Removed.";
# Add the container
:delay 5;
:put "Adding the container...";
add remote-image=fluent-networks/tailscale-mikrotik:latest \
interface=veth1 envlist=tailscale root-dir=$rootdir \
start-on-boot=yes hostname=$hostname dns=$dns logging=$logging
:do {
:set status [get [find where hostname=$hostname] status];
:if ($status != "stopped") do={
:put "Waiting for the container to be added...";
:delay 5;
}
} while ($status != "stopped")
:put "Added."
# Start the container
:put "Starting the container.";
:set id [find where hostname=$hostname];
start $id