From 69157030d6399f10815f344078cd7f0d479d8d3c Mon Sep 17 00:00:00 2001 From: Adrian Goodyer Date: Wed, 28 Aug 2024 20:38:07 +0100 Subject: [PATCH 1/2] Update remote-management.mdx Updated instructions to create systemd service for linux. - use sensible log location - add [install] section so service can be enabled - add systemctl commands to enable and start service - add system log command to debug any potential issues --- .../configure-tunnels/remote-management.mdx | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/content/docs/cloudflare-one/connections/connect-networks/configure-tunnels/remote-management.mdx b/src/content/docs/cloudflare-one/connections/connect-networks/configure-tunnels/remote-management.mdx index 573f7469918373..1140ee78e95f48 100644 --- a/src/content/docs/cloudflare-one/connections/connect-networks/configure-tunnels/remote-management.mdx +++ b/src/content/docs/cloudflare-one/connections/connect-networks/configure-tunnels/remote-management.mdx @@ -17,10 +17,10 @@ You can modify the Cloudflare Tunnel service with one or more [general-purpose t On Linux, Cloudflare Tunnel installs itself as a system service using `systemctl`. By default, the service will be named `cloudflared.service`. To configure your tunnel on Linux: -1. Open `cloudflared.service`. +1. Create `cloudflared.service`. ```sh - sudo systemctl edit --full cloudflared.service + sudo systemctl edit --force --full cloudflared.service ``` 2. Modify the `cloudflared tunnel run` command with the desired configuration flag. For example, @@ -33,9 +33,29 @@ On Linux, Cloudflare Tunnel installs itself as a system service using `systemctl [Service] TimeoutStartSec=0 Type=notify - ExecStart=/usr/local/bin/cloudflared tunnel --loglevel debug --logfile run --token + ExecStart=/usr/local/bin/cloudflared tunnel --loglevel debug --logfile /var/log/cloudflared/cloudflared.log run --token Restart=on-failure RestartSec=5s + + [Install] + WantedBy=multi-user.target + ``` + +3. Enable `cloudflared.service` to start when system starts. For example, + + ```sh + # restart systemctl + sudo systemctl daemon-reload + + # enable and start service + sudo systemctl enable cloudflared + sudo systemctl start cloudflared + + # check service status + sudo systemctl status cloudflared + + # view system logs if any issues + journalctl -u cloudflared ``` From 25d138a9a21de092e9ef08d3a2cf3207bf60bc0e Mon Sep 17 00:00:00 2001 From: ranbel <101146722+ranbel@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:22:53 -0400 Subject: [PATCH 2/2] Update remote-management.mdx --- .../configure-tunnels/remote-management.mdx | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/content/docs/cloudflare-one/connections/connect-networks/configure-tunnels/remote-management.mdx b/src/content/docs/cloudflare-one/connections/connect-networks/configure-tunnels/remote-management.mdx index 1140ee78e95f48..41635b60684e43 100644 --- a/src/content/docs/cloudflare-one/connections/connect-networks/configure-tunnels/remote-management.mdx +++ b/src/content/docs/cloudflare-one/connections/connect-networks/configure-tunnels/remote-management.mdx @@ -17,10 +17,10 @@ You can modify the Cloudflare Tunnel service with one or more [general-purpose t On Linux, Cloudflare Tunnel installs itself as a system service using `systemctl`. By default, the service will be named `cloudflared.service`. To configure your tunnel on Linux: -1. Create `cloudflared.service`. +1. Open `cloudflared.service`. ```sh - sudo systemctl edit --force --full cloudflared.service + sudo systemctl edit --full cloudflared.service ``` 2. Modify the `cloudflared tunnel run` command with the desired configuration flag. For example, @@ -41,23 +41,29 @@ On Linux, Cloudflare Tunnel installs itself as a system service using `systemctl WantedBy=multi-user.target ``` -3. Enable `cloudflared.service` to start when system starts. For example, +3. Restart `cloudflared.service`: ```sh - # restart systemctl - sudo systemctl daemon-reload - - # enable and start service - sudo systemctl enable cloudflared - sudo systemctl start cloudflared - - # check service status - sudo systemctl status cloudflared - - # view system logs if any issues - journalctl -u cloudflared + sudo systemctl restart cloudflared ``` +4. To verify the new configuration, check the service status: + + ```sh + sudo systemctl status cloudflared + ``` + ```sh output + ● cloudflared.service - cloudflared + Loaded: loaded (/etc/systemd/system/cloudflared.service; enabled; preset: enabled) + Active: active (running) since Wed 2024-10-09 20:02:59 UTC; 2s ago + Main PID: 2157 (cloudflared) + Tasks: 8 (limit: 1136) + Memory: 16.3M + CPU: 136ms + CGroup: /system.slice/cloudflared.service + └─2157 /usr/bin/cloudflared tunnel --loglevel debug --logfile /var/log/cloudflared/cloudflared.log run --token eyJhIjoi... + ``` + On macOS, Cloudflare Tunnel installs itself as a launch agent using `launchctl`. By default, the agent will be called `com.cloudflare.cloudflared`. To configure your tunnel on macOS: