Skip to content

Latest commit

 

History

History
72 lines (50 loc) · 2.65 KB

README_DOCKER.md

File metadata and controls

72 lines (50 loc) · 2.65 KB

Installation

Following decribes how to prepare the docker images we later run to execute backups.

One image will be there to analyze existing backups of repos and the other image will be there for executing a full backup into the local clonedbackups host folder.

Configuration for the script

The configuration file bbbackup_sample.cfg is a blueprint for the bbbackup.cfg to be used to run the script inside the container. All necessary config values need to be provided in the bbbackup.cfg before the docker image of the container is build.

bbbackup.cfg

[authorization]
; enter which auth method to use 'oauth' or 'uidpwd'
auth_method = oauth

[bitbucket_oauth]
; enter oauth 2.0 credentials here
key_or_id = <value_here>
secret = <value_here>
app_name = <value_here>

[bitbucket_account]
; enter your credentials for bitbucket here, use same for user and team if you want user
userid = <value_here>
password = 
teamname = <value_here>

[slack]
; enter api-token and the channel name where to post messages to here
api_token = <value_here>
channel_to_post = #backupstatus

[backup]
; enter backup related parameters here, i.e. filepath to directory where to store backups
filepath = /clonedbackups/
max_retries = 3
max_fails = 1
min_free_space = 50
amount_of_days_to_store = 7

[log]
; enter log related options as true and false
logging_on = True
colorized_logging_on = True

IMPORTANT: The value for filepath = /clonedbackups/ should correspond to the mapped host-directory-name used later when running the container. The container expects this directory to be located at the WORKDIR from which you run the container.

Creating the docker images

docker build -f Dockerfile.analyze -t bbbackup:analyze .

docker build -f Dockerfile.backup -t bbbackup:backup .

The Dockerfile.<ending> pulls in

  • bbbackup.cfg
  • bbbackup.py and
  • requirements.txt

all of those are needed to setup the necessary python environment.

Running the containers

Enter the following to run the containers, the $PWD inserts the current path context, this is a workaround, because docker is not able to work with the . dot correctly)

docker run -v $PWD/clonedbackups/:/clonedbackups bbbackup:analyze

docker run -v $PWD/clonedbackups/:/clonedbackups bbbackup:backup

The -v parameter mounts a volume (or better maps a shared directory) from the host-machine into the container. So whenever the python script running in the container writes something to clonedbackups this will be written in the directory existing on the host-machine. This way the files written, i.e. the backups, won't be lost when the container stops running.