Steps

  1. login to cloudflare
    cloudflared tunnel login
    
  2. create tunnel
    cloudflared tunnel create <tunnel-name>
    
  3. copy from config.yml
    nano ~/.cloudflared/config.yml
    
  4. copy from cloudflared.service
    nano ~/.cloudflared/cloudflared.service
    
  5. start cloudflared service
    cp ~/.cloudflared/cloudflared.service ~/.config/systemd/user/
    systemctl --user daemon-reload
    systemctl --user enable --now cloudflared
    
  6. set dns record for gatus,nvim,olivetin,ttyd
    cloudflared tunnel route dns <tunnel-name> git-server
    cloudflared tunnel route dns <tunnel-name> nvim
    cloudflared tunnel route dns <tunnel-name> olivetin
    cloudflared tunnel route dns <tunnel-name> ttyd
    cloudflared tunnel route dns <tunnel-name> uptime-kuma
    

config.yml

# tunnel-uuid can be known from ~/.cloudflared/<tunnel-uuid>.json
tunnel: <tunnel-uuid>
credentials-file: /home/<username>/.cloudflared/<tunnel-uuid>.json
ingress:
  - hostname: "git-server.example.com"
    service: http://localhost:1344
  - hostname: "*.example.com"
    service: http://localhost:1080
  - service: http_status:404

cloudflared.service

[Unit]
Description=cloudflared
Wants=network-online.target
After=network-online.target

[Service]
Restart=always
ExecStart=cloudflared tunnel run <tunnel-name>

[Install]
WantedBy=default.target