You've already forked proxmox-backup
add sshportal backup
This commit is contained in:
@@ -19,6 +19,7 @@ The custom script :
|
|||||||
- can dump MariaDB database(s), including routines/events/triggers
|
- can dump MariaDB database(s), including routines/events/triggers
|
||||||
- can dump PostgreSQL database(s)
|
- can dump PostgreSQL database(s)
|
||||||
- can dump Gitea data
|
- can dump Gitea data
|
||||||
|
- can dump sshportal data
|
||||||
|
|
||||||
All files are then send it to a custom Proxmox Backup Server.
|
All files are then send it to a custom Proxmox Backup Server.
|
||||||
|
|
||||||
@@ -64,6 +65,12 @@ Role variables
|
|||||||
| backup_gitea_docker_container | string | | | required if docker enabled |
|
| backup_gitea_docker_container | string | | | required if docker enabled |
|
||||||
| backup_gitea_docker_workdir | string | | /backup | container workdir where gitea dump is generated |
|
| backup_gitea_docker_workdir | string | | /backup | container workdir where gitea dump is generated |
|
||||||
| backup_gitea_docker_host_temp_dir | string | | {{ backup_dir }}/temp | host temp dir mounted in container |
|
| backup_gitea_docker_host_temp_dir | string | | {{ backup_dir }}/temp | host temp dir mounted in container |
|
||||||
|
| backup_sshportal_enabled | boolean | | false | enable sshportal backup |
|
||||||
|
| backup_sshportal_db_path | string | | /var/lib/docker/volumes/sshportal__var_lib_sshportal/_data/sshportal.db | sqlite db path |
|
||||||
|
| backup_sshportal_ssh_host | string | | localhost | ssh host |
|
||||||
|
| backup_sshportal_ssh_port | string | | 2222 | ssh port |
|
||||||
|
| backup_sshportal_ssh_user | string | | admin | ssh user |
|
||||||
|
| backup_sshportal_ssh_key | string | | /opt/docker-compose/sshportal/ed25519_sshportal_admin | ssh private key |
|
||||||
| backup_cron_minute | int | | | |
|
| backup_cron_minute | int | | | |
|
||||||
| backup_cron_hour | int | | | |
|
| backup_cron_hour | int | | | |
|
||||||
|
|
||||||
@@ -132,6 +139,13 @@ backup_gitea_config: '/data/gitea/conf/app.ini'
|
|||||||
backup_gitea_docker_enabled: true
|
backup_gitea_docker_enabled: true
|
||||||
backup_gitea_docker_container: 'gitea'
|
backup_gitea_docker_container: 'gitea'
|
||||||
|
|
||||||
|
backup_sshportal_enabled: true
|
||||||
|
backup_sshportal_db_path: '/var/lib/docker/volumes/sshportal__var_lib_sshportal/_data/sshportal.db'
|
||||||
|
backup_sshportal_ssh_host: 'localhost'
|
||||||
|
backup_sshportal_ssh_port: '2222'
|
||||||
|
backup_sshportal_ssh_user: 'admin'
|
||||||
|
backup_sshportal_ssh_key: '/opt/docker-compose/sshportal/ed25519_sshportal_admin'
|
||||||
|
|
||||||
backup_cron_minute: 30
|
backup_cron_minute: 30
|
||||||
backup_cron_hour: 5
|
backup_cron_hour: 5
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -221,6 +221,22 @@ fi
|
|||||||
## end of gitea ##
|
## end of gitea ##
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if backup_sshportal_enabled is sameas true %}
|
||||||
|
## sshportal ##
|
||||||
|
backup_sshportal_db_path="{{ backup_sshportal_db_path | default('/var/lib/docker/volumes/sshportal__var_lib_sshportal/_data/sshportal.db') }}"
|
||||||
|
backup_sshportal_ssh_host="{{ backup_sshportal_ssh_host | default('localhost') }}"
|
||||||
|
backup_sshportal_ssh_port="{{ backup_sshportal_ssh_port | default('2222') }}"
|
||||||
|
backup_sshportal_ssh_user="{{ backup_sshportal_ssh_user | default('admin') }}"
|
||||||
|
backup_sshportal_ssh_key="{{ backup_sshportal_ssh_key | default('/opt/docker-compose/sshportal/ed25519_sshportal_admin') }}"
|
||||||
|
|
||||||
|
mkdir -p "$backup_dir/$today/sshportal"
|
||||||
|
|
||||||
|
/usr/bin/sqlite3 "$backup_sshportal_db_path" .dump > "$backup_dir/$today/sshportal/sshportal.sql.bkp"
|
||||||
|
|
||||||
|
/usr/bin/ssh -i "$backup_sshportal_ssh_key" -p "$backup_sshportal_ssh_port" -l "$backup_sshportal_ssh_user" "$backup_sshportal_ssh_host" config backup > "$backup_dir/$today/sshportal/backup.json"
|
||||||
|
## end of sshportal ##
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# purge old backups
|
# purge old backups
|
||||||
find $backup_dir -type d -ctime +$backup_local_retention -exec rm -rf {} \;
|
find $backup_dir -type d -ctime +$backup_local_retention -exec rm -rf {} \;
|
||||||
|
|
||||||
@@ -253,6 +269,9 @@ mariadb.pxar:$backup_dir/$today/mariadb \
|
|||||||
{% if backup_gitea_enabled is sameas true %}
|
{% if backup_gitea_enabled is sameas true %}
|
||||||
gitea.pxar:$backup_dir/$today/gitea \
|
gitea.pxar:$backup_dir/$today/gitea \
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if backup_sshportal_enabled is sameas true %}
|
||||||
|
sshportal.pxar:$backup_dir/$today/sshportal \
|
||||||
|
{% endif %}
|
||||||
--rate ${PBS_RATE}
|
--rate ${PBS_RATE}
|
||||||
## end of send to PBS ##
|
## end of send to PBS ##
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user