rireki 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rireki-0.0.1/PKG-INFO +128 -0
- rireki-0.0.1/README.md +117 -0
- rireki-0.0.1/rireki/__init__.py +0 -0
- rireki-0.0.1/rireki/cli.py +19 -0
- rireki-0.0.1/rireki/commands/__init__.py +0 -0
- rireki-0.0.1/rireki/commands/add.py +73 -0
- rireki-0.0.1/rireki/commands/status.py +77 -0
- rireki-0.0.1/rireki.egg-info/PKG-INFO +128 -0
- rireki-0.0.1/rireki.egg-info/SOURCES.txt +13 -0
- rireki-0.0.1/rireki.egg-info/dependency_links.txt +1 -0
- rireki-0.0.1/rireki.egg-info/entry_points.txt +3 -0
- rireki-0.0.1/rireki.egg-info/requires.txt +3 -0
- rireki-0.0.1/rireki.egg-info/top_level.txt +1 -0
- rireki-0.0.1/setup.cfg +4 -0
- rireki-0.0.1/setup.py +18 -0
rireki-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: rireki
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: CLI backup tool.
|
|
5
|
+
Home-page: https://github.com/noeldemartin/rireki
|
|
6
|
+
Author: Noel De Martin
|
|
7
|
+
Author-email: noeldemartin@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Description: # Rireki [](https://github.com/noeldemartin/rireki/actions)
|
|
10
|
+
|
|
11
|
+
CLI backup tool.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
Install the rireki cli running the following command:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
pip install rireki
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
You need to call `rireki backup` in order for backups to be performed. For example, you could use the following crontab configuration to perform backup checks every hour (remember to create the `/var/log/rireki` directory as well):
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
0 * * * * rireki backup >> /var/log/rireki/cron.log 2>> /var/log/rireki/cron-error.log
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Get detailed information running `rireki --help`.
|
|
30
|
+
|
|
31
|
+
There are three core concepts on how rireki manages backups:
|
|
32
|
+
|
|
33
|
+
- **Projects:** A project is something you want to back up. For example a website database or a collection of files.
|
|
34
|
+
|
|
35
|
+
- **Drivers:** A driver is the program used to create the backup files. For example zipping up a folder or dumping a database.
|
|
36
|
+
|
|
37
|
+
- **Stores:** A store is the program used to save the backup files created with a driver. For example copying them to a local folder or uploading them to a 3rd party service.
|
|
38
|
+
|
|
39
|
+
In order to install a new project to backup, a configuration file can be added to `~/.rireki/projects/{project-name}.conf`. This will be a [toml](https://github.com/toml-lang/toml) configuration file. It can either be created manually or calling `rireki add {project-name}`.
|
|
40
|
+
|
|
41
|
+
### Drivers
|
|
42
|
+
|
|
43
|
+
#### Files
|
|
44
|
+
|
|
45
|
+
This driver creates an archive with files copied from the local filesystem. The archive will be a zip file if possible or a tar file.
|
|
46
|
+
|
|
47
|
+
It needs the following configuration:
|
|
48
|
+
|
|
49
|
+
| property | type | description |
|
|
50
|
+
| ------------- |---------------| -------------|
|
|
51
|
+
| name | `"files"` | The name of the driver. |
|
|
52
|
+
| frequency | `integer` | The frequency in seconds at which new backups should be made. |
|
|
53
|
+
| paths | `string[]` | Folders or files that will be included in the archive. |
|
|
54
|
+
|
|
55
|
+
#### Custom
|
|
56
|
+
|
|
57
|
+
This driver can be used if backing up a project is not supported by any of the other drivers. It consists of a custom script that will be called to generate the backup artifacts. The backup files should be placed on a path indicated by the `RIREKI_BACKUP_PATH` env variable.
|
|
58
|
+
|
|
59
|
+
Once the script has completed, a file named `logs.json` will also be placed on the path with the standard output and standard error printed by the script.
|
|
60
|
+
|
|
61
|
+
It needs the following configuration:
|
|
62
|
+
|
|
63
|
+
| property | type | description |
|
|
64
|
+
| ------------- |---------------| -------------|
|
|
65
|
+
| name | `"custom"` | The name of the driver. |
|
|
66
|
+
| frequency | `integer` | The frequency in seconds at which new backups should be made. |
|
|
67
|
+
| command | `string` | Command to call in order to perform backups. |
|
|
68
|
+
| timeout | `integer` | Number of seconds where the command will be timed out and the backup will fail. |
|
|
69
|
+
|
|
70
|
+
### Stores
|
|
71
|
+
|
|
72
|
+
#### Local
|
|
73
|
+
|
|
74
|
+
This store copies the backups to a folder in the same filesystem.
|
|
75
|
+
|
|
76
|
+
It needs the following configuration:
|
|
77
|
+
|
|
78
|
+
| property | type | description |
|
|
79
|
+
| ------------- |---------------| -------------|
|
|
80
|
+
| name | `"local"` | The name of the store. |
|
|
81
|
+
| path | `string` | The path of the folder where the backups will be copied. |
|
|
82
|
+
|
|
83
|
+
#### Amazon Web Services
|
|
84
|
+
|
|
85
|
+
This store uploads the backups to an AWS S3 instance.
|
|
86
|
+
|
|
87
|
+
It needs the following configuration:
|
|
88
|
+
|
|
89
|
+
| property | type | description |
|
|
90
|
+
| ------------- |---------------| -------------|
|
|
91
|
+
| name | `"aws"` | The name of the store. |
|
|
92
|
+
| region | `string` | The region where the S3 instance is located. |
|
|
93
|
+
| access_key | `string` | The access key ID. |
|
|
94
|
+
| access_secret | `string` | The secret access key. |
|
|
95
|
+
| bucket | `string` | The name of the bucket where the files will be uploaded. |
|
|
96
|
+
| path | `string` | The path within the bucket where the files will be placed. |
|
|
97
|
+
|
|
98
|
+
#### Digital Ocean
|
|
99
|
+
|
|
100
|
+
This store uploads the backups to a Digital Ocean Spaces instance.
|
|
101
|
+
|
|
102
|
+
It uses the same configuration as the AWS store, with the only exception that the name is `"digital-ocean"` instead.
|
|
103
|
+
|
|
104
|
+
### An example config file
|
|
105
|
+
|
|
106
|
+
For example, to backup a project named "Foobar" using the `files` driver and the `local` store we would create the following file at `~/.rireki/projects/foobar.conf`:
|
|
107
|
+
|
|
108
|
+
```toml
|
|
109
|
+
name="foobar"
|
|
110
|
+
|
|
111
|
+
[driver]
|
|
112
|
+
name="files"
|
|
113
|
+
paths=["/path/to/data/folder"]
|
|
114
|
+
frequency=1440
|
|
115
|
+
|
|
116
|
+
[store]
|
|
117
|
+
name="local"
|
|
118
|
+
path="/path/to/backups/folder"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
As mentioned before, you could call `rireki add foobar` to create this file.
|
|
122
|
+
|
|
123
|
+
## Development
|
|
124
|
+
|
|
125
|
+
Run tests with `pytest` and lint your code with `flake8` (see the [Github Actions configuration](.github/workflows/testing.yml) for more details).
|
|
126
|
+
|
|
127
|
+
Platform: UNKNOWN
|
|
128
|
+
Description-Content-Type: text/markdown
|
rireki-0.0.1/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Rireki [](https://github.com/noeldemartin/rireki/actions)
|
|
2
|
+
|
|
3
|
+
CLI backup tool.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install the rireki cli running the following command:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pip install rireki
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
You need to call `rireki backup` in order for backups to be performed. For example, you could use the following crontab configuration to perform backup checks every hour (remember to create the `/var/log/rireki` directory as well):
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
0 * * * * rireki backup >> /var/log/rireki/cron.log 2>> /var/log/rireki/cron-error.log
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Get detailed information running `rireki --help`.
|
|
22
|
+
|
|
23
|
+
There are three core concepts on how rireki manages backups:
|
|
24
|
+
|
|
25
|
+
- **Projects:** A project is something you want to back up. For example a website database or a collection of files.
|
|
26
|
+
|
|
27
|
+
- **Drivers:** A driver is the program used to create the backup files. For example zipping up a folder or dumping a database.
|
|
28
|
+
|
|
29
|
+
- **Stores:** A store is the program used to save the backup files created with a driver. For example copying them to a local folder or uploading them to a 3rd party service.
|
|
30
|
+
|
|
31
|
+
In order to install a new project to backup, a configuration file can be added to `~/.rireki/projects/{project-name}.conf`. This will be a [toml](https://github.com/toml-lang/toml) configuration file. It can either be created manually or calling `rireki add {project-name}`.
|
|
32
|
+
|
|
33
|
+
### Drivers
|
|
34
|
+
|
|
35
|
+
#### Files
|
|
36
|
+
|
|
37
|
+
This driver creates an archive with files copied from the local filesystem. The archive will be a zip file if possible or a tar file.
|
|
38
|
+
|
|
39
|
+
It needs the following configuration:
|
|
40
|
+
|
|
41
|
+
| property | type | description |
|
|
42
|
+
| ------------- |---------------| -------------|
|
|
43
|
+
| name | `"files"` | The name of the driver. |
|
|
44
|
+
| frequency | `integer` | The frequency in seconds at which new backups should be made. |
|
|
45
|
+
| paths | `string[]` | Folders or files that will be included in the archive. |
|
|
46
|
+
|
|
47
|
+
#### Custom
|
|
48
|
+
|
|
49
|
+
This driver can be used if backing up a project is not supported by any of the other drivers. It consists of a custom script that will be called to generate the backup artifacts. The backup files should be placed on a path indicated by the `RIREKI_BACKUP_PATH` env variable.
|
|
50
|
+
|
|
51
|
+
Once the script has completed, a file named `logs.json` will also be placed on the path with the standard output and standard error printed by the script.
|
|
52
|
+
|
|
53
|
+
It needs the following configuration:
|
|
54
|
+
|
|
55
|
+
| property | type | description |
|
|
56
|
+
| ------------- |---------------| -------------|
|
|
57
|
+
| name | `"custom"` | The name of the driver. |
|
|
58
|
+
| frequency | `integer` | The frequency in seconds at which new backups should be made. |
|
|
59
|
+
| command | `string` | Command to call in order to perform backups. |
|
|
60
|
+
| timeout | `integer` | Number of seconds where the command will be timed out and the backup will fail. |
|
|
61
|
+
|
|
62
|
+
### Stores
|
|
63
|
+
|
|
64
|
+
#### Local
|
|
65
|
+
|
|
66
|
+
This store copies the backups to a folder in the same filesystem.
|
|
67
|
+
|
|
68
|
+
It needs the following configuration:
|
|
69
|
+
|
|
70
|
+
| property | type | description |
|
|
71
|
+
| ------------- |---------------| -------------|
|
|
72
|
+
| name | `"local"` | The name of the store. |
|
|
73
|
+
| path | `string` | The path of the folder where the backups will be copied. |
|
|
74
|
+
|
|
75
|
+
#### Amazon Web Services
|
|
76
|
+
|
|
77
|
+
This store uploads the backups to an AWS S3 instance.
|
|
78
|
+
|
|
79
|
+
It needs the following configuration:
|
|
80
|
+
|
|
81
|
+
| property | type | description |
|
|
82
|
+
| ------------- |---------------| -------------|
|
|
83
|
+
| name | `"aws"` | The name of the store. |
|
|
84
|
+
| region | `string` | The region where the S3 instance is located. |
|
|
85
|
+
| access_key | `string` | The access key ID. |
|
|
86
|
+
| access_secret | `string` | The secret access key. |
|
|
87
|
+
| bucket | `string` | The name of the bucket where the files will be uploaded. |
|
|
88
|
+
| path | `string` | The path within the bucket where the files will be placed. |
|
|
89
|
+
|
|
90
|
+
#### Digital Ocean
|
|
91
|
+
|
|
92
|
+
This store uploads the backups to a Digital Ocean Spaces instance.
|
|
93
|
+
|
|
94
|
+
It uses the same configuration as the AWS store, with the only exception that the name is `"digital-ocean"` instead.
|
|
95
|
+
|
|
96
|
+
### An example config file
|
|
97
|
+
|
|
98
|
+
For example, to backup a project named "Foobar" using the `files` driver and the `local` store we would create the following file at `~/.rireki/projects/foobar.conf`:
|
|
99
|
+
|
|
100
|
+
```toml
|
|
101
|
+
name="foobar"
|
|
102
|
+
|
|
103
|
+
[driver]
|
|
104
|
+
name="files"
|
|
105
|
+
paths=["/path/to/data/folder"]
|
|
106
|
+
frequency=1440
|
|
107
|
+
|
|
108
|
+
[store]
|
|
109
|
+
name="local"
|
|
110
|
+
path="/path/to/backups/folder"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
As mentioned before, you could call `rireki add foobar` to create this file.
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
Run tests with `pytest` and lint your code with `flake8` (see the [Github Actions configuration](.github/workflows/testing.yml) for more details).
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from rireki.commands.add import add
|
|
4
|
+
from rireki.commands.backup import backup
|
|
5
|
+
from rireki.commands.status import status
|
|
6
|
+
from rireki.core.config import Config
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@click.group()
|
|
10
|
+
def cli():
|
|
11
|
+
Config.load()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
cli.add_command(add)
|
|
15
|
+
cli.add_command(backup)
|
|
16
|
+
cli.add_command(status)
|
|
17
|
+
|
|
18
|
+
if __name__ == '__main__':
|
|
19
|
+
cli()
|
|
File without changes
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from rireki.core.project import Project
|
|
4
|
+
from rireki.core.projects_manager import ProjectsManager
|
|
5
|
+
from rireki.drivers.index import drivers
|
|
6
|
+
from rireki.stores.index import stores
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@click.command()
|
|
10
|
+
@click.argument('name')
|
|
11
|
+
@click.option('--driver', type=click.Choice(drivers.keys()), help='Backups driver')
|
|
12
|
+
@click.option('--store', type=click.Choice(stores.keys()), help='Backups store')
|
|
13
|
+
def add(name, driver=None, store=None):
|
|
14
|
+
"""Install a new project"""
|
|
15
|
+
|
|
16
|
+
if ProjectsManager.project_exists(name):
|
|
17
|
+
click.echo('Project with name "%s" already installed!' % name)
|
|
18
|
+
return
|
|
19
|
+
|
|
20
|
+
driver = __resolve_driver(driver)
|
|
21
|
+
store = __resolve_store(store)
|
|
22
|
+
|
|
23
|
+
__add_new_project(name, driver, store)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def __resolve_driver(driver):
|
|
27
|
+
if driver:
|
|
28
|
+
return driver
|
|
29
|
+
|
|
30
|
+
return click.prompt(
|
|
31
|
+
'Which driver would you like to use to backup this project?',
|
|
32
|
+
type=click.Choice(drivers.keys()),
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def __resolve_store(store):
|
|
37
|
+
if store:
|
|
38
|
+
return store
|
|
39
|
+
|
|
40
|
+
return click.prompt(
|
|
41
|
+
'Which store would you like to use to persist this project?',
|
|
42
|
+
type=click.Choice(stores.keys()),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def __add_new_project(project_name, driver_name, store_name):
|
|
47
|
+
driver = __create_driver(driver_name)
|
|
48
|
+
store = __create_store(store_name)
|
|
49
|
+
project = __create_project(project_name, driver, store)
|
|
50
|
+
|
|
51
|
+
ProjectsManager.install_project(project)
|
|
52
|
+
|
|
53
|
+
click.echo('Project "%s" has been installed!' % project.name)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def __create_driver(name):
|
|
57
|
+
driver = drivers[name]()
|
|
58
|
+
|
|
59
|
+
driver.ask_config()
|
|
60
|
+
|
|
61
|
+
return driver
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def __create_store(name):
|
|
65
|
+
store = stores[name]()
|
|
66
|
+
|
|
67
|
+
store.ask_config()
|
|
68
|
+
|
|
69
|
+
return store
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def __create_project(name, driver, store):
|
|
73
|
+
return Project(name, driver, store)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from rireki.core.projects_manager import ProjectsManager
|
|
4
|
+
from rireki.utils.array_helpers import array_map
|
|
5
|
+
from rireki.utils.output import display_table, format_time
|
|
6
|
+
from rireki.utils.time_helpers import now
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@click.command()
|
|
10
|
+
@click.argument('project', required=False)
|
|
11
|
+
def status(project=None):
|
|
12
|
+
"""Show status of installed projects"""
|
|
13
|
+
|
|
14
|
+
if project:
|
|
15
|
+
name = project
|
|
16
|
+
project = ProjectsManager.get_project_by_name(name)
|
|
17
|
+
|
|
18
|
+
if not project:
|
|
19
|
+
click.echo('Project with name "%s" is not installed!' % name)
|
|
20
|
+
return
|
|
21
|
+
|
|
22
|
+
__display_project_status(project)
|
|
23
|
+
else:
|
|
24
|
+
projects = ProjectsManager.get_projects()
|
|
25
|
+
|
|
26
|
+
__display_projects_status(projects)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def __display_project_status(project):
|
|
30
|
+
if project.has_pending_backups():
|
|
31
|
+
click.echo(click.style('Project needs to be backed up', fg='red'))
|
|
32
|
+
else:
|
|
33
|
+
click.echo(
|
|
34
|
+
click.style('Project ', fg='green') +
|
|
35
|
+
click.style(project.name, bold=True, fg='green') +
|
|
36
|
+
click.style(' is up to date', fg='green'),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
backups = project.get_backups()
|
|
40
|
+
|
|
41
|
+
click.echo('')
|
|
42
|
+
click.echo('All backups (%s):' % len(backups))
|
|
43
|
+
|
|
44
|
+
for backup in backups:
|
|
45
|
+
click.echo('- %s ago' % format_time(now() - backup.time, 'interval'))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def __display_projects_status(projects):
|
|
49
|
+
if not projects:
|
|
50
|
+
click.echo('No projects installed!')
|
|
51
|
+
return
|
|
52
|
+
|
|
53
|
+
display_table(
|
|
54
|
+
('Name', 'Driver', 'Store', 'Status'),
|
|
55
|
+
array_map(__get_project_info, projects),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def __get_project_info(project):
|
|
60
|
+
if project.has_pending_backups():
|
|
61
|
+
status = {
|
|
62
|
+
'text': 'backup-pending',
|
|
63
|
+
'color': 'red',
|
|
64
|
+
}
|
|
65
|
+
else:
|
|
66
|
+
last_backup_interval = now() - project.get_last_backup().time
|
|
67
|
+
status = {
|
|
68
|
+
'text': 'Backed up %s ago' % format_time(last_backup_interval, 'interval'),
|
|
69
|
+
'color': 'green',
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
project.name,
|
|
74
|
+
project.driver.name,
|
|
75
|
+
project.store.name,
|
|
76
|
+
status,
|
|
77
|
+
)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: rireki
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: CLI backup tool.
|
|
5
|
+
Home-page: https://github.com/noeldemartin/rireki
|
|
6
|
+
Author: Noel De Martin
|
|
7
|
+
Author-email: noeldemartin@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Description: # Rireki [](https://github.com/noeldemartin/rireki/actions)
|
|
10
|
+
|
|
11
|
+
CLI backup tool.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
Install the rireki cli running the following command:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
pip install rireki
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
You need to call `rireki backup` in order for backups to be performed. For example, you could use the following crontab configuration to perform backup checks every hour (remember to create the `/var/log/rireki` directory as well):
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
0 * * * * rireki backup >> /var/log/rireki/cron.log 2>> /var/log/rireki/cron-error.log
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Get detailed information running `rireki --help`.
|
|
30
|
+
|
|
31
|
+
There are three core concepts on how rireki manages backups:
|
|
32
|
+
|
|
33
|
+
- **Projects:** A project is something you want to back up. For example a website database or a collection of files.
|
|
34
|
+
|
|
35
|
+
- **Drivers:** A driver is the program used to create the backup files. For example zipping up a folder or dumping a database.
|
|
36
|
+
|
|
37
|
+
- **Stores:** A store is the program used to save the backup files created with a driver. For example copying them to a local folder or uploading them to a 3rd party service.
|
|
38
|
+
|
|
39
|
+
In order to install a new project to backup, a configuration file can be added to `~/.rireki/projects/{project-name}.conf`. This will be a [toml](https://github.com/toml-lang/toml) configuration file. It can either be created manually or calling `rireki add {project-name}`.
|
|
40
|
+
|
|
41
|
+
### Drivers
|
|
42
|
+
|
|
43
|
+
#### Files
|
|
44
|
+
|
|
45
|
+
This driver creates an archive with files copied from the local filesystem. The archive will be a zip file if possible or a tar file.
|
|
46
|
+
|
|
47
|
+
It needs the following configuration:
|
|
48
|
+
|
|
49
|
+
| property | type | description |
|
|
50
|
+
| ------------- |---------------| -------------|
|
|
51
|
+
| name | `"files"` | The name of the driver. |
|
|
52
|
+
| frequency | `integer` | The frequency in seconds at which new backups should be made. |
|
|
53
|
+
| paths | `string[]` | Folders or files that will be included in the archive. |
|
|
54
|
+
|
|
55
|
+
#### Custom
|
|
56
|
+
|
|
57
|
+
This driver can be used if backing up a project is not supported by any of the other drivers. It consists of a custom script that will be called to generate the backup artifacts. The backup files should be placed on a path indicated by the `RIREKI_BACKUP_PATH` env variable.
|
|
58
|
+
|
|
59
|
+
Once the script has completed, a file named `logs.json` will also be placed on the path with the standard output and standard error printed by the script.
|
|
60
|
+
|
|
61
|
+
It needs the following configuration:
|
|
62
|
+
|
|
63
|
+
| property | type | description |
|
|
64
|
+
| ------------- |---------------| -------------|
|
|
65
|
+
| name | `"custom"` | The name of the driver. |
|
|
66
|
+
| frequency | `integer` | The frequency in seconds at which new backups should be made. |
|
|
67
|
+
| command | `string` | Command to call in order to perform backups. |
|
|
68
|
+
| timeout | `integer` | Number of seconds where the command will be timed out and the backup will fail. |
|
|
69
|
+
|
|
70
|
+
### Stores
|
|
71
|
+
|
|
72
|
+
#### Local
|
|
73
|
+
|
|
74
|
+
This store copies the backups to a folder in the same filesystem.
|
|
75
|
+
|
|
76
|
+
It needs the following configuration:
|
|
77
|
+
|
|
78
|
+
| property | type | description |
|
|
79
|
+
| ------------- |---------------| -------------|
|
|
80
|
+
| name | `"local"` | The name of the store. |
|
|
81
|
+
| path | `string` | The path of the folder where the backups will be copied. |
|
|
82
|
+
|
|
83
|
+
#### Amazon Web Services
|
|
84
|
+
|
|
85
|
+
This store uploads the backups to an AWS S3 instance.
|
|
86
|
+
|
|
87
|
+
It needs the following configuration:
|
|
88
|
+
|
|
89
|
+
| property | type | description |
|
|
90
|
+
| ------------- |---------------| -------------|
|
|
91
|
+
| name | `"aws"` | The name of the store. |
|
|
92
|
+
| region | `string` | The region where the S3 instance is located. |
|
|
93
|
+
| access_key | `string` | The access key ID. |
|
|
94
|
+
| access_secret | `string` | The secret access key. |
|
|
95
|
+
| bucket | `string` | The name of the bucket where the files will be uploaded. |
|
|
96
|
+
| path | `string` | The path within the bucket where the files will be placed. |
|
|
97
|
+
|
|
98
|
+
#### Digital Ocean
|
|
99
|
+
|
|
100
|
+
This store uploads the backups to a Digital Ocean Spaces instance.
|
|
101
|
+
|
|
102
|
+
It uses the same configuration as the AWS store, with the only exception that the name is `"digital-ocean"` instead.
|
|
103
|
+
|
|
104
|
+
### An example config file
|
|
105
|
+
|
|
106
|
+
For example, to backup a project named "Foobar" using the `files` driver and the `local` store we would create the following file at `~/.rireki/projects/foobar.conf`:
|
|
107
|
+
|
|
108
|
+
```toml
|
|
109
|
+
name="foobar"
|
|
110
|
+
|
|
111
|
+
[driver]
|
|
112
|
+
name="files"
|
|
113
|
+
paths=["/path/to/data/folder"]
|
|
114
|
+
frequency=1440
|
|
115
|
+
|
|
116
|
+
[store]
|
|
117
|
+
name="local"
|
|
118
|
+
path="/path/to/backups/folder"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
As mentioned before, you could call `rireki add foobar` to create this file.
|
|
122
|
+
|
|
123
|
+
## Development
|
|
124
|
+
|
|
125
|
+
Run tests with `pytest` and lint your code with `flake8` (see the [Github Actions configuration](.github/workflows/testing.yml) for more details).
|
|
126
|
+
|
|
127
|
+
Platform: UNKNOWN
|
|
128
|
+
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
rireki/__init__.py
|
|
4
|
+
rireki/cli.py
|
|
5
|
+
rireki.egg-info/PKG-INFO
|
|
6
|
+
rireki.egg-info/SOURCES.txt
|
|
7
|
+
rireki.egg-info/dependency_links.txt
|
|
8
|
+
rireki.egg-info/entry_points.txt
|
|
9
|
+
rireki.egg-info/requires.txt
|
|
10
|
+
rireki.egg-info/top_level.txt
|
|
11
|
+
rireki/commands/__init__.py
|
|
12
|
+
rireki/commands/add.py
|
|
13
|
+
rireki/commands/status.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rireki
|
rireki-0.0.1/setup.cfg
ADDED
rireki-0.0.1/setup.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name='rireki',
|
|
5
|
+
version='0.0.1',
|
|
6
|
+
author='Noel De Martin',
|
|
7
|
+
author_email='noeldemartin@gmail.com',
|
|
8
|
+
description='CLI backup tool.',
|
|
9
|
+
long_description=open('README.md').read(),
|
|
10
|
+
long_description_content_type='text/markdown',
|
|
11
|
+
url='https://github.com/noeldemartin/rireki',
|
|
12
|
+
license='MIT',
|
|
13
|
+
packages=['rireki'],
|
|
14
|
+
install_requires=['click', 'toml', 'boto3'],
|
|
15
|
+
entry_points={
|
|
16
|
+
'console_scripts': ['rireki = rireki.cli:cli'],
|
|
17
|
+
},
|
|
18
|
+
)
|