Move CI runners to Droplet and enable application HTTPS
vpn-dns-gateway/pipeline/pr-main This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# Run as root from /opt/ssw590-delivery-agent after stopping the laptop copy.
|
||||
# Copy compose.droplet.yaml and ssh_config.droplet here first; load the verified
|
||||
# agent image. Never copy any identity file into this directory or into Git.
|
||||
set -euo pipefail
|
||||
test "$(id -u)" = 0
|
||||
cd /opt/ssw590-delivery-agent
|
||||
export DOCKER_GID
|
||||
DOCKER_GID=$(stat -c '%g' /var/run/docker.sock)
|
||||
# Numeric group only, not a credential. Keep it available for later Compose use.
|
||||
printf 'DOCKER_GID=%s\n' "$DOCKER_GID" > .env
|
||||
chmod 644 .env
|
||||
docker image inspect ssw590-delivery-agent:20261114 >/dev/null
|
||||
docker compose -f compose.droplet.yaml config --quiet
|
||||
docker exec -u jenkins gitea-jenkins-1 test -s /var/jenkins_home/delivery-bootstrap/agent-secret
|
||||
docker volume create ssw590-delivery-identity >/dev/null
|
||||
docker exec -u jenkins gitea-jenkins-1 cat /var/jenkins_home/delivery-bootstrap/agent-secret |
|
||||
docker run --rm -i --network none --user 0:0 --entrypoint sh \
|
||||
--mount type=volume,source=ssw590-delivery-identity,target=/identity \
|
||||
ssw590-delivery-agent:20261114 -c \
|
||||
'set -eu; umask 077; cat > /identity/agent-secret; test -s /identity/agent-secret; chown 1000:1000 /identity /identity/agent-secret; chmod 700 /identity; chmod 400 /identity/agent-secret'
|
||||
docker compose -f compose.droplet.yaml up -d --pull never
|
||||
agent=ssw590-delivery-agent-1
|
||||
# BuildKit's own container must be limited too: the socket mount does not make
|
||||
# child build containers inherit the agent's resource caps.
|
||||
if ! docker exec "$agent" docker buildx inspect ssw590-delivery-limited >/dev/null 2>&1; then
|
||||
docker exec "$agent" docker buildx create --name ssw590-delivery-limited \
|
||||
--driver docker-container \
|
||||
--driver-opt image=moby/buildkit@sha256:c5f8862f52499773af85bc07695b2379ef08e8002352b0df2c4864c91d78dabe,memory=256m,memory-swap=384m,cpu-period=100000,cpu-quota=50000,restart-policy=unless-stopped
|
||||
fi
|
||||
docker exec "$agent" docker buildx inspect ssw590-delivery-limited --bootstrap
|
||||
docker compose -f compose.droplet.yaml ps
|
||||
Reference in New Issue
Block a user