Mender Server start at boot

Hello,
I’m trying to autostart the Mender production server at boot, in order to run everything unattended.
Editing the common.yml line from

restart: on-failure

to

restart: unless-stopped

causes the system to boot with deployments container in perpetual restarting status.
Web UI becomes unresponsive and crashes.
Logs shows dial tcp to address:9000 failing with Connection refused

Giving a

./run stop
./run up -d

fixes it.

Any clues?

I had a similar problem and in my case I found that docker was launching mender before all required systemd services were up. In the end i configured docker to not start mender containers on boot and added my own mender systemd service to ensure the required system services were up before launching mender-server. See below for systemd service I created. Obviously your setup will be different so change the necessary values to suit

[Unit]
Description=Mender docker embedded image upgrade services
Requires=docker.service
After=docker.service systemd-user-sessions.service
After=network-online.target network.target

[Service]
Type=simple
TimeoutStopSec=300
User=mender
WorkingDirectory=/home/mender/applications/IwMenderServer/production
ExecStart=/home/mender/applications/IwMenderServer/production/run up

[Install]
WantedBy=multi-user.target

2 Likes

Thanks for your detailed solution!
Where did you tweak docker to stop loading some containers on boot?
I can’t find any related config line…

I think i changed the restart policy on each of the mender containers from “always” to “on-failure”

docker update --restart=on-failure my-container