Skip to content

Commit ade7a79

Browse files
claudeXeoneid
authored andcommitted
fix(ci): run dokploy install.sh as root, install version A directly via DOKPLOY_VERSION
Previous run failed with 'This script must be run as root'. install.sh also respects DOKPLOY_VERSION and ADVERTISE_ADDR env vars, so we can install version A directly instead of installing latest and downgrading (which would risk B's migrations running on A's expected schema).
1 parent 55704ff commit ade7a79

1 file changed

Lines changed: 49 additions & 47 deletions

File tree

‎.github/workflows/upgrade-integration-test.yml‎

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -123,41 +123,39 @@ jobs:
123123
docker system prune -af --volumes
124124
df -h
125125
126-
- name: Pre-init Docker Swarm (so install.sh skips its own swarm init)
126+
# ── Install Dokploy directly at VERSION A ──────────────────────────────
127+
# install.sh:
128+
# • requires root (run via sudo bash)
129+
# • respects DOKPLOY_VERSION → installs that tag directly
130+
# (so we don't need a separate "downgrade" step that would risk
131+
# running B's migrations on A's expected schema)
132+
# • respects ADVERTISE_ADDR → skip the external IP lookup
133+
# • initializes Docker Swarm + dokploy-network itself
134+
- name: Install Dokploy at VERSION A (${{ matrix.pair.from }})
127135
run: |
128-
docker swarm init --advertise-addr 127.0.0.1
129-
docker network create --driver overlay --attachable dokploy-network || true
130-
131-
# ── Install Dokploy infrastructure ─────────────────────────────────────
132-
- name: Run Dokploy install.sh (sets up Traefik, Redis, Postgres, service)
133-
run: curl -sSL https://dokploy.com/install.sh | bash
134-
135-
# ── Pin to version A before any data is written ────────────────────────
136-
- name: Pin Dokploy to VERSION A (${{ matrix.pair.from }})
136+
curl -fsSL https://dokploy.com/install.sh -o /tmp/install.sh
137+
chmod +x /tmp/install.sh
138+
sudo -E env \
139+
DOKPLOY_VERSION="${{ matrix.pair.from }}" \
140+
ADVERTISE_ADDR="127.0.0.1" \
141+
bash /tmp/install.sh
142+
143+
- name: Wait for dokploy service to converge on ${{ matrix.pair.from }}
137144
run: |
138-
docker service update \
139-
--image "${{ env.DOKPLOY_IMAGE }}:${{ matrix.pair.from }}" \
140-
--force \
141-
"${{ env.DOKPLOY_SERVICE }}"
142-
143-
echo "Waiting for service to converge on ${{ matrix.pair.from }}..."
144-
timeout 180 bash -c '
145-
until ! docker service inspect dokploy \
146-
--format "{{.UpdateStatus.State}}" 2>/dev/null \
147-
| grep -q "^updating$"; do
148-
sleep 4
149-
done
145+
echo "Waiting for 'dokploy' Swarm service to reach 1/1..."
146+
timeout 240 bash -c '
150147
until docker service ls --filter name=dokploy \
151148
--format "{{.Name}} {{.Replicas}}" \
152149
| grep "^dokploy " | grep -q " 1/1"; do
153150
sleep 4
154151
done
155152
'
153+
docker service ls
156154
echo "✅ Service running on ${{ matrix.pair.from }}"
157155
158156
- name: Wait for Dokploy API to accept requests
159157
run: |
160-
timeout 120 bash -c '
158+
timeout 180 bash -c '
161159
until curl -sf -o /dev/null \
162160
"http://localhost:${{ env.DOKPLOY_PORT }}"; do
163161
sleep 3
@@ -169,23 +167,25 @@ jobs:
169167
- name: Register first admin user
170168
id: auth
171169
run: |
172-
COOKIE_JAR=$(mktemp /tmp/dokploy-cookies-XXXXXX)
170+
COOKIE_JAR="$RUNNER_TEMP/dokploy-cookies.txt"
171+
: > "$COOKIE_JAR"
172+
chmod 600 "$COOKIE_JAR"
173173
echo "cookie_jar=$COOKIE_JAR" >> "$GITHUB_OUTPUT"
174174
175175
# better-auth: sign-up/email (allowed only before any owner exists)
176-
RESP=$(curl -sf -X POST \
176+
set -x
177+
curl -sS -i -X POST \
177178
"http://localhost:${{ env.DOKPLOY_PORT }}/api/auth/sign-up/email" \
178179
-H "Content-Type: application/json" \
179180
-c "$COOKIE_JAR" -b "$COOKIE_JAR" \
180-
-d '{"name":"CI Admin","email":"[email protected]","password":"CiTest1234!"}')
181-
182-
echo "Sign-up response: $RESP"
183-
# Session cookie is stored in the jar; also capture token if present
184-
TOKEN=$(echo "$RESP" | jq -r '.token // empty' 2>/dev/null || true)
185-
if [ -n "$TOKEN" ]; then
186-
echo "::add-mask::$TOKEN"
187-
# Inject token as a cookie for older versions that don't use cookie jar
188-
echo "dokploy.com FALSE / FALSE 0 auth_token $TOKEN" >> "$COOKIE_JAR"
181+
-d '{"name":"CI Admin","email":"[email protected]","password":"CiTest1234!"}' \
182+
| tee /tmp/signup.out
183+
set +x
184+
185+
# Verify we got a session cookie
186+
if ! grep -qE '(better-auth|auth)\.session' "$COOKIE_JAR"; then
187+
echo "⚠️ No session cookie matched expected name; jar contents:"
188+
cat "$COOKIE_JAR"
189189
fi
190190
191191
# ── Create test resources ──────────────────────────────────────────────
@@ -195,12 +195,13 @@ jobs:
195195
BASE: "http://localhost:${{ env.DOKPLOY_PORT }}"
196196
COOKIE: ${{ steps.auth.outputs.cookie_jar }}
197197
run: |
198-
# --- tRPC helpers ---
199-
# Mutation (POST)
198+
set -euo pipefail
199+
200+
# --- tRPC POST helper ---
200201
trpc_mut() {
201202
curl -sf -X POST "$BASE/api/trpc/$1" \
202203
-H "Content-Type: application/json" \
203-
-b "$COOKIE" \
204+
-b "$COOKIE" -c "$COOKIE" \
204205
-d "{\"json\":$2}"
205206
}
206207
@@ -218,7 +219,7 @@ jobs:
218219
PG=$(trpc_mut postgres.create \
219220
"{\"name\":\"ci-pg\",\"appName\":\"ci-pg-db\",\
220221
\"databaseName\":\"cidb\",\"databaseUser\":\"ciuser\",\
221-
\"databasePassword\":\"CiPg1!\",\
222+
\"databasePassword\":\"CiPg1pass\",\
222223
\"dockerImage\":\"postgres:15\",\"environmentId\":\"$ENV_ID\"}")
223224
PG_ID=$(echo "$PG" | jq -r '.result.data.json.postgresId')
224225
trpc_mut postgres.start "{\"postgresId\":\"$PG_ID\"}" > /dev/null
@@ -228,14 +229,13 @@ jobs:
228229
MG=$(trpc_mut mongo.create \
229230
"{\"name\":\"ci-mongo\",\"appName\":\"ci-mongo-db\",\
230231
\"databaseName\":\"cidb\",\"databaseUser\":\"ciuser\",\
231-
\"databasePassword\":\"CiMg1!\",\
232+
\"databasePassword\":\"CiMg1pass\",\
232233
\"dockerImage\":\"mongo:7.0\",\"environmentId\":\"$ENV_ID\"}")
233234
MG_ID=$(echo "$MG" | jq -r '.result.data.json.mongoId')
234235
trpc_mut mongo.start "{\"mongoId\":\"$MG_ID\"}" > /dev/null
235236
echo "mg_id=$MG_ID" >> "$GITHUB_OUTPUT"
236237
237238
# --- Docker-image application helper ---
238-
# Creates an application, sets Docker image provider, triggers deploy.
239239
make_app() {
240240
local DISP_NAME=$1 APP_NAME=$2 IMAGE=$3
241241
APP=$(trpc_mut application.create \
@@ -276,11 +276,10 @@ jobs:
276276
APP_NODE_ID: ${{ steps.create.outputs.app_node_id }}
277277
APP_GO_ID: ${{ steps.create.outputs.app_go_id }}
278278
run: |
279-
# Poll a tRPC query endpoint until the service status field == "done"
280279
wait_done() {
281280
local NAME=$1 ENDPOINT=$2 ID_KEY=$3 ID=$4 STATUS_KEY=$5
282281
echo "Waiting for $NAME to reach 'done'..."
283-
timeout 300 bash -c "
282+
timeout 360 bash -c "
284283
until [ \"\$(curl -sf -G '$BASE/api/trpc/$ENDPOINT' \
285284
--data-urlencode 'input={\"json\":{\"$ID_KEY\":\"$ID\"}}' \
286285
-b '$COOKIE' | \
@@ -303,7 +302,6 @@ jobs:
303302
echo "=== docker service ls ==="
304303
docker service ls
305304
306-
# User services should all be 1/1; check none are 0/1
307305
FAIL=$(docker service ls --format '{{.Name}} {{.Replicas}}' | \
308306
grep -E '^ci-' | grep -v ' 1/1' || true)
309307
if [ -n "$FAIL" ]; then
@@ -322,7 +320,7 @@ jobs:
322320
"${{ env.DOKPLOY_SERVICE }}"
323321
324322
echo "Waiting for service to converge on ${{ matrix.pair.to }}..."
325-
timeout 180 bash -c '
323+
timeout 240 bash -c '
326324
until ! docker service inspect dokploy \
327325
--format "{{.UpdateStatus.State}}" 2>/dev/null \
328326
| grep -q "^updating$"; do
@@ -338,7 +336,7 @@ jobs:
338336
339337
- name: Wait for Dokploy API to respond post-upgrade
340338
run: |
341-
timeout 120 bash -c '
339+
timeout 180 bash -c '
342340
until curl -sf -o /dev/null \
343341
"http://localhost:${{ env.DOKPLOY_PORT }}"; do
344342
sleep 3
@@ -395,8 +393,12 @@ jobs:
395393
echo "=== docker service ls ===" && docker service ls || true
396394
echo "=== dokploy service tasks ===" && \
397395
docker service ps "${{ env.DOKPLOY_SERVICE }}" --no-trunc || true
398-
echo "=== dokploy logs (last 100) ===" && \
399-
docker service logs "${{ env.DOKPLOY_SERVICE }}" --tail 100 2>&1 || true
396+
echo "=== dokploy logs (last 200) ===" && \
397+
docker service logs "${{ env.DOKPLOY_SERVICE }}" --tail 200 2>&1 || true
398+
echo "=== install.sh tail ===" && \
399+
tail -100 /tmp/install.sh 2>&1 || true
400+
echo "=== signup response ===" && \
401+
cat /tmp/signup.out 2>&1 || true
400402
echo "=== disk usage ===" && df -h
401403
402404
# ── Job summary ────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)