-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kelsey Hightower
committed
Jul 11, 2013
1 parent
b11505b
commit 2cb395d
Showing
6 changed files
with
136 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name 'jirabackup' | ||
version '0.0.1' | ||
source 'https://github.com/puppetlabs/jira-backup' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Jira Backup | ||
|
||
A simple shell script to backup Jira instances according to Atlassian best practices outlined in [Backing Up Data](https://confluence.atlassian.com/display/JIRA052/Backing+Up+Data). | ||
|
||
## Features | ||
|
||
* Backup Jira attachments | ||
* Backup Jira database using mysqldump | ||
|
||
## Configuration | ||
|
||
The jira-backup script requires the following configuration file: | ||
|
||
/etc/jira-backup.conf | ||
|
||
If the configuration file is missing you will get the following error: | ||
|
||
root@jira:~# jira-backup | ||
Error: /etc/jira-backup.conf missing | ||
|
||
root@jira:~# echo $? | ||
1 | ||
|
||
An example configuration can be found in the configs directory. | ||
|
||
## Installation | ||
|
||
I'm in the process of creating a debian package for `jira-backup`, until then: | ||
|
||
cp jira-backup /usr/local/bin/jira-backup | ||
chmod +x /usr/local/bin/jira-backup | ||
|
||
Then create the `/etc/jira-backup.conf` file. | ||
|
||
vim /etc/jira-backup.conf | ||
|
||
BACKUP_DIR='/var/atlassian/backups/jira' | ||
|
||
# Attachments | ||
ATTACHMENTS_PATH='/var/atlassian/application-data/jira/data/attachments' | ||
|
||
# Database | ||
DB_NAME='jira' | ||
DB_HOST='database hostname' | ||
DB_USER='jira' | ||
DB_PASS='databae password' | ||
|
||
|
||
## Usage | ||
|
||
root@jira:~# /usr/local/bin/jira-backup | ||
Backing up Jira | ||
Backing up Jira attachments | ||
/bin/tar: Removing leading `/' from member names | ||
Created /var/atlassian/backups/jira/jira-attachments-2013-07-11-09-50.tar | ||
Dumping Jira database | ||
Created /var/atlassian/backups/jira/jira-database-dump-2013-07-11-09-50.sql | ||
|
||
All backups end up under `/var/atlassian/backups`; this can be changed by setting the BACKUP_DIR in `/etc/jira-backup.conf` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Class: jirabackup | ||
# | ||
# This class installs and configures the jira-backup utility | ||
# | ||
# Parameters: | ||
# | ||
# db_host: (default '') | ||
# Set the mysql database host to connect to | ||
# | ||
# db_pass: (default '') | ||
# Set the mysql database password | ||
# | ||
# db_user: (default 'jira') | ||
# Set the mysql database user | ||
# | ||
# db_name: (default 'jira') | ||
# Set the mysql database name | ||
# | ||
# backup_dir: (default '/var/atlassian/backups/jira') | ||
# Set the target backup directory for Jira attachments and mysql dumps | ||
# | ||
# attachments_path: (default '/var/atlassian/application-data/jira/data/attachments') | ||
# Set the path to the Jira attachments | ||
# | ||
# Actions: | ||
# - Install jira-backup utility | ||
# - Manage the jira-backup configuration settings | ||
# | ||
# Requires: | ||
# | ||
# Sample Usage: | ||
# | ||
# class { 'jirabackup': | ||
# db_host => 'mysql.example.com', | ||
# db_pass => 'database password', | ||
# db_user => 'jira', | ||
# db_name => 'jira', | ||
# backup_dir => '/path/to/backup/output/dir', | ||
# attachments_path => '/path/to/jira/attachments' | ||
# } | ||
# | ||
class jirabackup ( | ||
$db_host, | ||
$db_pass, | ||
$db_user = 'jira', | ||
$db_name = 'jira', | ||
$backup_dir = '/var/atlassian/backups/jira', | ||
$attachments_path = '/var/atlassian/application-data/jira/data/attachments', | ||
){ | ||
package { 'jira-backup': | ||
ensure => latest, | ||
} | ||
|
||
file { '/etc/jira-backup.conf' | ||
ensure => present, | ||
group => 'root', | ||
owner => 'root', | ||
mode => '0600', | ||
content => template("jirabackup/jira-backup.conf.erb"), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
BACKUP_DIR=<%= @backup_dir %> | ||
|
||
# Attachments | ||
ATTACHMENTS_PATH=<%= @attachments_path %> | ||
|
||
# Database | ||
DB_NAME=<%= @db_name %> | ||
DB_HOST=<%= @db_host %> | ||
DB_USER=<%= @db_user %> | ||
DB_PASS=<%= @db_pass %> |