Skip to content

Commit 0178356

Browse files
committed
fix(deploy): switch FTP deploy from FTP-Deploy-Action to lftp
Workflow deploy GitHub Actions selalu gagal dengan error SSL "decode_error" saat membuka koneksi data FTPS. Penyebabnya adalah regresi bug di Node.js (nodejs/node#64402): ketika GitHub Actions memaksa action berbasis Node (SamKirkland/FTP-Deploy-Action, yang memakai library basic-ftp) berjalan di build Node terbaru, TLS session pada koneksi data FTPS gagal di-resume dari koneksi kontrolnya. Server FTP Rumahweb (Pure-FTPd) mewajibkan session reuse ini sebagai proteksi keamanan, sehingga menolak koneksi data dan deploy selalu gagal — bukan masalah di konfigurasi kredensial/path. Solusi: ganti kedua step deploy FTP dari FTP-Deploy-Action ke lftp, binary terpisah yang implementasi TLS-nya tidak kena bug Node tersebut. Opsi FTPS (ftp:ssl-force, ssl-protect-data, ssl-protect-list) dan pola exclude dibuat setara dengan konfigurasi sebelumnya.
1 parent 8d8c442 commit 0178356

1 file changed

Lines changed: 55 additions & 37 deletions

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 55 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -61,51 +61,69 @@ jobs:
6161
rm -f AGENTS.md CLAUDE.md phpunit.xml package.json package-lock.json vite.config.js
6262
rm -rf storage/framework/views/*.php storage/logs/*.log
6363
64+
- name: Install lftp
65+
run: sudo apt-get update -y && sudo apt-get install -y lftp
66+
6467
# Public website:
6568
# FTP account must be jailed directly to
6669
# /home/whim4521/public_html/wos.whisnusantika.com/
70+
#
71+
# Uses lftp instead of SamKirkland/FTP-Deploy-Action: that action's
72+
# basic-ftp (Node) library does not resume the TLS session on the FTPS
73+
# data connection when GitHub's runner forces it onto a newer Node
74+
# build (a real Node.js TLS regression, see nodejs/node#64402). Pure-FTPd
75+
# servers (what Rumahweb/cPanel run) require session reuse and reject
76+
# the data connection with a decode_error alert as a result. lftp is a
77+
# separate C binary with its own correct TLS handling, so it isn't
78+
# affected by that Node bug.
6779
- name: Deploy public website
68-
uses: SamKirkland/[email protected]
69-
with:
70-
server: ${{ secrets.FTP_HOST }}
71-
username: ${{ secrets.FTP_USERNAME_PUBLIC }}
72-
password: ${{ secrets.FTP_PASSWORD_PUBLIC }}
73-
protocol: ftps
74-
port: 21
75-
security: loose
76-
timeout: 120000
77-
local-dir: ./public/
78-
server-dir: ./
79-
log-level: standard
80-
exclude: |
81-
**/.git*
82-
**/.git*/**
83-
**/hot
84-
**/fonts-manifest.dev.json
80+
env:
81+
FTP_HOST: ${{ secrets.FTP_HOST }}
82+
FTP_USERNAME_PUBLIC: ${{ secrets.FTP_USERNAME_PUBLIC }}
83+
FTP_PASSWORD_PUBLIC: ${{ secrets.FTP_PASSWORD_PUBLIC }}
84+
run: |
85+
lftp -u "$FTP_USERNAME_PUBLIC","$FTP_PASSWORD_PUBLIC" "$FTP_HOST" <<'LFTP_EOF'
86+
set ftp:ssl-force true
87+
set ftp:ssl-protect-data true
88+
set ftp:ssl-protect-list true
89+
set ssl:verify-certificate no
90+
set net:timeout 30
91+
set net:max-retries 3
92+
set net:reconnect-interval-base 5
93+
mirror -R --verbose \
94+
--exclude-glob ".git*" \
95+
--exclude-glob "hot" \
96+
--exclude-glob "fonts-manifest.dev.json" \
97+
./public/ ./
98+
bye
99+
LFTP_EOF
85100
86101
# Laravel application:
87102
# FTP account must be jailed directly to
88103
# /home/whim4521/wsm-office/
89104
- name: Deploy Laravel application
90-
uses: SamKirkland/[email protected]
91-
with:
92-
server: ${{ secrets.FTP_HOST }}
93-
username: ${{ secrets.FTP_USERNAME_APP }}
94-
password: ${{ secrets.FTP_PASSWORD_APP }}
95-
protocol: ftps
96-
port: 21
97-
security: loose
98-
timeout: 120000
99-
local-dir: ./
100-
server-dir: ./
101-
log-level: standard
102-
exclude: |
103-
public/**
104-
storage/**
105-
**/.git*
106-
**/.git*/**
107-
.github/**
108-
.env
105+
env:
106+
FTP_HOST: ${{ secrets.FTP_HOST }}
107+
FTP_USERNAME_APP: ${{ secrets.FTP_USERNAME_APP }}
108+
FTP_PASSWORD_APP: ${{ secrets.FTP_PASSWORD_APP }}
109+
run: |
110+
lftp -u "$FTP_USERNAME_APP","$FTP_PASSWORD_APP" "$FTP_HOST" <<'LFTP_EOF'
111+
set ftp:ssl-force true
112+
set ftp:ssl-protect-data true
113+
set ftp:ssl-protect-list true
114+
set ssl:verify-certificate no
115+
set net:timeout 30
116+
set net:max-retries 3
117+
set net:reconnect-interval-base 5
118+
mirror -R --verbose \
119+
--exclude-glob "public" \
120+
--exclude-glob "storage" \
121+
--exclude-glob ".git*" \
122+
--exclude-glob ".github" \
123+
--exclude-glob ".env" \
124+
./ ./
125+
bye
126+
LFTP_EOF
109127
110128
# Runs Laravel migrations and rebuilds production caches through
111129
# /system/deploy-hook. The token must match .env on the server.
@@ -119,4 +137,4 @@ jobs:
119137
curl --fail --silent --show-error \
120138
--max-time 120 \
121139
-X POST "$DEPLOY_HOOK_URL" \
122-
-H "X-Deploy-Token: $DEPLOY_HOOK_TOKEN"
140+
-H "X-Deploy-Token: $DEPLOY_HOOK_TOKEN"

0 commit comments

Comments
 (0)