Use Cloudflared Docker to Map Your Sub Domain to Application in Free PaaS (Codesandbox.io)
This blog post shows you how to deploy Cloudflare docker into PaaS to map your sub domain to the apps in it.
There is any way to map your domain to Codesandbox PaaS, which is to use vercel, as shown from github project: https://github.com/k0baya/reserve-vercel/.
Codesandbox Free Tier
Up to 40 hours worth of VM credits per month VMs up to 4 vCPUs + 8 GiB RAM 5 private Sandboxes Unlimited public Sandboxes Unlimited Devboxes and repositories 5 members
Private Sandboxes, Devboxes & repos 100 Codeium AI code completions Live collaboration VS Code extension Instant environment resume Instant environment share
Usage status:
Every month, you will get 400 credits to use, which is 40 hours for a Nano vm.
Steps to Create a Cloudflared Docker with APP
1 Create your workspace box, either devbox or sandbox
2 Create Docker
You will be only able to select Devbox for this type of template:
3 Modify tasks.json file under workspace/.codesandbox
{ // These tasks will run in order when initializing your CodeSandbox project. "setupTasks": [ { "name": "Deploy", "command": "cd /project/workspace/.devcontainer/ && docker compose up -d" } ],
// These tasks can be run from CodeSandbox. Running one will open a log in the app. "tasks": { "cloudflare": { "name": "cloudflare", "command": "cloudflare", "runAtStart": true } }}
4 Create docker-compose.yaml file under workspace / .devcontainer
Once you pressed ctrl+s to save dockercompose.yaml file, it will ask you to rebuild & restart the deccontainers.
Manual Running the docker if task does not work:
Open a shared Terminals
Run following commands:
- cd /project/workspace/.devcontainer/ && docker compose up -d
Cloudflare
3. Test the public domain
Other Settings
Check System usage
Port forwarded Address
Other apps
version: "3.8"services: uptime-kuma: image: louislam/uptime-kuma:1 container_name: uptime-kuma volumes: - /project/sandbox/uptimekuma:/app/data ports: - "5700:3001" # <Host Port>:<Container Port> restart: always
cloudflared: restart: always network_mode: host environment: - tz=america/new_york command: tunnel --edge-ip-version auto --protocol quic --heartbeat-interval 10s run --token eyJhIjoiNDIwOTFiYzM3NjMxNmJjZDA5YWViM2VjYmYyNDM2ZTMiLCJ0IjoiYjQ0NWI1NmMtMTQzMS00NjJiLWFjNGMtMzMzNmRjY2RjNmU4IiwicyI6Ik1HRXlOMlZrT1RBdFlqWTJNaTAwTW1FekxUZ3dNR0l0WVRsbVpqZG1ZbUU0TXpjMSJ91 container_name: cloudflared image: cloudflare/cloudflared:latest
Keep System Active
Online Monitoring Codesandbox url such as https://t2s3qd-5700.csb.app this url:
Videos
References
- https://github.com/k0baya/xiaoya_alist_docker_on_render
- 在 CodeSandBox 上部署docker并使用Cloudflare Tunnel打通自己的域名——以 青龙面板 为例
- https://www.kuggg.org/archives/1705762042019
- CodeSandbox - Getting started with Docker
共有 0 条评论