@yunuseon/kayra 0.0.0-stage → 0.5.0

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.
Files changed (101) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +81 -2
  3. package/ansible/.ansible-lint +13 -0
  4. package/ansible/ansible.cfg +12 -0
  5. package/ansible/playbooks/adopt.yml +35 -0
  6. package/ansible/playbooks/app.yml +21 -0
  7. package/ansible/playbooks/apps-prune.yml +30 -0
  8. package/ansible/playbooks/edge.yml +41 -0
  9. package/ansible/playbooks/nas.yml +47 -0
  10. package/ansible/playbooks/platform.yml +62 -0
  11. package/ansible/requirements.yml +7 -0
  12. package/ansible/roles/app/defaults/main.yml +9 -0
  13. package/ansible/roles/app/tasks/main.yml +107 -0
  14. package/ansible/roles/app/templates/app.env.j2 +9 -0
  15. package/ansible/roles/app/templates/casc-app.yaml.j2 +68 -0
  16. package/ansible/roles/backup-check/files/backup-check.service +9 -0
  17. package/ansible/roles/backup-check/files/backup-check.timer +10 -0
  18. package/ansible/roles/backup-check/tasks/main.yml +59 -0
  19. package/ansible/roles/backup-check/templates/backup-check.sh.j2 +117 -0
  20. package/ansible/roles/common/handlers/main.yml +16 -0
  21. package/ansible/roles/common/tasks/main.yml +100 -0
  22. package/ansible/roles/compose-stacks/tasks/main.yml +102 -0
  23. package/ansible/roles/docker/defaults/main.yml +3 -0
  24. package/ansible/roles/docker/files/buildkit-rootless +23 -0
  25. package/ansible/roles/docker/handlers/main.yml +12 -0
  26. package/ansible/roles/docker/tasks/main.yml +82 -0
  27. package/ansible/roles/edge-proxy/files/docker-compose.yml +13 -0
  28. package/ansible/roles/edge-proxy/handlers/main.yml +6 -0
  29. package/ansible/roles/edge-proxy/tasks/main.yml +34 -0
  30. package/ansible/roles/edge-proxy/templates/Caddyfile.j2 +25 -0
  31. package/ansible/roles/forgejo-config/tasks/main.yml +333 -0
  32. package/ansible/roles/platform/defaults/main.yml +76 -0
  33. package/ansible/roles/platform/tasks/main.yml +298 -0
  34. package/ansible/roles/platform/templates/authelia-users.yml.j2 +17 -0
  35. package/ansible/roles/platform/templates/platform.env.j2 +41 -0
  36. package/ansible/roles/restic-backup/files/docker-compose.postgres.yml +27 -0
  37. package/ansible/roles/restic-backup/files/docker-compose.yml +12 -0
  38. package/ansible/roles/restic-backup/handlers/main.yml +7 -0
  39. package/ansible/roles/restic-backup/tasks/main.yml +121 -0
  40. package/ansible/roles/restic-backup/templates/backup.env.j2 +9 -0
  41. package/ansible/roles/restic-backup/templates/backup.sh.j2 +28 -0
  42. package/ansible/roles/restic-backup/templates/docker-compose.override.yml.j2 +26 -0
  43. package/ansible/roles/restic-backup/templates/follow-restore-test.sh.j2 +28 -0
  44. package/ansible/roles/restic-backup/templates/restore-test.sh.j2 +51 -0
  45. package/ansible/roles/restic-backup/templates/root.crontab.j2 +6 -0
  46. package/ansible/roles/restic-backup/templates/ssh_config.j2 +12 -0
  47. package/ansible/roles/wireguard/handlers/main.yml +9 -0
  48. package/ansible/roles/wireguard/tasks/main.yml +33 -0
  49. package/ansible/roles/wireguard/templates/wg0.conf.j2 +12 -0
  50. package/bin/kayra.js +29 -0
  51. package/cli/dist/brand.js +41 -0
  52. package/cli/dist/cli.js +21 -0
  53. package/cli/dist/commands/doctor.js +79 -0
  54. package/cli/dist/commands/server.js +215 -0
  55. package/cli/dist/commands/status.js +43 -0
  56. package/cli/dist/fleet.js +134 -0
  57. package/cli/dist/interpret.js +98 -0
  58. package/cli/dist/load.js +49 -0
  59. package/cli/dist/main.js +94 -0
  60. package/cli/dist/plan.js +31 -0
  61. package/cli/dist/result.js +5 -0
  62. package/cloud-init.yml.tpl +14 -0
  63. package/compose/authelia/configuration.yml +138 -0
  64. package/compose/buildkit/buildkitd.toml +14 -0
  65. package/compose/docker-compose.acme-dns.yml +12 -0
  66. package/compose/docker-compose.ci.yml +156 -0
  67. package/compose/docker-compose.yml +83 -0
  68. package/compose/jenkins/Dockerfile +40 -0
  69. package/compose/jenkins/casc/00-platform.yaml +158 -0
  70. package/compose/jenkins/plugins.txt +97 -0
  71. package/compose/jenkins-agent/Dockerfile +24 -0
  72. package/compose/traefik/dynamic/authelia.yml +18 -0
  73. package/compose/traefik/dynamic/middlewares.yml +14 -0
  74. package/compose/traefik/dynamic/ratelimit.yml +21 -0
  75. package/compose/traefik/dynamic/tls.yml +9 -0
  76. package/compose/traefik/traefik.yml +46 -0
  77. package/hosts.conf +6 -0
  78. package/package.json +73 -4
  79. package/scripts/local/app-manifests.sh +26 -0
  80. package/scripts/local/authelia-dev-init.sh +58 -0
  81. package/scripts/local/certs.sh +55 -0
  82. package/scripts/local/home-image.sh +55 -0
  83. package/scripts/local/home-reach.sh +41 -0
  84. package/scripts/local/require-main.sh +38 -0
  85. package/scripts/local/setup-hosts.sh +30 -0
  86. package/scripts/server/app-purge +26 -0
  87. package/scripts/server/app-remove +30 -0
  88. package/scripts/server/jenkins-api +28 -0
  89. package/scripts/server/jenkins-app-apply +36 -0
  90. package/scripts/server/jenkins-reload +12 -0
  91. package/terraform/modules/hcloud-firewall/main.tf +54 -0
  92. package/terraform/modules/hcloud-firewall/outputs.tf +9 -0
  93. package/terraform/modules/hcloud-firewall/variables.tf +22 -0
  94. package/terraform/modules/hcloud-server/main.tf +62 -0
  95. package/terraform/modules/hcloud-server/outputs.tf +19 -0
  96. package/terraform/modules/hcloud-server/templates/inventory.ini.tpl +5 -0
  97. package/terraform/modules/hcloud-server/variables.tf +50 -0
  98. package/terraform/modules/multipass-instance/main.tf +67 -0
  99. package/terraform/modules/multipass-instance/outputs.tf +19 -0
  100. package/terraform/modules/multipass-instance/templates/inventory.ini.tpl +5 -0
  101. package/terraform/modules/multipass-instance/variables.tf +39 -0
