Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'service install' on Mac OS #1335

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

povilasb
Copy link

@povilasb povilasb commented Oct 8, 2024

cloudflared service install is not working as documented at #327

When cloudflared is started with Mac OS launch agent it errors with:

Use `cloudflared tunnel run` to start tunnel {UUID}
Use `cloudflared tunnel run` to start tunnel {UUID}
Use `cloudflared tunnel run` to start tunnel {UUID}

A fix is suggested at #327 (comment)
And acknowledged by https://community.cloudflare.com/t/tunnel-error-on-macos-when-installed-as-service/339543/4

However, collective costs keep compounding.

The fix seems simple at least for my use case where only a single tunnel is used. But Not sure if there's other negative side effects.
cloudflared service install produces such .plist

cat ~/Library/LaunchAgents/com.cloudflare.cloudflared.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
        <dict>
                <key>Label</key>
                <string>com.cloudflare.cloudflared</string>
                <key>ProgramArguments</key>
                <array>
                        <string>cloudflared</string>
                        <string>tunnel</string>
                        <string>run</string>
                </array>
                <key>RunAtLoad</key>
                <true/>
                <key>StandardOutPath</key>
                <string>/Users/povilas/Library/Logs/com.cloudflare.cloudflared.out.log</string>
                <key>StandardErrorPath</key>
                <string>/Users/povilas/Library/Logs/com.cloudflare.cloudflared.err.log</string>
                <key>KeepAlive</key>
                <dict>
                        <key>SuccessfulExit</key>
                        <false/>
                </dict>
                <key>ThrottleInterval</key>
                <integer>5</integer>
        </dict>
</plist>

as opposed to

                <array>
                        <string>cloudflared</string>
                </array>

Without this when cloudflared is started with Mac OS launch agent it errors with:
```
Use `cloudflared tunnel run` to start tunnel {UUID}
Use `cloudflared tunnel run` to start tunnel {UUID}
Use `cloudflared tunnel run` to start tunnel {UUID}
```

This patch is suggested by cloudflare#327 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant