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 Jira Automation.

 

(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 Jira Automation feature which is only available for Jira.
  • 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, you always need to have credentials when you do something important:

  1. Issue an API token of site-admins account at https://id.atlassian.com/manage/api-tokens
  2. Encode your credentials "$EMAIL_ADDRESS:$API_TOKENwith base64 as (1-2) Example 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 URL{{baseUrl}}/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 URL{{baseUrl}}/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:

  • Jira has an upper bound on rule executions per subscription plan. That means you will not get a backup if exceeded the limit. So consider upgrading to Premium, especially if you already have a respectable number of existing global automation 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.

 

5 comments

Great job, @i05!!! 

very useful information indeed. Thanks!

is it possible to create a backup and download the file automatically via a Windows Server ?

Thanks

i05 Atlassian Team Mar 12, 2020

 

Yes, it is possible. Refer to atlassianlabs/automatic-cloud-backup and try the PowerScript or Python script.

thx, i will try it :-)

Comment

Log in or Sign up to comment

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