@@ -0,0 +1,67 @@
1
+ # =============================================================================
2
+ # Multipass Instance Module
3
+ # Provisions a local VM via Multipass with the same cloud-init as production.
4
+ # Generates a dedicated, disposable SSH keypair for the instance — unlike
5
+ # the hcloud-server module, which expects the operator's own persistent key.
6
+ # =============================================================================
7
+
8
+ terraform {
9
+ required_providers {
10
+ multipass = {
11
+ source = "todoroff/multipass"
12
+ }
13
+ tls = {
14
+ source = "hashicorp/tls"
15
+ }
16
+ local = {
17
+ source = "hashicorp/local"
18
+ }
19
+ }
20
+ }
21
+
22
+ resource "tls_private_key" "deploy" {
23
+ algorithm = "ED25519"
24
+ }
25
+
26
+ resource "local_sensitive_file" "private_key" {
27
+ content = tls_private_key.deploy.private_key_openssh
28
+ filename = "${var.ssh_key_dir}/${var.name}_ed25519"
29
+ file_permission = "0600"
30
+ }
31
+
32
+ resource "local_file" "public_key" {
33
+ content = tls_private_key.deploy.public_key_openssh
34
+ filename = "${var.ssh_key_dir}/${var.name}_ed25519.pub"
35
+ }
36
+
37
+ # ---------------------------------------------------------------------------
38
+ # Instance
39
+ # ---------------------------------------------------------------------------
40
+ resource "multipass_instance" "this" {
41
+ name = var.name
42
+ image = var.image
43
+ cpus = var.cpus
44
+ memory = var.memory
45
+ disk = var.disk
46
+
47
+ cloud_init = templatefile("${path.module}/../../../cloud-init.yml.tpl", {
48
+ hostname = var.name
49
+ ssh_pubkey = tls_private_key.deploy.public_key_openssh
50
+ })
51
+
52
+ wait_for_cloud_init = true
53
+ }
54
+
55
+ # ---------------------------------------------------------------------------
56
+ # Ansible inventory file
57
+ # ---------------------------------------------------------------------------
58
+ resource "local_file" "ansible_inventory" {
59
+ content = templatefile("${path.module}/templates/inventory.ini.tpl", {
60
+ hostname = var.name
61
+ ssh_host = multipass_instance.this.ipv4[0]
62
+ ssh_port = 22
63
+ ssh_user = "deploy"
64
+ ssh_key_path = local_sensitive_file.private_key.filename
65
+ })
66
+ filename = var.inventory_path
67
+ }
@@ -0,0 +1,19 @@
1
+ output "ipv4_address" {
2
+ description = "Primary IPv4 address of the instance"
3
+ value = multipass_instance.this.ipv4[0]
4
+ }
5
+
6
+ output "instance_name" {
7
+ description = "Multipass instance name"
8
+ value = multipass_instance.this.name
9
+ }
10
+
11
+ output "inventory_path" {
12
+ description = "Path to the generated Ansible inventory"
13
+ value = local_file.ansible_inventory.filename
14
+ }
15
+
16
+ output "ssh_private_key_path" {
17
+ description = "Path to the generated SSH private key"
18
+ value = local_sensitive_file.private_key.filename
19
+ }
@@ -0,0 +1,5 @@
1
+ [servers]
2
+ ${hostname} ansible_host=${ssh_host} ansible_port=${ssh_port} ansible_user=${ssh_user} ansible_ssh_private_key_file=${ssh_key_path}
3
+
4
+ [servers:vars]
5
+ ansible_ssh_common_args=-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
@@ -0,0 +1,39 @@
1
+ variable "name" {
2
+ description = "Instance name"
3
+ type = string
4
+ }
5
+
6
+ variable "image" {
7
+ description = "Multipass image alias"
8
+ type = string
9
+ default = "24.04"
10
+ }
11
+
12
+ variable "cpus" {
13
+ description = "Virtual CPU count"
14
+ type = number
15
+ default = 2
16
+ }
17
+
18
+ variable "memory" {
19
+ description = "Memory size (e.g. 4G)"
20
+ type = string
21
+ default = "2G"
22
+ }
23
+
24
+ variable "disk" {
25
+ description = "Disk size (e.g. 20G)"
26
+ type = string
27
+ default = "10G"
28
+ }
29
+
30
+ variable "ssh_key_dir" {
31
+ description = "Directory to write the generated SSH keypair into"
32
+ type = string
33
+ }
34
+
35
+ variable "inventory_path" {
36
+ description = "Path to write the Ansible inventory file"
37
+ type = string
38
+ default = "./inventory.ini"
39
+ }