LoginSignup
4
2

cloudflared の自動アップデート

Last updated at Posted at 2023-05-17

Windows

自動アップデートには対応していません。

Instances of cloudflared do not automatically update on Windows. You will need to perform manual updates.

実際にサービスを起動してログを見ると以下のメッセージが確認できます。

cloudflared will not automatically update on Windows systems.

{"level":"info","tunnelID":"xxx","time":"2023-04-10T15:52:27Z","message":"Starting tunnel"}
{"level":"info","time":"2023-04-10T15:52:27Z","message":"Version 2023.3.1"}
{"level":"info","time":"2023-04-10T15:52:27Z","message":"GOOS: windows, GOVersion: go1.19, GoArch: amd64"}
{"level":"info","time":"2023-04-10T15:52:27Z","message":"Settings: map[logfile:C:\\log.txt loglevel:debug token:*****]"}
{"level":"info","time":"2023-04-10T15:52:27Z","message":"cloudflared will not automatically update on Windows systems."}

そのため、手動でのアップデートが必要です。

cloudflared.exe update --version 2023.5.0
net stop "Cloudflared" & net start "Cloudflared"

macOS

パッケージマネージャーからインストールした場合

パッケージマネージャーで管理されるべきです。

If you installed cloudflared with a package manager, you must update it using the same package manager.

パッケージマネージャーからインストールされたかどうかは以下のコマンドで確認できます。

brew list | grep cloudflared

アップデートは以下のコマンドで実施します。

brew upgrade cloudflared 

バイナリを直接インストールした場合

手動でのアップデートはもちろん可能です。

Looks for a new version on the official download server. If a new version exists, it updates the agent binary and quits. Otherwise, no action is performed. This command only works if cloudflared was installed from GitHub binaries or from source.

cloudflared update --version 2023.5.0

自動アップデートを行うには、サービスとして起動する必要があります。

cloudflared will not automatically update when run from the shell. To enable auto-updates, run cloudflared as a service: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/run-tunnel/as-a-service/

sudo cloudflared service install eyJhxxx

以下のサービスログの中で、自動アップデートが行われていることが確認できます。

/Library/Logs/com.cloudflare.cloudflared.err.log
2023-05-17T15:23:41Z INF Version 2023.4.1
...
2023-05-17T15:23:41Z INF Autoupdate frequency is set autoupdateFreq=86400000
...
2023-05-17T15:23:44Z INF cloudflared has been updated version=2023.5.0
2023-05-17T15:23:44Z ERR Initiating shutdown error="cloudflared has been updated to version 2023.5.0"
...
2023-05-17T15:23:44Z INF Tunnel server stopped
cloudflared has been updated to version 2023.5.0
...
2023-05-17T15:23:47Z INF Version 2023.5.0

Linux

パッケージマネージャーからインストールした場合

パッケージマネージャーで管理されるべきです。

On Linux, you can check if cloudflared is owned by a package manager by running ls -la /usr/local/etc/cloudflared/ and looking for .installedFromPackageManager in the output.

パッケージマネージャーからインストールされたかどうかは以下のコマンドで確認できます。

.installedFromPackageManager があれば、パッケージマネージャーによる管理です。

ls -la /usr/local/etc/cloudflared/

アップデートは以下のコマンド等で実施します。

sudo yum update cloudflared 

バイナリを直接インストールした場合

手動でのアップデートはもちろん可能です。

Looks for a new version on the official download server. If a new version exists, it updates the agent binary and quits. Otherwise, no action is performed. This command only works if cloudflared was installed from GitHub binaries or from source.

cloudflared update --version 2023.5.0

自動アップデートを行うには、サービスとして起動する必要があります。

cloudflared will not automatically update when run from the shell. To enable auto-updates, run cloudflared as a service: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/run-tunnel/as-a-service/

sudo cloudflared service install eyJhxxx

以下のサービスログの中で、自動アップデートが行われていることが確認できます。

sudo journalctl -u cloudflared.service
Mar 02 10:17:37 tokyo cloudflared[660801]: 2023-03-02T10:17:37Z INF Version 2023.3.0
...
Mar 02 10:17:37 tokyo cloudflared[660801]: 2023-03-02T10:17:37Z INF Autoupdate frequency is set autoupdateFreq=300000
...
Mar 13 15:12:45 tokyo cloudflared[660801]: 2023-03-13T15:12:45Z INF cloudflared has been updated version=2023.3.1
Mar 13 15:12:45 tokyo cloudflared[660801]: 2023-03-13T15:12:45Z ERR Initiating shutdown error="cloudflared has been updated to version 2023.3.1"
...
Mar 13 15:12:45 tokyo cloudflared[660801]: 2023-03-13T15:12:45Z INF Tunnel server stopped
Mar 13 15:12:45 tokyo cloudflared[660801]: cloudflared has been updated to version 2023.3.1
...
Mar 13 15:12:51 tokyo cloudflared[723902]: 2023-03-13T15:12:51Z INF Version 2023.3.1

自動アップデート頻度

cloudflared サービス起動時にアップデートがないかのチェックが走りますが、その後も定期的にチェックされます。

autoupdate-freq パラメータ(デフォルト 86400000 ミリ秒 = 86400 秒 = 24 時間)を 任意の値に設定できます。

--autoupdate-freq 5m と arguments を追加した場合、以下のメッセージが確認できます。

May 01 22:03:20 tokyo cloudflared[802015]: 2023-05-01T22:03:20Z INF Autoupdate frequency is set autoupdateFreq=300000

自動アップデートさせたくない場合

no-autoupdate パラメータ(デフォルト false)を true に設定できます。

先ほどの Autoupdate frequency is set のメッセージは表示されず、
あくまで以下の警告メッセージに留まります。

May 18 00:32:34 kyouhei-tokyo-c cloudflared[828468]: 2023-05-18T00:32:34Z WRN Your version 2023.4.1 is outdated. We recommend upgrading it to 2023.5.0

もしくは update.argotunnel.com 443 TCP (HTTPS) の通信を閉じておくことも可能かと思います。

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2