Skip to content

Commit

Permalink
Merge branch 'hotfix-0.1.7' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandGouny committed Sep 2, 2016
2 parents 538aeb8 + 2848645 commit ae4e47d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 55 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.1.7
- Upgrade baseimage: light-baseimage:0.2.5

## 0.1.6
- Upgrade baseimage: light-baseimage:0.2.4

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME = osixia/backup-manager
VERSION = 0.1.6
VERSION = 0.1.7

.PHONY: all build build-nocache test tag_latest release

Expand All @@ -15,7 +15,7 @@ test:
env NAME=$(NAME) VERSION=$(VERSION) bats test/test.bats

tag_latest:
docker tag -f $(NAME):$(VERSION) $(NAME):latest
docker tag $(NAME):$(VERSION) $(NAME):latest

release: build test tag_latest
@if ! docker images $(NAME) | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME) version $(VERSION) is not yet built. Please run 'make build'"; false; fi
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[hub]: https://hub.docker.com/r/osixia/backup-manager/

Latest release: 0.1.6 - Backup Manager 0.7.10.1 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/backup-manager/) 
Latest release: 0.1.7 - Backup Manager 0.7.10.1 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/backup-manager/) 

An image to run periodically backup-manager.

Expand All @@ -22,7 +22,7 @@ An image to run periodically backup-manager.
- [Link environment file](#link-environment-file)
- [Make your own image or extend this image](#make-your-own-image-or-extend-this-image)
- [Advanced User Guide](#advanced-user-guide)
- [Extend osixia/backup-manager:0.1.6 image](#extend-osixiabackup-manager016-image)
- [Extend osixia/backup-manager:0.1.7 image](#extend-osixiabackup-manager017-image)
- [Make your own backup-manager image](#make-your-own-backup-manager-image)
- [Tests](#tests)
- [Under the hood: osixia/light-baseimage](#under-the-hood-osixialight-baseimage)
Expand All @@ -31,7 +31,7 @@ An image to run periodically backup-manager.
## Quick start

# Run Backup Manager image
docker run --volume /host/data:/data-to-backup --detach osixia/backup-manager:0.1.6
docker run --volume /host/data:/data-to-backup --detach osixia/backup-manager:0.1.7

## Beginner Guide

Expand All @@ -50,7 +50,7 @@ but setting your own backup-manager.conf is possible. 2 options:

- Link your config file at run time to `/container/service/backup-manager/assets/backup-manager.conf` :

docker run --volume /data/my-backup-manager.conf:/container/service/backup-manager/assets/backup-manager.conf --detach osixia/backup-manager:0.1.6
docker run --volume /data/my-backup-manager.conf:/container/service/backup-manager/assets/backup-manager.conf --detach osixia/backup-manager:0.1.7

- Add your config file by extending or cloning this image, please refer to the [Advanced User Guide](#advanced-user-guide)

Expand All @@ -60,7 +60,7 @@ You may have some problems with mounted files on some systems. The startup scrip

To fix that run the container with `--copy-service` argument :

docker run [your options] osixia/backup-manager:0.1.6 --copy-service
docker run [your options] osixia/backup-manager:0.1.7 --copy-service

### Debug

Expand All @@ -69,11 +69,11 @@ Available levels are: `none`, `error`, `warning`, `info`, `debug` and `trace`.

Example command to run the container in `debug` mode:

docker run --detach osixia/backup-manager:0.1.6 --loglevel debug
docker run --detach osixia/backup-manager:0.1.7 --loglevel debug

See all command line options:

docker run osixia/backup-manager:0.1.6 --help
docker run osixia/backup-manager:0.1.7 --help

## Environment Variables

Expand All @@ -84,7 +84,7 @@ See how to [set your own environment variables](#set-your-own-environment-variab

- **BACKUP_MANAGER_TARBALL_DIRECTORIES**: Directories to backup: paths without spaces in their name. Defaults to `/data-to-backup /data-to-backup2`.

- **BACKUP_MANAGER_CRON_EXP**: Cron expression to schedule backup-manager execution. Defaults to `"0 4 * * *"`. Every days at 4am.
- **BACKUP_MANAGER_CRON_EXP**: Cron expression to schedule backup-manager execution. Defaults to `0 4 * * *`. Every days at 4am.

- **BACKUP_MANAGER_TTL**: Backup TTL in days. Defaults to `15`.

Expand Down Expand Up @@ -112,14 +112,14 @@ More help: https://raw.githubusercontent.com/sukria/Backup-Manager/master/doc/us
Environment variables can be set by adding the --env argument in the command line, for example:

docker run --env BACKUP_MANAGER_TARBALL_DIRECTORIES="/home/billy" \
--detach osixia/backup-manager:0.1.6
--detach osixia/backup-manager:0.1.7

#### Link environment file

For example if your environment file is in : /data/backup-manager/environment/my-env.yaml

docker run --volume /data/backup-manager/environment/my-env.yaml:/container/environment/01-custom/env.yaml \
--detach osixia/backup-manager:0.1.6
--detach osixia/backup-manager:0.1.7

Take care to link your environment file to `/container/environment/XX-somedir` (with XX < 99 so they will be processed before default environment files) and not directly to `/container/environment` because this directory contains predefined baseimage environment files to fix container environment (INITRD, LANG, LANGUAGE and LC_CTYPE).

Expand All @@ -129,13 +129,13 @@ This is the best solution if you have a private registry. Please refer to the [A

## Advanced User Guide

### Extend osixia/backup-manager:0.1.6 image
### Extend osixia/backup-manager:0.1.7 image

If you need to add your custom TLS certificate, bootstrap config or environment files the easiest way is to extends this image.

Dockerfile example:

FROM osixia/backup-manager:0.1.6
FROM osixia/backup-manager:0.1.7
MAINTAINER Your Name <[email protected]>

ADD environment /container/environment/01-custom
Expand All @@ -153,7 +153,7 @@ Clone this project :
Adapt Makefile, set your image NAME and VERSION, for example :

NAME = osixia/backup-manager
VERSION = 0.1.6
VERSION = 0.1.7

becomes :
NAME = billy-the-king/backup-manager
Expand Down
2 changes: 1 addition & 1 deletion image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Use osixia/light-baseimage
# sources: https://github.com/osixia/docker-light-baseimage
FROM osixia/light-baseimage:0.2.4
FROM osixia/light-baseimage:0.2.5
MAINTAINER Bertrand Gouny <[email protected]>

# Install Backup Manager, GNUPG for encryption and cron from baseimage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Directories to backup: paths without spaces in their name
BACKUP_MANAGER_TARBALL_DIRECTORIES: "/data-to-backup /data-to-backup2"
BACKUP_MANAGER_TARBALL_DIRECTORIES: /data-to-backup /data-to-backup2

# Run backup-manager at 4:00am
BACKUP_MANAGER_CRON_EXP: "0 4 * * *"
BACKUP_MANAGER_CRON_EXP: 0 4 * * *

# Delete backups that are over 15 days
BACKUP_MANAGER_TTL: 15
Expand Down
3 changes: 2 additions & 1 deletion image/service/backup-manager/assets/cronjobs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Backup OpenLDAP config
# Backup
{{ BACKUP_MANAGER_CRON_EXP }} root /usr/sbin/backup-manager 2>&1 | /usr/bin/logger -s -t backup-manager
# empty line
40 changes: 4 additions & 36 deletions test/test_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,10 @@ clear_container() {
remove_containers_by_cid $CONTAINER_ID
}

is_service_running() {
is_service_running_by_cid $CONTAINER_ID $1
wait_process() {
wait_process_by_cid $CONTAINER_ID $@
}

is_file_exists() {
is_file_exists_by_cid $CONTAINER_ID $1
}

wait_service() {
wait_service_by_cid $CONTAINER_ID $@
}


# generic functions
get_container_ip_by_cid() {
local IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $1)
Expand Down Expand Up @@ -78,30 +69,7 @@ clear_containers_by_cid() {
remove_containers_by_cid $@
}

is_service_running_by_cid() {
docker exec $1 ps cax | grep $2 > /dev/null
}

is_file_exists_by_cid() {
docker exec $1 cat $2 > /dev/null 2>&1
}

wait_service_by_cid() {

wait_process_by_cid() {
cid=$1

# first wait image init end
while ! is_file_exists_by_cid $cid /container/run/state/startup-done
do
sleep 0.5
done

for service in "${@:2}"
do
# wait service
while ! is_service_running_by_cid $cid $service
do
sleep 0.5
done
done
docker exec $cid /container/tool/wait-process ${@:2}
}

0 comments on commit ae4e47d

Please sign in to comment.