Skip to content

Commit dc73e92

Browse files
authored
remove cloudflare tunnels (#3556)
## Description: We now use traefik to route between containers, so we can remove cloudflare tunnels ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: evan
1 parent 5499bc3 commit dc73e92

File tree

8 files changed

+10
-137
lines changed

8 files changed

+10
-137
lines changed

.github/workflows/deploy.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ jobs:
106106
chmod 600 ~/.ssh/id_rsa
107107
- name: 🚢 Deploy
108108
env:
109-
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
110-
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
111109
GHCR_REPO: ${{ vars.GHCR_REPO }}
112110
GHCR_USERNAME: ${{ vars.GHCR_USERNAME }}
113111
ENV: ${{ inputs.target_domain == 'openfront.io' && 'prod' || 'staging' }}

.github/workflows/release.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ jobs:
6464
chmod 600 ~/.ssh/id_rsa
6565
- name: 🚀 Deploy image
6666
env:
67-
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
68-
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
6967
GHCR_REPO: openfront-prod
7068
GHCR_USERNAME: ${{ vars.GHCR_USERNAME }}
7169
DOMAIN: ${{ vars.DOMAIN }}
@@ -116,8 +114,6 @@ jobs:
116114
chmod 600 ~/.ssh/id_rsa
117115
- name: 🚀 Deploy image
118116
env:
119-
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
120-
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
121117
GHCR_REPO: ${{ vars.GHCR_REPO }}
122118
GHCR_USERNAME: ${{ vars.GHCR_USERNAME }}
123119
DOMAIN: ${{ vars.DOMAIN }}
@@ -168,8 +164,6 @@ jobs:
168164
chmod 600 ~/.ssh/id_rsa
169165
- name: 🚀 Deploy image
170166
env:
171-
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
172-
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
173167
GHCR_REPO: ${{ vars.GHCR_REPO }}
174168
GHCR_USERNAME: ${{ vars.GHCR_USERNAME }}
175169
DOMAIN: ${{ vars.DOMAIN }}
@@ -220,8 +214,6 @@ jobs:
220214
chmod 600 ~/.ssh/id_rsa
221215
- name: 🚀 Deploy image
222216
env:
223-
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
224-
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
225217
GHCR_REPO: ${{ vars.GHCR_REPO }}
226218
GHCR_USERNAME: ${{ vars.GHCR_USERNAME }}
227219
DOMAIN: ${{ vars.DOMAIN }}

Dockerfile

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,14 @@ FROM base
3838
RUN apt-get update && apt-get install -y \
3939
nginx \
4040
curl \
41-
jq \
4241
wget \
4342
supervisor \
4443
apache2-utils \
4544
&& rm -rf /var/lib/apt/lists/*
4645

47-
RUN curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb > cloudflared.deb \
48-
&& dpkg -i cloudflared.deb \
49-
&& rm cloudflared.deb
50-
5146
# Update worker_connections in nginx.conf
5247
RUN sed -i 's/worker_connections [0-9]*/worker_connections 8192/' /etc/nginx/nginx.conf
5348

54-
# Create cloudflared directory with proper permissions
55-
RUN mkdir -p /etc/cloudflared && \
56-
chown -R node:node /etc/cloudflared && \
57-
chmod -R 755 /etc/cloudflared
58-
5949
# Setup supervisor configuration
6050
RUN mkdir -p /var/log/supervisor
6151
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
@@ -64,10 +54,6 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
6454
COPY nginx.conf /etc/nginx/conf.d/default.conf
6555
RUN rm -f /etc/nginx/sites-enabled/default
6656

67-
# Copy and make executable the startup script
68-
COPY startup.sh /usr/local/bin/
69-
RUN chmod +x /usr/local/bin/startup.sh
70-
7157
# Copy production node_modules from prod-deps stage (cached separately from build)
7258
COPY --from=prod-deps /usr/src/app/node_modules ./node_modules
7359
COPY package*.json ./
@@ -87,8 +73,14 @@ ARG GIT_COMMIT=unknown
8773
RUN echo "$GIT_COMMIT" > static/commit.txt
8874

8975
ENV GIT_COMMIT="$GIT_COMMIT"
90-
ENV CF_CONFIG_PATH=/etc/cloudflared/config.yml
91-
ENV CF_CREDS_PATH=/etc/cloudflared/creds.json
9276

93-
# Use the startup script as the entrypoint
94-
ENTRYPOINT ["/usr/local/bin/startup.sh"]
77+
RUN <<'EOF' tee /usr/local/bin/start.sh
78+
#!/bin/sh
79+
if [ "$DOMAIN" = openfront.dev ] && [ "$SUBDOMAIN" != main ]; then
80+
exec timeout 18h /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
81+
else
82+
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
83+
fi
84+
EOF
85+
RUN chmod +x /usr/local/bin/start.sh
86+
ENTRYPOINT ["/usr/local/bin/start.sh"]

deploy.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ ENV=$ENV
134134
HOST=$HOST
135135
GHCR_IMAGE=$GHCR_IMAGE
136136
GHCR_TOKEN=$GHCR_TOKEN
137-
CF_ACCOUNT_ID=$CF_ACCOUNT_ID
138-
CF_API_TOKEN=$CF_API_TOKEN
139137
TURNSTILE_SECRET_KEY=$TURNSTILE_SECRET_KEY
140138
API_KEY=$API_KEY
141139
DOMAIN=$DOMAIN

example.env

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ GHCR_USERNAME=username
66
GHCR_REPO=your-repo-name
77
GHCR_TOKEN=your_docker_token_here
88

9-
# Cloudflare Configuration
10-
CF_ACCOUNT_ID=your_cloudflare_account_id
11-
CF_API_TOKEN=your_cloudflare_api_token
129
DOMAIN=your-domain.com
1310

1411
# API Key

startup.sh

Lines changed: 0 additions & 92 deletions
This file was deleted.

supervisord.conf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,3 @@ stdout_logfile=/dev/stdout
2323
stdout_logfile_maxbytes=0
2424
stderr_logfile=/dev/stderr
2525
stderr_logfile_maxbytes=0
26-
27-
[program:cloudflared]
28-
command=cloudflared tunnel run --token %(ENV_CLOUDFLARE_TUNNEL_TOKEN)s
29-
autostart=true
30-
autorestart=true
31-
user=node
32-
stdout_logfile=/var/log/cloudflared.log
33-
stderr_logfile=/var/log/cloudflared-err.log

update.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,10 @@ echo "Starting new container for ${HOST} environment..."
6262
# Ensure the traefik network exists
6363
docker network create web 2> /dev/null || true
6464

65-
# Remove any existing volume for this container if it exists
66-
docker volume rm "cloudflared-${CONTAINER_NAME}" 2> /dev/null || true
67-
6865
docker run -d \
6966
--restart="${RESTART}" \
7067
--env-file "$ENV_FILE" \
7168
--name "${CONTAINER_NAME}" \
72-
-v "cloudflared-${CONTAINER_NAME}:/etc/cloudflared" \
7369
--network web \
7470
--label "traefik.enable=true" \
7571
--label "traefik.http.routers.${CONTAINER_NAME}.rule=Host(\`${SUBDOMAIN}.${DOMAIN}\`)" \

0 commit comments

Comments
 (0)