I wanted to implement the DIY backup method for my bitbucket server for additional redundancy. Though I feel like the black sheep as I chose to go with mysql as my database format where it seems everyone else is using Postgres. Has anyone else successfully got this setup on their server?
I have most of the variables set up, but I don't see anything specific for mysql database users, or backup location. Could I just follow the example on Atlassian's page and omit the Postgres stuff specifically?
https://confluence.atlassian.com/bitbucketserver/using-bitbucket-server-diy-backup-776640056.html
I've made a little headway, but I'm getting this error when I run the script:
bitbucket.diy-backup.sh:0 -> main][jira-test] INFO: Preparing for backup[database-mysql.sh:48 -> prepare_backup_db][jira-test] INFO: Prepared backup of DB bitbucketdb in /mnt/bitbackup/bitbucket-backup/bitbucket-db/[common.sh:52 -> lock_bitbucket][jira-test] ERROR: Unable to lock Bitbucket for maintenance. POST to 'http://bitbucket-test:7990/mvc/maintenance/lock' returned ''Stack trace:[./common.sh:52 -> lock_bitbucket][./bitbucket.diy-backup.sh:0 -> main]
bitbucket.diy-backup.sh:0 -> main][jira-test] INFO: Preparing for backup[database-mysql.sh:48 -> prepare_backup_db][jira-test] INFO: Prepared backup of DB bitbucketdb in /mnt/bitbackup/bitbucket-backup/bitbucket-db/[common.sh:52 -> lock_bitbucket][jira-test] ERROR: Unable to lock Bitbucket for maintenance. POST to 'http://bitbucket-test:7990/mvc/maintenance/lock' returned ''
Stack trace:[./common.sh:52 -> lock_bitbucket][./bitbucket.diy-backup.sh:0 -> main]
I had to modify the curl option to include --noproxy for my bitbucket server as I'm proxying the port. I have also tested that curl works with the options below. Still not sure what I may need to change, but I'll keep digging and update this thread.
#!/bin/bashCURL_OPTIONS="-L -s -f --noproxy bitbucket-test"INSTANCE_NAME=bitbucketBITBUCKET_URL=http://bitbucket-test:7990BITBUCKET_HOME=/var/atlassian/bitbucket-home/BITBUCKET_UID=atlbitbucketBITBUCKET_GID=atlbitbucketBACKUP_HOME_TYPE=rsyncBACKUP_DATABASE_TYPE=mysqlBACKUP_ARCHIVE_TYPE=tarBITBUCKET_BACKUP_USER=rootBITBUCKET_BACKUP_PASS=passwordBITBUCKET_BACKUP_EXCLUDE_REPOS=()BITBUCKET_DB=bitbucketdbMYSQL_HOST=localhostMYSQL_USERNAME=bitbucketdbuserMYSQL_PASSWORD=passwordMYSQL_PORT=3306# Make use of PostgreSQL 9.3+ options if available#psql_version="$(psql --version | awk '{print $3}')" #psql_majorminor="$(printf "%d%03d" $(echo "${psql_version}" | tr "." "\n" | head -n 2))" #if [[ ${psql_majorminor} -ge 9003 ]]; then # PG_PARALLEL="-j 5" # PG_SNAPSHOT_OPT="--no-synchronized-snapshots" #fi BITBUCKET_BACKUP_ROOT=/mnt/bitbackup/bitbucket-backupBITBUCKET_BACKUP_DB=${BITBUCKET_BACKUP_ROOT}/bitbucket-db/BITBUCKET_BACKUP_HOME=${BITBUCKET_BACKUP_ROOT}/bitbucket-home/BITBUCKET_BACKUP_ARCHIVE_ROOT=${BITBUCKET_BACKUP_ROOT}/bitbucket-backup-archives# Used by the scripts for verbose logging. If not true only errors will be shown.BITBUCKET_VERBOSE_BACKUP=TRUE
It would appear that I needed to use a user account that has administrative access to bitbucket. Here is the variable config that I am using currently.
#!/bin/bashCURL_OPTIONS="-L -s -f "INSTANCE_NAME=bitbucketBITBUCKET_URL=http://bitbucket-test.domain.comBITBUCKET_HOME=/var/atlassian/bitbucket-home/BITBUCKET_UID=atlbitbucketBITBUCKET_GID=atlbitbucketBACKUP_HOME_TYPE=rsyncBACKUP_DATABASE_TYPE=mysqlBACKUP_ARCHIVE_TYPE=tarBITBUCKET_BACKUP_USER=bitbucketUserBITBUCKET_BACKUP_PASS=passW0rdBITBUCKET_BACKUP_EXCLUDE_REPOS=()BITBUCKET_DB=bitbucketdbMYSQL_HOST=localhostMYSQL_USERNAME=bitbucketdbuserMYSQL_PASSWORD=pasw0rdMYSQL_PORT=3306# Make use of PostgreSQL 9.3+ options if available#psql_version="$(psql --version | awk '{print $3}')" #psql_majorminor="$(printf "%d%03d" $(echo "${psql_version}" | tr "." "\n" | head -n 2))" #if [[ ${psql_majorminor} -ge 9003 ]]; then # PG_PARALLEL="-j 5" # PG_SNAPSHOT_OPT="--no-synchronized-snapshots" #fi BITBUCKET_BACKUP_ROOT=/mnt/bitbackup/bitbucket-backupBITBUCKET_BACKUP_DB=${BITBUCKET_BACKUP_ROOT}/bitbucket-db/BITBUCKET_BACKUP_HOME=${BITBUCKET_BACKUP_ROOT}/bitbucket-home/BITBUCKET_BACKUP_ARCHIVE_ROOT=${BITBUCKET_BACKUP_ROOT}/bitbucket-backup-archives# Used by the scripts for verbose logging. If not true only errors will be shown.BITBUCKET_VERBOSE_BACKUP=TRUE
It looks like you're new here. Sign in or register to get started.