It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Automate online site-backups for Jira and Confluence without programming

Here I'll introduce a way to automate site-backups of Jira Cloud and Confluence Cloud with Automation for Jira (A4J).

 

(0) Why site-backup is important

Atlassian doesn't officially provide data rollback based on customer requests. So it's essential to take site-backup regularly. For example, the backup will help you when any of site data was lost by the user's operation. Refer to the following part in Data storage FAQ for more details:

Atlassian cloud sites don't support the use of backup data to roll back changes.

Let me clarify what's covered by the approach introduced in this article. It's good as a first step while there are some constraints, such as:

  • Prerequisite: You need to subscribe to at least one Jira family product; meaning it's unable to follow this instruction if you only with Confluence subscription as we'll utilize A4J which is only available for Jira Cloud.
  • Importantly, in this approach, we skip downloading the created site-backups to local machine simply because it's better than nothing. It is recommended for sure to download site-backups if you can. To do so, use the bash scripts listed below:

 

(1) Preparation

First things first, it's always needed to have credentials when you do something important. Before that, we are going to install the add-on app A4J:

  1. Install A4J to site as your requirement:
  2. Issue an API token of site-admins account at https://id.atlassian.com/manage/api-tokens
  3. Encode your credentials "$EMAIL_ADDRESS:$API_TOKENwith base64 as (1-2) below. Or go with any online tool like Base64 Encode. Make sure not to include a line break at the end.
    • base64encode.png

 

(1-2) Example - How to encode your API token

$ echo -n "site-admin@example.com:<YOUR_TOKEN_HERE>" | base64
c2l0ZS1hZG1pbkBleGFtcGxlLmNvbTo8WU9VUl9UT0tFTl9IRVJFPg==

 

(2) Create a rule for Confluence site-backup

Although you can start with either Jira or Confluence, we'll look into how to configure a rule for Confluence here for convenience.

  1. Set up the schedule
    • Add the content of (2-1) below to Cron expression
    • Select "simply run the conditions and actions without providing issues" for When rule executes
    • schedule-cron.png
  2. Add an action - Send web requests
    • Webhook URLhttps://<SITE_NAME>.atlassian.net/wiki/rest/obm/1.0/runbackup
    • Headers:
      • Authorization: Basic <The output we got from (1-2)>
    • Webhook body: refer to (2-2)
    • action-webhook.png
  3. Add another action - Log action
    1. To be able to keep tracking of what we got with the webhook request, specify {{webhookResponse}} in Log message
  4. Name the rule "Site backup - Confluence Cloud" and save the setting
  5. Do a test run with [Run rule] button
    • The log then will be available at Audit log
    • audit-log.png
  6. Check the download link
    • confluence-backup.png

 

 

(2-1) Cron expression

Each backup should be performed after 48 hours interval at least. We here are going to schedule the execution once per 3 days. Also make sure to avoid maintenance windows of your site. If your company sits in EST, specify 9am in UTC:

0 0 9 */3 * ?

 

(2-2) Webhook body

{"cbAttachments":"true" }

 

(3) Create a rule for Jira site-backup

I'll put the diff of settings as it's almost same with Confluence.

  1. Schedule - same
  2. Action - Send web request
    • Webhook URLhttps://<SITE_NAME>.atlassian.net/rest/backup/1/export/runbackup
    • Webhook body: refer to (3-1)
  3. Remaining procedures - same
    • jira-backup.png

 

(3-1) Webhook body

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

 

(4) Constraints

Other than noted above, there are several points you should be aware of:

  • The free version of A4J (called "Cloud Lite") has an upper bound on rule executions. That means you will not get a backup if exceeded the limit. So you probably want to go with the unlimited version (Automation for Jira), especially if you already have any other A4J rules.
  • The backup link will be available for 7 days. The link then will be replaced with the next one. That means you will only be able to retrieve the backup file until the next backup ends. So make sure to download the backup file as soon as you found any data loss; otherwise, the backup link will be replaced with the one taken after the data loss.

 

1 comment

Great job, @i05!!! 

Comment

Log in or Sign up to comment
Community showcase
Published in Jira

Keep your team in the loop with Team @mentions in Jira Software!

Hi everyone! My name is Jenny, a Product Manager at Atlassian. After launching Team @mentions in Confluence, we heard a lot of positive feedback from customers that they love how easy it is to @men...

211 views 4 11
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you