diff --git a/README.md b/README.md index 4cdff3d..1968d19 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The package aims to a low load sceanrio. ## Status -This is under development. +Stable - we use this setup on production. ## Try out @@ -31,22 +31,10 @@ target/graalvm/c4k-jira src/test/resources/valid-config.edn src/test/resources/v target/graalvm/c4k-jira src/test/resources/valid-config.edn src/test/resources/valid-auth.edn | kubectl apply -f - ``` -## Manual restore +## Documentation +* [Example Setup on Hetzner](doc/SetupOnHetzner.md) +* [Backup and Restore](doc/BackupAndResotre.md) -1) Scale Jira deployment down: -kubectl scale deployment jira --replicas=0 - -2) apply backup and restore pod: -kubectl apply -f src/main/resources/backup/backup-restore.yaml - -3) exec into pod and execute restore pod -kubectl exec -it backup-restore -- /usr/local/bin/restore.sh - -4) Scale Jira deployment up: -kubectl scale deployment jira --replicas=1 - -5) Update index of Jira: -Jira > Settings > System > Advanced > Indexing ## License Copyright © 2021 meissa GmbH diff --git a/doc/BackupAndRestore.md b/doc/BackupAndRestore.md new file mode 100644 index 0000000..117447b --- /dev/null +++ b/doc/BackupAndRestore.md @@ -0,0 +1,25 @@ +# Backup Architecture details + +![](backup.svg) + +* we use restic to produce small & encrypted backups +* backup is scheduled at `schedule: "10 23 * * *"` +* Jira stores files on `/var/jira`, these files are backuped. If you create a jira xml backup located in /var/jira this file will also be backed up. +* postgres db is backed up as pgdump + +## Manual restore + +1) Scale Jira deployment down: +`kubectl scale deployment jira --replicas=0` + +2) apply backup and restore pod: +`kubectl apply -f src/main/resources/backup/backup-restore.yaml` + +3) exec into pod and execute restore pod +`kubectl exec -it backup-restore -- /usr/local/bin/restore.sh` + +4) Scale Jira deployment up: +`kubectl scale deployment jira --replicas=1` + +5) Update index of Jira: +Jira > Settings > System > Advanced > Indexing diff --git a/doc/SetupOnHetzner.md b/doc/SetupOnHetzner.md new file mode 100644 index 0000000..3117fa1 --- /dev/null +++ b/doc/SetupOnHetzner.md @@ -0,0 +1,74 @@ +# Setup +## Infrastructure on Hetzner / Aws + +For a setup on hetzner / aws we use terraform. + +``` +resource "aws_s3_bucket" "backup" { + bucket = "backup" + acl = "private" + + versioning { + enabled = false + } + tags = { + name = "backup" + Description = "bucket for backups in stage: ${var.stage}" + } +} + +resource "hcloud_server" "jira_09_2021" { + name = "the name" + image = "ubuntu-20.04" + server_type = "cx31" + location = "fsn1" + ssh_keys = ... + + lifecycle { + ignore_changes = [ssh_keys] + } +} + +resource "aws_route53_record" "v4_neu" { + zone_id = the_dns_zone + name = "jira-neu" + type = "A" + ttl = "300" + records = [hcloud_server.jira_09_2021.ipv4_address] +} + +output "ipv4" { + value = hcloud_server.jira_09_2021.ipv4_address +} + +``` + +## k8s minicluster + +For k8s installation we use our [dda-k8s-crate](https://github.com/DomainDrivenArchitecture/dda-k8s-crate) with the following configuation: + + +``` +{:user :k8s + :k8s {:external-ip "ip-from-above"} + :cert-manager :letsencrypt-prod-issuer + :persistent-dirs ["jira", "postgres"] + } +``` + +## kubectl apply c4k-jira + +The last step for applying the jira deployment is + +``` +c4k-jira config.edn auth.edn | kubectl apply -f - +``` + +with the following config.edn: + +``` +{:fqdn "the-fqdn-from aws_route53_record.v4_neu" + :jira-data-volume-path "/var/jira" ;; Volume was configured at dda-k8s-crate, results in a PersistentVolume definition. + :postgres-data-volume-path "/var/postgres" ;; Volume was configured at dda-k8s-crate, results in a PersistentVolume definition. + :restic-repository "s3:s3.amazonaws.com/your-bucket/your-folder"} +``` diff --git a/doc/backup.svg b/doc/backup.svg new file mode 100644 index 0000000..f490489 --- /dev/null +++ b/doc/backup.svg @@ -0,0 +1,273 @@ + + + + + + + + + + image/svg+xml + + + + + + + /var/jira/var/postgres + + + + + + + + + + + + + + + + + + + jira-pod + backuppod + postgrespod + + + + + + + + + + + + restic - backup + + diff --git a/valid-config.edn b/valid-config.edn index f304091..0d7d04b 100644 --- a/valid-config.edn +++ b/valid-config.edn @@ -1,4 +1,4 @@ {:fqdn "jira-neu.test.meissa-gmbh.de" :jira-data-volume-path "/var/jira" :postgres-data-volume-path "/var/postgres" - :restic-repository ""} + :restic-repository "s3:s3.amazonaws.com/your-bucket/your-folder"}