Commit 91e5cbca authored by Tim Bleimehl's avatar Tim Bleimehl 🤸🏼
Browse files

rename wip

parent 0be7a921
......@@ -153,4 +153,3 @@ cython_debug/
mysql_backups/
backups/
.git/
......@@ -180,7 +180,7 @@ class BaseBackupper:
database_name=database, retention_type=retention_type
)
cmd = self.get_backup_command(database, filepath)
log.info(f"Backup '{database}' to '{filepath}'")
log.info(f"Backup '{database}' to '{filepath.absolute()}'")
self.executer.container_exec(command=cmd)
backup_pathes.append(filepath)
......
......@@ -106,7 +106,7 @@ class ValidLabels:
"backup_name",
str,
default=None,
info="With this label you can define the sub-directory name for the the specific database. If not set, CoDaBackup will determine the name by a containers docker name or kubernetes deployment name.",
info="With this label you can define the sub-directory name for the the specific database. If not set, CoDaBuddy will determine the name by a containers docker name or kubernetes deployment name.",
base_label_key=config.DATABASE_CONTAINER_LABEL_BASE_KEY,
)
database_type: Label = Label(
......
......@@ -21,18 +21,18 @@ docker exec postgres /usr/bin/psql -Atx postgresql://postgres:mysupersavepw@loca
## docker
```bash
python3 CoDaBackup/cli.py backup now --mode=docker --container-identifier=mysql --database-type=mysql --database-host=127.0.0.1 --database-user=root --database-names=coda_test
python3 CoDaBuddy/cli.py backup now --mode=docker --container-identifier=mysql --database-type=mysql --database-host=127.0.0.1 --database-user=root --database-names=coda_test
```
## kubernetes
```bash
python3 CoDaBackup/cli.py backup now --mode=kubernetes --container-identifier=my-namespace/postgres01 --database-type=postgres --database-host=127.0.0.1 --database-user=postgres --database-names=coda_ps_test
python3 CoDaBuddy/cli.py backup now --mode=kubernetes --container-identifier=my-namespace/postgres01 --database-type=postgres --database-host=127.0.0.1 --database-user=postgres --database-names=coda_ps_test
```
# restore
```bash
python3 CoDaBackup/cli.py restore kubernetes --namespace="my-namespace" --backup-name="postgresbackup_2022-01-28_10-23-46.sql" --workload-name="postgres01" --database-name="coda_ps_test"
python3 CoDaBuddy/cli.py restore kubernetes --namespace="my-namespace" --backup-name="postgresbackup_2022-01-28_10-23-46.sql" --workload-name="postgres01" --database-name="coda_ps_test"
```
\ No newline at end of file
# Container Database Backup - CoDaBackup
# Container Database Buddy - CoDaBuddy
A container native database backup and restore solution
![LOGO_PLACEHOLDER](./docs/logo.png)
**This is a placeholder logo. Source: https://logomakr.com/**
> We use the buddy system. No more flyin' solo!
> You need somebody watching your back at all times!
- [*Rex Kwon Do - Napelon Dynamite*](https://youtu.be/Hzh9koy7b1E?t=94)
A container native database setup, backup and restore solution
Maintainer: tim.bleimehl@dzd-ev.de
......@@ -8,12 +19,11 @@ Status: Alpha (WIP - **do not use productive yet**)
# What is this (short)
CoDaBackup helps you to automate backups, if your databases are running in container environment (kubernetes, docker)
CoDaBuddy helps you to automate setup and backup your database that is running in container environment (kubernetes, docker)
It relies heavily on configuration by labels ([docker-labels](https://docs.docker.com/config/labels-custom-metadata/), [kubernetes-labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/))
This means you only have to attach the right labels to your database containers and they will be included in your daily backup.
This means you only have to attach the right labels to your database containers and they will be ready to use and included in your daily backup.
# Basic Example
......@@ -39,7 +49,7 @@ services:
- "backup.dzd-ev.de/password=mysuperpw"
```
Note the `labels`; these will direct our CoDaBackup instance.
Note the `labels`; these will direct our CoDaBuddy instance.
Start the DB:
......@@ -58,9 +68,9 @@ docker exec mysql /usr/bin/mysql -N -h127.0.0.1 -uroot -pmysuperpw -e "\
### Backup
Now we can install CoDaBackup via
Now we can install CoDaBuddy via
`pip3 install git+https://git.connect.dzd-ev.de/dzdtools/CoDaBackup -U`
`pip3 install git+https://git.connect.dzd-ev.de/dzdtools/CoDaBuddy -U`
And lets backup our DB
......@@ -96,6 +106,7 @@ Thats it. We now have a directory `./backups/` in front of us, with all database
* (Idea) Suppord pod with more than one container https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/#opening-a-shell-when-a-pod-has-more-than-one-container
* (Idea) Provide auto-create params in https://kubernetes.io/docs/concepts/configuration/configmap/ instead of k8s annotation
* (Idea) Improve human readable output by printing a tree structure (https://www.baeldung.com/java-print-binary-tree-diagram)
* (Idea) Encrypt backups
# Current ToDo
* implement RETENTION_ON_COLLISION_KEEP_NEWEST_BACKUP
......
......@@ -5,13 +5,13 @@ USER 0
COPY --from=docker:latest /usr/local/bin/docker /usr/local/bin/
# RUN groupadd docker && useradd -u 1001 -g docker justaname
# install python3
RUN install_packages python3 python3-pip
RUN install_packages python3 python3-pip git
# install required python modules
RUN pip3 install setuptools
# copy backupper python scripts
COPY . /opt/CoDaBackup
RUN pip3 install -e /opt/CoDaBackup
COPY . /opt/CoDaBuddy
RUN pip3 install -e /opt/CoDaBuddy
# Switch back to non root user
#USER 1001
......@@ -20,6 +20,5 @@ RUN pip3 install -e /opt/CoDaBackup
ENV CONFIGS_BACKUP_DIR="/backups"
# Volume for backup dir
VOLUME ["/backup"]
ENTRYPOINT [ "/opt/CoDaBackup/CoDaBackup/cli.py" ]
ENTRYPOINT [ "/opt/CoDaBuddy/CoDaBuddy/cli.py" ]
CMD [ "--help" ]
\ No newline at end of file
......@@ -5,17 +5,17 @@ this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
setup(
name="CoDaBackup",
name="CoDaBuddy",
description="Container Database Backup - A tool to backup your database containers",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://git.connect.dzd-ev.de/dzdtools/CoDaBackup",
url="https://git.connect.dzd-ev.de/dzdtools/CoDaBuddy",
author="TB",
author_email="tim.bleimehl@helmholtz-muenchen.de",
license="MIT",
packages=["CoDaBackup"],
install_requires=["DZDConfigs", "Click", "tabulate", "humanize"],
python_requires=">=3.9",
packages=["CoDaBuddy"],
install_requires=["DZDConfigs", "Click", "tabulate", "humanize", "pyyaml"],
python_requires=">=3.7",
zip_safe=False,
include_package_data=True,
use_scm_version={
......@@ -28,8 +28,8 @@ setup(
setup_requires=["setuptools_scm"],
entry_points={
"console_scripts": [
"coda-backup=CoDaBackup.cli:backup_cli",
"coda-restore=CoDaBackup.cli:restore_cli",
"coda-backup=CoDaBuddy.cli:backup_cli",
"coda-restore=CoDaBuddy.cli:restore_cli",
],
},
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment