Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
einarf | e6ca4aa9ca | |
einarf | 093dab93ca | |
einarf | 405bd4af15 | |
dreadper | 28dda6b09d | |
dreadper | b400138b73 | |
Einar Forselv | b52655a23b | |
Maximilian Wehrstedt | 323e299b7e |
|
@ -0,0 +1,24 @@
|
|||
# Read the Docs configuration file for Sphinx projects
|
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||
|
||||
# Required
|
||||
version: 2
|
||||
|
||||
# Set the OS, Python version and other tools you might need
|
||||
build:
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "3.10"
|
||||
|
||||
# Build documentation in the "docs/" directory with Sphinx
|
||||
sphinx:
|
||||
configuration: docs/conf.py
|
||||
|
||||
# Optionally build your docs in additional formats such as PDF and ePub
|
||||
# formats:
|
||||
# - pdf
|
||||
# - epub
|
||||
|
||||
python:
|
||||
install:
|
||||
- requirements: docs/requirements.txt
|
|
@ -4,7 +4,7 @@ services:
|
|||
build: ./src
|
||||
env_file:
|
||||
- restic_compose_backup.env
|
||||
- alerts.env
|
||||
# - alerts.env
|
||||
labels:
|
||||
restic-compose-backup.volumes: true
|
||||
restic-compose-backup.volumes.include: 'src'
|
||||
|
@ -32,7 +32,7 @@ services:
|
|||
- SOME_VALUE=test
|
||||
- ANOTHER_VALUE=1
|
||||
|
||||
mysql:
|
||||
mysql5:
|
||||
image: mysql:5
|
||||
labels:
|
||||
restic-compose-backup.mysql: true
|
||||
|
@ -42,7 +42,19 @@ services:
|
|||
- MYSQL_USER=myuser
|
||||
- MYSQL_PASSWORD=mypassword
|
||||
volumes:
|
||||
- mysqldata:/var/lib/mysql
|
||||
- mysqldata5:/var/lib/mysql
|
||||
|
||||
mysql8:
|
||||
image: mysql:8
|
||||
labels:
|
||||
restic-compose-backup.mysql: true
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=my-secret-pw
|
||||
- MYSQL_DATABASE=mydb
|
||||
- MYSQL_USER=myuser
|
||||
- MYSQL_PASSWORD=mypassword
|
||||
volumes:
|
||||
- mysqldata8:/var/lib/mysql
|
||||
|
||||
mariadb:
|
||||
image: mariadb:10
|
||||
|
@ -68,7 +80,8 @@ services:
|
|||
- pgdata:/var/lib/postgresql/data
|
||||
|
||||
volumes:
|
||||
mysqldata:
|
||||
mysqldata5:
|
||||
mysqldata8:
|
||||
mariadbdata:
|
||||
pgdata:
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
FROM restic/restic:0.9.6
|
||||
|
||||
RUN apk update && apk add python3 dcron mariadb-client postgresql-client
|
||||
RUN apk update && apk add python3 \
|
||||
dcron \
|
||||
mariadb-client \
|
||||
postgresql-client \
|
||||
mariadb-connector-c-dev
|
||||
|
||||
ADD . /restic-compose-backup
|
||||
WORKDIR /restic-compose-backup
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Dump all env vars so we can source them in cron jobs
|
||||
printenv | sed 's/^\(.*\)$/export \1/g' > /env.sh
|
||||
rcb dump-env > /env.sh
|
||||
|
||||
# Write crontab
|
||||
rcb crontab > crontab
|
||||
|
|
|
@ -1 +1 @@
|
|||
__version__ = '0.6.0'
|
||||
__version__ = '0.7.1'
|
||||
|
|
|
@ -15,7 +15,7 @@ class SMTPAlert(BaseAlert):
|
|||
self.host = host
|
||||
self.port = port
|
||||
self.user = user
|
||||
self.password = password
|
||||
self.password = password or ""
|
||||
self.to = to
|
||||
|
||||
@classmethod
|
||||
|
@ -34,7 +34,7 @@ class SMTPAlert(BaseAlert):
|
|||
|
||||
@property
|
||||
def properly_configured(self) -> bool:
|
||||
return self.host and self.port and self.user and self.password and len(self.to) > 0
|
||||
return self.host and self.port and self.user and len(self.to) > 0
|
||||
|
||||
def send(self, subject: str = None, body: str = None, alert_type: str = 'INFO'):
|
||||
# send_mail("Hello world!")
|
||||
|
|
|
@ -51,6 +51,9 @@ def main():
|
|||
elif args.action == "crontab":
|
||||
crontab(config)
|
||||
|
||||
elif args.action == "dump-env":
|
||||
dump_env()
|
||||
|
||||
# Random test stuff here
|
||||
elif args.action == "test":
|
||||
nodes = utils.get_swarm_nodes()
|
||||
|
@ -290,6 +293,14 @@ def crontab(config):
|
|||
print(cron.generate_crontab(config))
|
||||
|
||||
|
||||
def dump_env():
|
||||
"""Dump all environment variables to a script that can be sourced from cron"""
|
||||
print("#!/bin/bash")
|
||||
print("# This file was generated by restic-compose-backup")
|
||||
for key, value in os.environ.items():
|
||||
print("export {}='{}'".format(key, value))
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(prog='restic_compose_backup')
|
||||
parser.add_argument(
|
||||
|
@ -303,6 +314,7 @@ def parse_args():
|
|||
'cleanup',
|
||||
'version',
|
||||
'crontab',
|
||||
'dump-env',
|
||||
'test',
|
||||
],
|
||||
)
|
||||
|
|
|
@ -41,6 +41,7 @@ class MariadbContainer(Container):
|
|||
f"--port={creds['port']}",
|
||||
f"--user={creds['username']}",
|
||||
"--all-databases",
|
||||
"--no-tablespaces",
|
||||
]
|
||||
|
||||
def backup(self):
|
||||
|
@ -100,6 +101,7 @@ class MysqlContainer(Container):
|
|||
f"--port={creds['port']}",
|
||||
f"--user={creds['username']}",
|
||||
"--all-databases",
|
||||
"--no-tablespaces",
|
||||
]
|
||||
|
||||
def backup(self):
|
||||
|
|
|
@ -3,12 +3,15 @@ from setuptools import setup, find_namespace_packages
|
|||
setup(
|
||||
name="restic-compose-backup",
|
||||
url="https://github.com/ZettaIO/restic-compose-backup",
|
||||
version="0.6.0",
|
||||
version="0.7.1",
|
||||
author="Einar Forselv",
|
||||
author_email="eforselv@gmail.com",
|
||||
packages=find_namespace_packages(include=['restic_compose_backup']),
|
||||
packages=find_namespace_packages(include=[
|
||||
'restic_compose_backup',
|
||||
'restic_compose_backup.*',
|
||||
]),
|
||||
install_requires=[
|
||||
'docker==4.1.*',
|
||||
'docker~=6.1.3',
|
||||
],
|
||||
entry_points={'console_scripts': [
|
||||
'restic-compose-backup = restic_compose_backup.cli:main',
|
||||
|
|
Loading…
Reference in New Issue