add remote-fs.target to tomcat_lk.service startup ordering#78
Merged
Conversation
Fixes a race condition where tomcat_lk.service starts before the EFS mount is ready after a system reboot. The nightly update script (lk-ssm-update.sh) reboots the server after installing new binaries; on boot, systemd was starting LabKey before the NFS/EFS mount at /mnt/efs_volume was available, leaving the /labkey/labkey/files symlink broken and causing LabKey to abort with "Invalid site root does not exist". Adding remote-fs.target to After= ensures systemd waits for all _netdev remote filesystem mounts before starting the service. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
labkey-jony
approved these changes
Jun 11, 2026
labkey-gokhano
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
remote-fs.targetto theAfter=directive in bothstep_tomcat_service_embeddedandstep_tomcat_service_standardservice unit templatestomcat_lk.servicestarted before the EFS/NFS mount was ready after a rebootRoot cause
The nightly update script reboots the server after installing new binaries. On boot, systemd was starting
tomcat_lk.service(which only declaredAfter=network.target) before the EFS mount at/mnt/efs_volumewas available. The symlink/labkey/labkey/files → /mnt/efs_volume/fileswas broken at that moment, causing LabKey to abort withjava.lang.IllegalArgumentException: Invalid site root: /labkey/labkey/files does not exist.remote-fs.targetis the standard systemd target that represents all_netdevremote filesystem mounts (NFS, EFS) being available. Adding it toAfter=is the correct fix for this class of race condition.A companion PR in
syseng-chef-serveradds areplace_or_addblock to patch this line in the service file on existing servers on the next Chef convergence.Test plan
remote-fs.targetappears in/etc/systemd/system/tomcat_lk.serviceon the nightly server after next Chef convergence/labkey/labkey/logs/labkey.log🤖 Generated with Claude Code