GroundWork recommends having the GroundWork Monitor application start on system reboot or power on. This allows you to ensure that monitoring automatically starts after power failures or crashes that require a reboot of the host that runs the GroundWork Monitor containers. Doing so entails adding a unit file to restart the system with docker-compose.
Using this method is necessary due to the fact that GroundWork containers have specific timing dependencies, which are handled in the docker-compose.yaml file. While Docker experts may point out that it is possible to use Docker's own daemon to restart containers, we have found that doing so is not as reliable as using the system control scripts.
Add the gw8.service file to /etc/systemd/system
Log in as a privileged user (with sudo rights) to your GroundWork server.
If you are not using the user you used to install GroundWork 8, then become that user, (e.g., if you installed as user gwos):
sudo su - gwosCODE
Check where the docker-compose binary is by typing:
This will give you a path to the binary of docker-compose, for example:
which docker-compose /usr/local/bin/docker-composeCODE
Type exit to become the user with sudo access if necessary.
If docker-compose is not at /usr/bin/docker-compose, then add a symlink to that location, for example:
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-composeCODE
Edit the /etc/systemd/system/gw8.service file:
This file may or may not exist, depending on whether you have previously installed GroundWork Monitor.
Insert the following content:
# # GW8 systemd service unit file. # # Configure WorkingDirectory and User/Group below and place into # /etc/systemd/system directory. WorkingDirectory should be set # to the GW8 installation directory (where docker-compose.yml # has been set up). User must be a member of the docker group for # permission to access the docker daemon and have access to the # GW8 installation directory. # # To enable: sudo systemctl enable gw8 # To start: sudo systemctl start gw8 # Show status: sudo systemctl status gw8 # To stop: sudo systemctl stop gw8 # To disable: sudo systemctl disable gw8 # To reconfigure: sudo systemctl daemon-reload [Unit] Description=GW8 docker compose service Requires=docker.service After=docker.service [Service] # Daemon service type Type=oneshot RemainAfterExit=yes # Configure to match GW8 installation WorkingDirectory= User= Group= # Prune docker system ExecStartPre=/usr/bin/docker system prune -f # Compose up ExecStart=/usr/bin/docker-compose up -d # Compose down ExecStop=/usr/bin/docker-compose down [Install] WantedBy=multi-user.targetCODE
Edit the lines for WorkingDirectory, User and Group to mach your installation. For example, if you installed GroundWork 8 in the /home/gwos directory as user gwos, and added the gwos user to the docker group, then these lines would look like this:
Save the file.
Change the ownership of the file to be user root, group root:
sudo chown root:root /etc/systemd/system/gw8.serviceCODE
Enable the service:
sudo systemctl enable gw8CODE
If you have the authority to pause monitoring, reboot the host as a test. When it comes up, log in as the user you installed GroundWork as, then go to the gw8 directory, and enter:
You should see a listing of the GroundWork Monitor containers, all with Status "Up".