mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 14:19:56 +00:00
docs(docker): harden remote token migration staging (#1381)
This commit is contained in:
+10
-5
@@ -160,15 +160,20 @@ docker exec ccs-cliproxy supervisorctl -c /etc/supervisord.conf restart cliproxy
|
|||||||
For remote deployments via `ccs docker up --host`:
|
For remote deployments via `ccs docker up --host`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Copy tokens into the running container (no root/sudo needed)
|
# Create a private staging directory (0700) and print its path
|
||||||
scp /path/to/auth/*.json my-server:/tmp/ccs-auth/
|
STAGE_DIR=$(ssh my-server 'umask 077 && mktemp -d "${HOME}/.ccs-auth.XXXXXX"')
|
||||||
ssh my-server 'for f in /tmp/ccs-auth/*.json; do docker cp "$f" ccs-cliproxy:/root/.ccs/cliproxy/auth/; done'
|
|
||||||
|
# Copy only JSON token files into the private staging directory
|
||||||
|
scp /path/to/auth/*.json "my-server:${STAGE_DIR}/"
|
||||||
|
|
||||||
|
# Restrict file permissions and import each staged token into the container
|
||||||
|
ssh my-server "chmod 600 \"${STAGE_DIR}\"/*.json && for f in \"${STAGE_DIR}\"/*.json; do docker cp \"\$f\" ccs-cliproxy:/root/.ccs/cliproxy/auth/; done"
|
||||||
|
|
||||||
# Restart CLIProxy to load new tokens
|
# Restart CLIProxy to load new tokens
|
||||||
ssh my-server "docker exec ccs-cliproxy supervisorctl -c /etc/supervisord.conf restart cliproxy"
|
ssh my-server "docker exec ccs-cliproxy supervisorctl -c /etc/supervisord.conf restart cliproxy"
|
||||||
|
|
||||||
# Clean up temp files
|
# Clean up private staging files
|
||||||
ssh my-server "rm -rf /tmp/ccs-auth"
|
ssh my-server "rm -rf \"${STAGE_DIR}\""
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Tip:** `docker cp` is preferred over writing directly to Docker volume mountpoints, which require root access.
|
> **Tip:** `docker cp` is preferred over writing directly to Docker volume mountpoints, which require root access.
|
||||||
|
|||||||
Reference in New Issue
Block a user