Skip to content

Commit

Permalink
FIX backup port
Browse files Browse the repository at this point in the history
  • Loading branch information
wabscale committed Sep 15, 2023
1 parent b4a2304 commit fc587d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/anubis/jobs/jinja_templates/backup-job.yml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
containers:
- name: backup
image: registry.digitalocean.com/anubis/api:latest
command: ["bash", "-c", "set -ex && cd /mnt && tar czf {{ netid }}-volume.tar.gz {{netid }}-volume && echo '-mkdir {{ backup_host_path }}\nput {{ netid }}-volume.tar.gz {{ backup_host_path }}' | sftp -o StrictHostKeyChecking=no -i /root/.ssh/id_ed25519 -o UserKnownHostsFile=/dev/null {{ backup_host }}"]
command: ["bash", "-c", "set -ex && cd /mnt && tar czf {{ netid }}-volume.tar.gz {{netid }}-volume && echo '-mkdir {{ backup_host_path }}\nput {{ netid }}-volume.tar.gz {{ backup_host_path }}' | sftp -o StrictHostKeyChecking=no -i /root/.ssh/id_ed25519 -P {{ backup_port }} -o UserKnownHostsFile=/dev/null {{ backup_host }}"]
volumeMounts:
- name: anubis-backup-creds
mountPath: "/root/.ssh"
Expand Down
2 changes: 1 addition & 1 deletion api/anubis/jobs/jinja_templates/restore-job.yml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
containers:
- name: backup
image: registry.digitalocean.com/anubis/api:latest
command: ["bash", "-c", "set -ex && cd /mnt && if [ -f {{ netid }}-volume.tar.gz ]; then rm -f {{ netid }}-volume.tar.gz; fi && echo 'get {{ backup_host_path }}/{{ netid }}-volume.tar.gz' | sftp -o StrictHostKeyChecking=no -i /root/.ssh/id_ed25519 -o UserKnownHostsFile=/dev/null {{ backup_host }} && tar xzf {{ netid }}-volume.tar.gz && rm -f {{ netid }}-volume.tar.gz;"]
command: ["bash", "-c", "set -ex && cd /mnt && if [ -f {{ netid }}-volume.tar.gz ]; then rm -f {{ netid }}-volume.tar.gz; fi && echo 'get {{ backup_host_path }}/{{ netid }}-volume.tar.gz' | sftp -P {{ backup_port }} -o StrictHostKeyChecking=no -i /root/.ssh/id_ed25519 -o UserKnownHostsFile=/dev/null {{ backup_host }} && tar xzf {{ netid }}-volume.tar.gz && rm -f {{ netid }}-volume.tar.gz;"]
volumeMounts:
- name: anubis-backup-creds
mountPath: "/root/.ssh"
Expand Down
3 changes: 3 additions & 0 deletions api/anubis/jobs/volume_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def parse_args() -> argparse.ArgumentParser:

gen_parser = sub_parser.add_parser("gen")
gen_parser.add_argument("--backup_host", default="s3.backup.anubis-lms.io")
gen_parser.add_argument("--backup_port", default=2222)
gen_parser.add_argument(
"--backup_host_path", default="/home/anubis/backups/volumes"
)
Expand Down Expand Up @@ -89,6 +90,7 @@ def parse_args() -> argparse.ArgumentParser:

def initialize_gen(args):
backup_host = args.backup_host
backup_port = args.backup_port
backup_host_path = Path(args.backup_host_path) / args.identifier

jobs_identifier_dir = jobs_dir / args.identifier
Expand Down Expand Up @@ -120,6 +122,7 @@ def initialize_gen(args):
restore_job_dir,
{
"backup_host": backup_host,
"backup_port": backup_port,
"backup_host_path": backup_host_path,
"backup_identifier": args.identifier,
"ttl": args.ttl,
Expand Down

0 comments on commit fc587d6

Please sign in to comment.