mirror of
https://github.com/ZettaIO/restic-compose-backup.git
synced 2025-10-10 04:10:57 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
758c3075f1 | ||
|
9cad6a5c71 | ||
|
4ebe16af14 | ||
|
fd87ddc388 |
@@ -22,7 +22,7 @@ copyright = '2019, Zetta.IO Technology AS'
|
||||
author = 'Zetta.IO Technology AS'
|
||||
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = '0.3.2'
|
||||
release = '0.3.3'
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
||||
|
@@ -14,8 +14,8 @@ main image as well.
|
||||
|
||||
```bash
|
||||
docker build src --tag zettaio/restic-compose-backup:0.3
|
||||
docker build src --tag zettaio/restic-compose-backup:0.3.2
|
||||
docker build src --tag zettaio/restic-compose-backup:0.3.3
|
||||
|
||||
docker push zettaio/restic-compose-backup:0.3
|
||||
docker push zettaio/restic-compose-backup:0.3.2
|
||||
docker push zettaio/restic-compose-backup:0.3.3
|
||||
```
|
||||
|
@@ -1 +1 @@
|
||||
__version__ = '0.3.2'
|
||||
__version__ = '0.3.3'
|
||||
|
@@ -57,9 +57,9 @@ def run(image: str = None, command: str = None, volumes: dict = None,
|
||||
fd.write('\n')
|
||||
logger.info(line)
|
||||
|
||||
container.wait()
|
||||
container.reload()
|
||||
logger.debug("Container ExitCode %s", container.attrs['State']['ExitCode'])
|
||||
container.stop()
|
||||
container.remove()
|
||||
|
||||
return container.attrs['State']['ExitCode']
|
||||
|
@@ -143,13 +143,15 @@ def start_backup_process(config, containers):
|
||||
vol_result = restic.backup_files(config.repository, source='/volumes')
|
||||
logger.debug('Volume backup exit code: %s', vol_result)
|
||||
if vol_result != 0:
|
||||
logger.error('Backup command exited with non-zero code: %s', vol_result)
|
||||
logger.error('Volume backup exited with non-zero code: %s', vol_result)
|
||||
errors = True
|
||||
except Exception as ex:
|
||||
logger.error('Exception raised during volume backup')
|
||||
logger.exception(ex)
|
||||
errors = True
|
||||
|
||||
# back up databases
|
||||
logger.info('Backing up databases')
|
||||
for container in containers.containers_for_backup():
|
||||
if container.database_backup_enabled:
|
||||
try:
|
||||
@@ -165,14 +167,18 @@ def start_backup_process(config, containers):
|
||||
errors = True
|
||||
|
||||
if errors:
|
||||
logger.error('Exit code: %s', errors)
|
||||
exit(1)
|
||||
|
||||
# Only run cleanup if backup was successful
|
||||
result = cleanup(config, container)
|
||||
logger.debug('cleanup exit code: %s', errors)
|
||||
logger.debug('cleanup exit code: %s', result)
|
||||
if result != 0:
|
||||
logger.error('Exit code: %s', result)
|
||||
exit(1)
|
||||
|
||||
logger.info('Backup completed')
|
||||
|
||||
|
||||
def cleanup(config, containers):
|
||||
"""Run forget / prune to minimize storage space"""
|
||||
|
@@ -3,7 +3,7 @@ from setuptools import setup, find_namespace_packages
|
||||
setup(
|
||||
name="restic-compose-backup",
|
||||
url="https://github.com/ZettaIO/restic-compose-backup",
|
||||
version="0.3.2",
|
||||
version="0.3.3",
|
||||
author="Einar Forselv",
|
||||
author_email="eforselv@gmail.com",
|
||||
packages=find_namespace_packages(include=['restic_compose_backup']),
|
||||
|
Reference in New Issue
Block a user