Skip to content

Commit

Permalink
chore: update deployment
Browse files Browse the repository at this point in the history
make cloudflared serve the traffic
  • Loading branch information
BobyMCbobs committed Dec 12, 2023
1 parent 93fcbb1 commit e58838a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cloudflared-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
tunnel: ii-nz
tunnel: ad02aacc-f4ca-4efb-be33-79018ef10b63
credentials-file: /etc/cloudflared/creds/credentials.json
metrics: 0.0.0.0:2000
no-autoupdate: true
Expand Down
4 changes: 2 additions & 2 deletions cloudflared.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM alpine:3.18@sha256:34871e7290500828b39e22294660bee86d966bc0017544e848dd9a255cdf59e0 AS cfg
COPY cloudflared-config.yaml /etc/cloudflared/config.yaml
RUN chmod 0644 /etc/cloudflared/config.yaml && chown 65532:65532 /etc/cloudflared/config.yaml
RUN chmod 0644 /etc/cloudflared/config.yaml

FROM docker.io/cloudflare/cloudflared:2023.8.2@sha256:93561dfa0032006354be56476f09e3d8743d53d202368672c2847c1631f7be50 AS site
COPY --from=cfg /etc/cloudflared/config.yaml /etc/cloudflared/config.yaml
COPY --from=cfg /etc/cloudflared/config.yaml /usr/etc/cloudflared/config.yaml
4 changes: 2 additions & 2 deletions deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ $ cloudflared tunnel create ii-nz
A JSON file will be produced with the credentials to connect the said tunnel.

```
cloudflared tunnel list -o json | jq -r '.[] | select(.name=="ii-nz") | .id' \
$ cloudflared tunnel list -o json | jq -r '.[] | select(.name=="ii-nz") | .id' \
| head -n 1 | xargs -I{} cat $HOME/.cloudflared/{}.json | base64
```

base64 encode the file, and park for later.
base64 encode the file, and park them for later.

### links
- https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-remote-tunnel/
Expand Down
7 changes: 4 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ services:
- |
chown -R 65532 /etc/cloudflared/creds
rm -rfv /etc/cloudflared/creds/credentials.json
mkdir -p /etc/cloudflared/creds/
echo "$CF_CREDS" | base64 -d > /etc/cloudflared/creds/credentials.json
chown -R 65532 /etc/cloudflared/creds
chown -R 65532 /etc/cloudflared/
volumes:
- cf:/etc/cloudflared/creds:z
- cf:/etc/cloudflared:z
restart: on-failure
cloudflared:
build:
context: .
dockerfile: cloudflared.Dockerfile
command: tunnel --config /etc/cloudflared/config.yaml run
command: tunnel --config /usr/etc/cloudflared/config.yaml run
networks:
- shared
volumes:
Expand Down

0 comments on commit e58838a

Please sign in to comment.