Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

プログラミングなしでJira CloudとConfluence Cloudのサイトバックアップを自動化する

今回は追加の費用負担なく Atlassian Cloud のJiraとConfluenceのバックアップを自動取得する方法を紹介します。

 

■ (0) 前提条件

この方法では Jira Automation の機能を利用するため、最低でも1つのJira製品を契約しておく必要があります。言い換えるとConfluenceだけを使っている場合は適用できません。

また、後述の手順はバックアップのみを実行してファイルのダウンロードは行わない割り切った方針になっています。ついては管理者がバックアップを何も行っていない状況からの第一歩としてご検討いただけますとさいわいです。

本記事で紹介されている方法は実績のある方法となりますが、アトラシアン技術サポートの サポート対象外 の設定である点について、あらかじめご了承ください。

 

■ (1) 下準備

バックアップ実行のリクエストを送信するにあたって必要となる認証情報を用意します。

  1. サイト管理者のアカウントにて API token を発行する
  2. オンラインツール(Base64 Encode など)で "$EMAIL_ADDRESS:$API_TOKEN" の形式をエンコードする
    • 例: base64encode.png
    • ターミナルを使いたい場合は後述の (1-2) を参考のこと

 

(1-2) 認証情報のエンコーディング

$ echo -n "site-admin@example.com:SAMPLE2019" | base64
c2l0ZS1hZG1pbkBleGFtcGxlLmNvbTpTQU1QTEUyMDE5

 

■ (2) Confluence向けサイトバックアップのルールを作成する

どちらの製品から設定を始めても差し支えありませんが、ここでは Confluence Cloud から設定していきます。

  1. スケジュールを設定する
    • Cron expression にて (2-1) を指定する。
    • When rule executes... には "simply run the conditions and actions without providing issues" を選択する。
    • schedule-cron.png
  2. アクション Send web request を追加する
    • Webhook URL{{baseUrl}}/wiki/rest/obm/1.0/runbackup
    • Headers:
      • Authorization: Basic <(1-2) で出力した認証情報>
    • Webhook body: (2-2)
    • action-webhook.png
  3. アクション Log action を追加する
    • 成功時のレスポンスボディを audit log に出力するよう Log message に {{webhookResponse}} を指定する。
  4. 名前をつけて設定を保存して Run rule で試運転を行う
    • A4J の Audit log にて実行ログを確認できる。 
    • audit-log.png
  5. バックアップファイルが完成していることを確認する
    • このファイルは7日間保存されるため、ユーザーの操作などによりデータを喪失してしまった場合にダウンロードして復旧に利用できる。
    • confluence-backup.png

 

(2-1) Cron expression

方針: バックアップは最低48時間超の間隔を開けなければならないので、月・木の週2回の実行とする。また メンテナンス時間 はサービス利用ができなくなるため 19:00 (UTC) を指定する。

0 0 19 ? * 1,4

(2-2) Webhook body

{"cbAttachments":"true" }

 

■ (3) Jira向けサイトバックアップのルールを作成する

続いて Jira Cloud 向けの設定を投入します。ほとんど Confluence と同じなので差分のみを記載します。

  1. スケジュールを設定するのは同じ
  2. アクション Send web request を追加する
    1. Webhook URL: {{baseUrl}}/rest/backup/1/export/runbackup
    2. Webhook body: (3-1)
  3. 残りの手順は同じ
    • バックアップファイル: jira-backup.png

 

(3-1) Cron expression

方針: 同様に、月・木の週2回の実行とする。

0 0 19 ? * 1,4

(3-2) Webhook body

{"cbAttachments":"true", "exportToCloud":"true"}

 

■ (4) 制約事項

今回のアプローチには、いくつか留意点があります。

  • プランによってはルールの実行回数制限があるため、他のルールで枠を使い切ってしまった場合はバックアップが走らなくなります。ルール数が多い場合は Premiumプラン の導入をおすすめします。
  • ファイルを手元にダウンロードしていないので、保存期間の7日間を過ぎてしまった場合はバックアップが失われます。バックアップファイルを手元に残したい場合は Atlassian Cloud 製品のバックアップ取得を自動化するには にて紹介されているbashスクリプトを使ったバックアップ自動化をご検討ください。
  • 誤った操作などによりデータを喪失してしまった後にバックアップが行われた場合、データを喪失した状態のバックアップが取得されてしまいます。

 

2 comments

Lenin Raj
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jan 14, 2020

Very detailed post, nice work @K_ Yamamoto 

K_ Yamamoto
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jan 15, 2020

@Lenin Raj - Thanks, now the English version is also available at 

Automate online site-backups for Jira and Confluence without programming.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events