Add restart policy #24
+6
-2
@@ -9,7 +9,7 @@ reasoning behind these choices, see [DESIGN.md](DESIGN.md).
|
||||
|
||||
## Deploy on MikroTik (RouterOS)
|
||||
|
||||
Verified on RouterOS 7.21.2 (arm64, CRS418). Commands are grouped into
|
||||
Verified on RouterOS 7.23 (arm64, CRS418). Commands are grouped into
|
||||
copy-paste blocks, defaults should fit most configurations.
|
||||
|
||||
> Because the image has no built-in updater (the `clientupdate` feature is
|
||||
@@ -19,7 +19,9 @@ copy-paste blocks, defaults should fit most configurations.
|
||||
|
||||
### 0. Prerequisites
|
||||
|
||||
- RouterOS >7.13 with the **container** package installed.
|
||||
- RouterOS >= 7.23 with the **container** package installed
|
||||
(7.23 is needed for container `restart-policy`; the deploy itself works on
|
||||
>= 7.13 if you drop the restart options).
|
||||
- Container mode enabled ([documentation](https://manual.mikrotik.com/docs/System%20Information%20and%20Utilities/device-mode/#changing-mode-of-device-mode)):
|
||||
|
||||
```
|
||||
@@ -80,6 +82,8 @@ just that directory:
|
||||
mountlists=tailscale_state \
|
||||
logging=yes \
|
||||
start-on-boot=yes \
|
||||
restart-policy=on-failure \
|
||||
restart-interval=10s \
|
||||
name=tailscale
|
||||
```
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
# =============================================================================
|
||||
# Checks the Gitea registry for a new :stable image and, only if the published
|
||||
# image actually changed, recreates the container. Designed for RouterOS 7.x
|
||||
# (tested target: 7.21.2, arm64). Requires RouterOS >= 7.13 for the :deserialize
|
||||
# command used to parse the registry token JSON.
|
||||
# (tested target: 7.23, arm64). Requires RouterOS >= 7.23 for the container
|
||||
# restart-policy properties (and >= 7.13 for the :deserialize command used to
|
||||
# parse the registry token JSON).
|
||||
#
|
||||
# HOW IT DECIDES "something changed":
|
||||
# It fetches the manifest digest of the :stable tag from the registry and
|
||||
@@ -59,6 +60,12 @@
|
||||
:local cInterface "veth-tailscale"
|
||||
:local cLogging yes
|
||||
:local cStartOnBoot yes
|
||||
# Restart the container automatically if tailscaled crashes (tailscaled is
|
||||
# PID 1; if it dies the container stops). on-failure restarts only on abnormal
|
||||
# exit (a manual /container/stop stays stopped); 10s is a gentle backoff.
|
||||
# Requires RouterOS >= 7.23.
|
||||
:local cRestartPolicy "on-failure"
|
||||
:local cRestartInterval "10s"
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
:log info "$scriptName: checking for image updates"
|
||||
@@ -174,6 +181,8 @@
|
||||
mountlists=$cMountList \
|
||||
logging=$cLogging \
|
||||
start-on-boot=$cStartOnBoot \
|
||||
restart-policy=$cRestartPolicy \
|
||||
restart-interval=$cRestartInterval \
|
||||
name=$cName
|
||||
} do={
|
||||
:log error "$scriptName: container add failed: $e"
|
||||
|
||||
Reference in New Issue
Block a user