Commit 8e108b4
Fix deployment: stop service before binary replace, add self-update
The deploy script was failing with "Text file busy" because it tried to
overwrite the running binary with cp. Three-part fix:
1. scripts/deploy-moon (new standalone copy of server-side script):
- Self-update: if bundle contains a newer version of this script,
install it and re-exec before doing anything else
- Stop the service (systemctl stop moon) before copying the binary
- Use rm -f before cp to handle "Text file busy" even as a fallback
2. scripts/server-setup.sh: embed the same improved deploy-moon so
re-running the setup script updates the server-side copy; also add
NOPASSWD sudoers entry for "systemctl stop moon"
3. .github/workflows/deploy.yml:
- Include scripts/deploy-moon in the SCP bundle so the server copy
auto-updates on every deployment
- Add continue-on-error: true to the "Stop service" step so the
deploy still proceeds even if sudoers hasn't been updated yet
One-time manual step required: SSH into the server and run
sudo bash scripts/server-setup.sh
to install the fixed deploy-moon and updated sudoers. After that,
all future deployments will be fully automated.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent ab1ff8c commit 8e108b4
File tree
3 files changed
+82
-3
lines changed- .github/workflows
- scripts
3 files changed
+82
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
71 | 83 | | |
72 | 84 | | |
73 | 85 | | |
| |||
77 | 89 | | |
78 | 90 | | |
79 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
80 | 95 | | |
| 96 | + | |
81 | 97 | | |
82 | 98 | | |
83 | 99 | | |
| |||
88 | 104 | | |
89 | 105 | | |
90 | 106 | | |
91 | | - | |
92 | | - | |
| 107 | + | |
| 108 | + | |
93 | 109 | | |
94 | 110 | | |
95 | 111 | | |
| |||
116 | 132 | | |
117 | 133 | | |
118 | 134 | | |
| 135 | + | |
| 136 | + | |
119 | 137 | | |
120 | 138 | | |
121 | 139 | | |
| |||
0 commit comments