You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/deployment/github-actions-server.md
+16-6Lines changed: 16 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Pushing to `main` triggers [.github/workflows/deploy-server.yml](/C:/Users/20562
7
7
- Checks out the repo on `ubuntu-latest`
8
8
- Sets up Go from `clipSync-server/go.mod`
9
9
- Runs `go test ./... -v -count=1` in `clipSync-server`
10
-
- Builds a Linux `amd64` server binary with `CGO_ENABLED=1`
10
+
- Builds a Linux `amd64` server binary with `CGO_ENABLED=1` against musl so the release is compatible with older glibc-based servers such as Alibaba Cloud Linux 3
11
11
- Packages the binary and `clipSync-server/configs/config.yaml` into `clipsync-server-release-<git-sha>.tar.gz`
12
12
- Uploads the release archive to the deployment host over SSH/SCP
13
13
- Pipes [`scripts/deploy/server-release.sh`](/C:/Users/20562/Desktop/桌面/clipSync/scripts/deploy/server-release.sh) to the remote host and executes it with deployment environment variables
@@ -28,13 +28,16 @@ Configure these repository secrets before enabling the workflow:
28
28
|`DEPLOY_SERVICE_NAME`|`clipsync.service`| systemd service restarted during deploy and rollback |
29
29
|`DEPLOY_KNOWN_HOSTS`| output of `ssh-keyscan -H 8.141.100.238`| Host key entry used for strict SSH host verification |
30
30
|`DEPLOY_JWT_SECRET`| a long random secret | Injected into the deployed server config during deployment; do not store the live JWT secret in git |
31
+
|`DEPLOY_BINARY_RELATIVE_PATH`|`clipsync-server`| Optional relative install path under `DEPLOY_PATH` for the live binary when the systemd service does not use `bin/clipsync-server-linux`|
32
+
|`DEPLOY_CONFIG_RELATIVE_PATH`|`configs/config.yaml`| Optional relative install path under `DEPLOY_PATH` for the live config |
31
33
32
34
Notes:
33
35
34
36
-`DEPLOY_SSH_KEY` must match the public key installed for `DEPLOY_USER` on the server.
35
37
-`DEPLOY_KNOWN_HOSTS` is required because the workflow uses `StrictHostKeyChecking=yes`.
36
38
- Keep `DEPLOY_PATH` and `DEPLOY_SERVICE_NAME` aligned with the actual server layout and systemd unit.
37
39
-`DEPLOY_JWT_SECRET` should be treated as the real production JWT signing key. The repository config now keeps only the placeholder value.
40
+
- Leave `DEPLOY_BINARY_RELATIVE_PATH` and `DEPLOY_CONFIG_RELATIVE_PATH` unset when the server uses the default layout under `DEPLOY_PATH/bin` and `DEPLOY_PATH/configs`.
38
41
- Optional: `DEPLOY_PUBLIC_HEALTH_URL` can override the final GitHub Actions health-check URL when the public endpoint differs from `http://<DEPLOY_HOST>:8081/api/v1/health`.
39
42
40
43
## Server Requirements
@@ -44,10 +47,10 @@ The workflow assumes the target server already has:
44
47
- A Linux environment reachable from GitHub-hosted runners over SSH
45
48
- A systemd service matching `DEPLOY_SERVICE_NAME`
46
49
-`bash`, `tar`, `curl`, and `systemctl` available on the target host
47
-
- A writable deployment directory such as `/opt/clipSync-server-src`
50
+
- A writable deployment directory such as `/opt/clipSync-server-src` or `/opt/clipsync`
48
51
- Permission for `DEPLOY_USER` to write under `DEPLOY_PATH`
49
52
- Permission for `DEPLOY_USER` to restart `DEPLOY_SERVICE_NAME`
50
-
- The service configured to run the deployed binary from `DEPLOY_PATH/bin/clipsync-server-linux`
53
+
- The service configured to run the deployed binary from either `DEPLOY_PATH/bin/clipsync-server-linux` or `DEPLOY_PATH/<DEPLOY_BINARY_RELATIVE_PATH>`
51
54
- The service configured so the server can find `configs/config.yaml` after startup
52
55
- The server health endpoint available at `http://127.0.0.1:8081/api/v1/health`
53
56
@@ -86,6 +89,12 @@ Example expectations:
86
89
- Data directory: `/opt/clipSync-server-src/data`
87
90
- Either `WorkingDirectory=/opt/clipSync-server-src` or `Environment=CLIPSYNC_CONFIG=/opt/clipSync-server-src/configs/config.yaml`
88
91
92
+
If your existing service uses a flat layout like `/opt/clipsync/clipsync-server`, set:
7. Verify the service can start and answer its local health endpoint before relying on automation.
90
99
91
100
```bash
@@ -102,9 +111,9 @@ The remote deployment script is intentionally narrow and opinionated:
102
111
103
112
-`data/` is preserved. The script creates `DEPLOY_PATH/data` if needed and never deletes or replaces it.
104
113
-`configs/config.yaml` is overwritten from the repository on every deploy, then the script replaces the placeholder JWT secret with `DEPLOY_JWT_SECRET` on the server.
105
-
- The live binary path is `DEPLOY_PATH/bin/clipsync-server-linux`.
106
-
- The binary backup path is `DEPLOY_PATH/bin/clipsync-server-linux.prev`.
107
-
- The config backup path is `DEPLOY_PATH/configs/config.yaml.prev`.
114
+
- The live binary path defaults to `DEPLOY_PATH/bin/clipsync-server-linux`, but can be overridden with `DEPLOY_BINARY_RELATIVE_PATH`.
115
+
- The binary backup path is the live binary path with `.prev` appended.
116
+
- The config backup path is the live config path with `.prev` appended.
108
117
- The uploaded release archive is stored remotely at `/tmp/clipsync-server-release-<git-sha>.tar.gz`.
109
118
- The script extracts into a temporary staging directory under `/tmp/clipsync-release.XXXXXX`.
110
119
- Archive contents are validated before extraction to reject absolute paths, path traversal, and unsupported entry types.
@@ -172,6 +181,7 @@ What to verify:
172
181
- The deployed config in `/opt/clipSync-server-src/configs/config.yaml` contains production-safe values.
173
182
-`DEPLOY_JWT_SECRET` exists in GitHub Secrets and the deployed config no longer contains the placeholder value.
174
183
- The service is actually starting the binary at `/opt/clipSync-server-src/bin/clipsync-server-linux`.
184
+
- If `DEPLOY_BINARY_RELATIVE_PATH` is set, verify the service path matches that effective install path instead of the default `bin/clipsync-server-linux`.
175
185
- Port `8081` is listening and reachable from outside the host if the final GitHub Actions health check is using the default URL.
176
186
- If `DEPLOY_PUBLIC_HEALTH_URL` is configured, verify that public endpoint and any proxy/load-balancer routing in front of it.
177
187
- If rollback ran, check whether `.prev` files were restored and whether the service recovered to the previous version.
0 commit comments