Skip to content

Commit 6832ce4

Browse files
authored
Add: add cloudflared named workflow
1 parent bb285f8 commit 6832ce4

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Full Tunnel (cloudflared Named)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
tunnel:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 360
13+
steps:
14+
- name: Start mhrv-tunnel-node
15+
run: |
16+
docker run -d --name mhrv-tunnel \
17+
-p 8080:8080 \
18+
-e TUNNEL_AUTH_KEY="${{ secrets.TUNNEL_AUTH_KEY }}" \
19+
ghcr.io/therealaleph/mhrv-tunnel-node:latest
20+
sleep 5
21+
curl -s http://localhost:8080/health || sleep 5
22+
23+
- name: Install cloudflared
24+
run: |
25+
curl -L --output cloudflared.deb \
26+
https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
27+
sudo dpkg -i cloudflared.deb
28+
29+
- name: Configure tunnel
30+
run: |
31+
mkdir -p ~/.cloudflared
32+
echo "${{ secrets.CLOUDFLARE_TUNNEL_CREDENTIALS }}" > ~/.cloudflared/credentials.json
33+
cat > ~/.cloudflared/config.yml << EOF
34+
tunnel: ${{ secrets.CLOUDFLARE_TUNNEL_ID }}
35+
credentials-file: /home/runner/.cloudflared/credentials.json
36+
ingress:
37+
- hostname: ${{ secrets.CLOUDFLARE_TUNNEL_HOSTNAME }}
38+
service: http://localhost:8080
39+
- service: http_status:404
40+
EOF
41+
42+
- name: Run tunnel
43+
run: |
44+
cloudflared tunnel --config ~/.cloudflared/config.yml run &
45+
echo "TUNNEL_SERVER_URL = https://${{ secrets.CLOUDFLARE_TUNNEL_HOSTNAME }}"
46+
sleep 21000
47+
48+
- name: Cleanup
49+
if: always()
50+
run: |
51+
docker stop mhrv-tunnel || true
52+
pkill cloudflared || true

0 commit comments

Comments
 (0)