管理者およびモデレーターの皆様:このトピックは必要に応じて他の場所に移動したり、編集したりしてください。
これは、私が rclone をインストールし、Discourse を Dropbox にバックアップするためにすべてを設定した、詳細なステップバイステップの説明です。Google Drive ユーザーの場合も、これらのステップのほとんどが適用されるはずです。
私は、Christoph(@tophee)が提供した元の指示のいくつかに従いました。
私はまったくの専門家ではないため、それらは非常に限定的に見え、最終的には失敗したので、ChatGPT の助けを借りてすべてが機能するようになりました!私のような高度なユーザーではないかもしれない、そして途中で追加のサポートが必要な方のために、すべてをステップバイステップで文書化しました。
rclone をリモートでインストールし、Dropbox の準備をする
サーバーに SSH 接続します。
ssh root@xxx.xxx.xxx.xxx
サーバーに接続したら:
root@ServerNameHere:~#
rclone をインストールします。
sudo curl https://rclone.org/install.sh | sudo bash
成功したら、次を実行します。
sudo rclone config
次のように表示されたら:
2025/08/13 11:29:31 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q>
n と入力します。Enter キーを押します。
次に表示されるのは:
Enter name for new remote.
name>
dropbox_backup のような名前を付けます。Enter キーを押します。
赤と緑のリストが表示され(私の場合はそうでした)、そのオプションの 1 つが Dropbox です。各オプションには関連付けられた番号があります。私の場合は次のようになりました。
14 / Dropbox
\ (dropbox)
一番下にある Storage> の部分に、Dropbox の番号を追加します。私の場合は Storage>14 となりました。Enter キーを押します。
次に表示されるのは:
Option client_id.
OAuth Client Id.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_id>
Enter キーを押して空白のままにします。次に表示される場合も同様です。
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret>
次に表示されるのは:
Edit advanced config?
y) Yes
n) No (default)
y/n>
n と入力して Enter キーを押します。
次に表示されるのは:
Use web browser to automatically authenticate rclone with remote?
* Say Y if the machine running rclone has a web browser you can use
* Say N if running rclone on a (remote) machine without web browser access
If not sure try Y. If Y failed, try N.
y) Yes (default)
n) No
y/n>
n と入力して Enter キーを押します。
次に表示されるのは:
Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
rclone authorize "dropbox"
Then paste the result.
Enter a value.
config_token>
…
停止!
rclone をローカルでインストールし、Dropbox を認証する
お使いのコンピューターに rclone をインストールします。私の場合は、前のプロセスに干渉しないように Mac で新しいターミナルウィンドウを開きました。Dropbox トークンを取得した後、続行する必要があるためです。
まず、Mac にインストールされているかどうかを確認しました。
rclone version
インストールされていなかったので、インストールする必要がありました。私の場合、MacPorts を使用しています。Homebrew は Catalina とうまく連携しないためです。お好みのオプションを選択してください。
Homebrew コマンド:
brew install rclone
MacPorts コマンド:
sudo port install rclone
インストールが完了したら、同じウィンドウで次を実行します。
rclone authorize "dropbox"
この dropbox という名前は、先ほど選択した dropbox_backup という名前とは関係ありません。
それを実行すると、ブラウザで認証ウィンドウが開きます。
開かない場合は、この URL をブラウザに貼り付けてください:http://127.0.0.1:53682/auth(この指示 によると)。
Dropbox にログインします。「許可」ボタンをクリックします。すべてがうまくいけば、「成功!」というメッセージが表示されます。
Success!
All done. Please go back to rclone.
そのウィンドウを閉じます。
Dropbox のセットアップを完了する
ターミナルに戻ると、長いトークンが表示されます(非常に長くなりますが、ここでは短縮しています)。
{"access_token":"sl.u.AF5VJTs.................ZvNhniOToyQG","token_type":"bearer","refresh_token":"jygyhExsHRgAAAAAAAAAAfeHd8D0l5jzLvuiZ1onH2nXP2YeC2ycrbm5eQ5Y3uc6","expiry":"2025-08-13T16:58:41.072138+01:00","expires_in":14400}
開いている { から閉じている } まで、波括弧自体を含めてすべてをコピーし、別のウィンドウに貼り付けます。
Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
rclone authorize "dropbox"
Then paste the result.
Enter a value.
config_token> PASTE_TOKEN_HERE
Enter キーを押します。
すべてが成功した場合、次のようなものが表示されます。
Configuration complete.
Options:
- type: dropbox
- token: {"access_token":"sl.u.AF5VJTs7..........ToyQG","token_type":"bearer","refresh_token":"jygyhExsHRgAAAAAAAAAAfeHd8D0l5jzLvuiZ1onH2nXP2YeC2ycrbm5eQ5Y3uc6","expiry":"2025-08-13T16:58:41.072138+01:00","expires_in":14400}
Keep this "dropbox_backup" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d>
y を選択して保持します。これにより、リモートがサーバーに dropbox_backup として保存され、rclone コマンドで使用できるようになります。Enter キーを押します。
次に表示されるのは:
Current remotes:
Name Type
==== ====
dropbox_backup dropbox
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q>
q と入力して設定を終了します。これで dropbox_backup リモートが使用可能になりました。Enter キーを押します。
まだ root@ の状態で、rclone lsd dropbox_backup: を実行します。
これにより、Dropbox のすべてのトップレベルディレクトリが一覧表示され、接続が機能していることを確認できます。
バックアップ
手動
手動でバックアップするには、典型的なセットアップ(2 コンテナセットアップではない)を想定して、次を実行します。
sudo rclone copy /var/discourse/shared/standalone/backups/default --exclude tmp/ dropbox_backup:backups
/var/discourse/shared/standalone/backups/default→ サーバー上のソースフォルダ(2025 年 8 月現在、典型的なセットアップではこのパスが正確であることを確認しています。2 コンテナセットアップではありません)。--exclude tmp/→ 一時ファイルをスキップします。dropbox_backup:backups→ リモート名(dropbox_backup)と Dropbox 内のフォルダ(backups)。
これにより、すべてのバックアップファイル(tmp/ を除く)が Dropbox の backups という名前のフォルダに、以前に選択した名前 dropbox_backup を使用してアップロードされます。
スペースを含むフォルダ(例:Discourse Backups)が必要な場合は、代わりに次を実行します。
sudo rclone copy /var/discourse/shared/standalone/backups/default --exclude tmp/ "dropbox_backup:Discourse Backups"
すべてが計画どおりに進んだ場合、Dropbox に Discourse Backups フォルダ(または選択した名前)が表示され、すべてのバックアップファイルが含まれています。
ここまで来たら、混乱を避けるために、コンピューターに rclone をインストールするために使用した 2 番目のターミナルウィンドウを閉じます。
Cron ジョブ
次に、このプロセスを自動化するための cron ジョブを作成します。
crontab -e
次のように表示されます。
no crontab for root - using an empty one
Select an editor. To change later, run select-editor again.
1. /bin/nano <---- easiest
2. /usr/bin/vim.basic
3. /usr/bin/vim.tiny
4. /bin/ed
Choose 1-4 [1]:
1 を選択します。Enter キーを押します。
次のようなものが表示されます。
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
すべてが終わったところで、cron ジョブを追加します。毎日午後 6 時にバックアップをコピーするには、次を追加します。
0 18 * * * rclone copy /var/discourse/shared/standalone/backups/default --exclude tmp/ "dropbox_backup:Discourse Backups"
したがって、「リスト」は次で終わります。
(INITIAL TEXT HERE)
# m h dom mon dow command
0 18 * * * rclone copy /var/discourse/shared/standalone/backups/default --exclude tmp/ "dropbox_backup:Discourse Backups"
Ctrl+X を押します。ウィンドウの下部で保存するかどうか尋ねられます。Y を押してから Enter キーを押します。
完了です!
必要に応じて cron ジョブをより頻繁に実行することもできます。新しいファイルのみがコピーされるためです。
copy オプションを使用すると、サーバー上のバックアップが削除されても、Dropbox にさらに多くのバックアップが追加されることに注意してください。サーバー上にあるものだけを保持したい場合は、copy の代わりに sync を使用してください。