Compare commits

..

No commits in common. "d6c2dd419a9ca60e27986811603d8db15a89636b" and "517e75a3a344486237b0a40ee3ffdfc0dadac2ff" have entirely different histories.

13 changed files with 56 additions and 75 deletions

View file

@ -19,6 +19,11 @@ TF_VAR_aws_region=
TF_VAR_aws_access_key= TF_VAR_aws_access_key=
TF_VAR_aws_secret_key= TF_VAR_aws_secret_key=
TF_VAR_contabo_client_id=
TF_VAR_contabo_client_secret=
TF_VAR_contabo_user=
TF_VAR_contabo_pass=
TF_VAR_hcloud_token= TF_VAR_hcloud_token=
TF_VAR_healthchecksio_api_key= TF_VAR_healthchecksio_api_key=

View file

@ -52,10 +52,10 @@ resource "ovh_domain_zone_record" "tailscale_vpn" {
target = each.value.address target = each.value.address
} }
resource "ovh_domain_zone_record" "gpg_verify" { resource "ovh_domain_zone_record" "status_page_cname" {
zone = "serguzim.net" zone = "serguzim.net"
subdomain = "" subdomain = "status"
fieldtype = "TXT" fieldtype = "CNAME"
ttl = 3600 ttl = 3600
target = "openpgp4fpr:723B78C0BF8D8C721D2C4EEF41E544A54E2533B2" target = "status.serguzim.me."
} }

View file

@ -75,7 +75,6 @@ class FilterModule(object):
"group": mon.get("group"), "group": mon.get("group"),
"url": url, "url": url,
"conditions": conditions, "conditions": conditions,
"interval": mon.get("interval"),
"alerts": self.default_alerts, "alerts": self.default_alerts,
"ui": { "ui": {
"hide-url": True "hide-url": True

View file

@ -35,3 +35,14 @@
ansible.builtin.import_tasks: recovery.yml ansible.builtin.import_tasks: recovery.yml
- name: Import tasks specific to systemd - name: Import tasks specific to systemd
ansible.builtin.import_tasks: systemd.yml ansible.builtin.import_tasks: systemd.yml
- name: Verify service
ansible.builtin.command:
cmd: autorestic -v check
chdir: "{{ service_path }}"
changed_when: false
become: true
register: cmd_result_verify
until: "cmd_result_verify is not failed"
retries: 10
delay: 10

View file

@ -1,2 +1 @@
<script async src="/_a/script.js" data-website-id="{{ vault_forgejo.umami }}"></script> <script async src="/_a/script.js" data-website-id="{{ vault_forgejo.umami }}"></script>
<script async src="/_a/track-external.js"></script>

View file

@ -22,7 +22,6 @@ forgejo_runner_compose:
docker-in-docker: docker-in-docker:
image: docker:dind image: docker:dind
privileged: true privileged: true
dns: 1.1.1.1
restart: always restart: always
command: dockerd -H tcp://0.0.0.0:2375 --tls=false command: dockerd -H tcp://0.0.0.0:2375 --tls=false
networks: networks:

View file

@ -14,7 +14,7 @@ homebox_env:
homebox_compose: homebox_compose:
watchtower: update watchtower: update
image: ghcr.io/sysadminsmedia/homebox:0-rootless image: ghcr.io/sysadminsmedia/homebox:latest-rootless
volumes: volumes:
- data:/data - data:/data
file: file:

View file

@ -10,21 +10,6 @@ umami_docker_image: docker.umami.dev/umami-software/umami:postgresql-latest
umami_svc: umami_svc:
domain: "{{ all_services | service_get_domain(role_name) }}" domain: "{{ all_services | service_get_domain(role_name) }}"
caddy_extra: |
handle /track-external.js {
header Content-Type text/javascript
respond <<JS
(() => {
const name = 'outbound-link-click';
document.querySelectorAll('a').forEach(a => {
if (a.host !== window.location.host && !a.getAttribute('data-umami-event')) {
a.setAttribute('data-umami-event', name);
a.setAttribute('data-umami-event-url', a.href);
}
});
})();
JS 200
}
port: 3000 port: 3000
umami_env: umami_env:

View file

@ -3,7 +3,7 @@
hosts: serguzim_net hosts: serguzim_net
become: true become: true
tasks: tasks:
- name: Unlock backups - name: Change password
ansible.builtin.shell: ansible.builtin.shell:
cmd: autorestic unlock --force && autorestic exec -va unlock cmd: autorestic unlock --force && autorestic exec -va unlock
chdir: "{{ (services_path, 'backup') | path_join }}" chdir: "{{ (services_path, 'backup') | path_join }}"

View file

@ -1,15 +0,0 @@
---
- name: Unlock backups
hosts: serguzim_net
become: true
tasks:
- name: Verify backup
ansible.builtin.command:
cmd: autorestic -v check
chdir: "{{ (services_path, 'backup') | path_join }}"
changed_when: false
become: true
register: cmd_result_verify
until: "cmd_result_verify is not failed"
retries: 10
delay: 10

View file

@ -15,25 +15,16 @@ external: {
} }
} }
classes: { {% for host in hosts %}
zero_grid: { {{ host.key }}: {
grid-columns: 3
grid-gap: 0
}
monitored: {
style: {
fill: "#1E9025"
}
}
backup: {
style: {
fill: "#0f0"
}
}
} }
{% for host in hosts %} {{ host.key }}.backup -> external.restic {
{{ host.key }} style: {
stroke: "#0f0"
stroke-dash: 3
}
}
{% endfor %}{# host #} {% endfor %}{# host #}
{% for svc in svcs %} {% for svc in svcs %}
@ -45,25 +36,32 @@ classes: {
} }
{% for backup in svc.backup or [] %} {% for backup in svc.backup or [] %}
{{ svc.key }}.'{{ backup.name }}'.class: backup {{ svc.key }} -> {{ svc.host_key }}.backup: {{ backup.name }} {
{% endfor %} style: {
stroke: "#0f0"
stroke-dash: 3
}
}
{% endfor %}{# backup #}
{% if svc.monitoring %} {% if svc.monitoring %}
{{ svc.key }}.monitored.class: monitored {{ monitoring_key }} -> {{ svc.key }}: {
style.stroke: "#1E9025"
}
{% endif %} {% endif %}
{% if svc.database %} {% if svc.database %}
{{ svc.key }} -> {{ db_key }}: { {{ svc.key }} -> {{ db_key }}: {
style.stroke: "#336791" style.stroke: "#336791"
} }
{{ db_subkey }}.{{ svc.name }} {{ db_key }}.{{ svc.name }}
{% endif %} {% endif %}
{% if svc.auth %} {% if svc.auth %}
{{ svc.key }} -> {{ auth_key }}: { {{ svc.key }} -> {{ auth_key }}: {
style.stroke: "#FD4B2D" style.stroke: "#FD4B2D"
} }
{{ auth_subkey }}.{{ svc.name }} {{ auth_key }}.{{ svc.name }}
{% endif %} {% endif %}
{% if svc.s3 %} {% if svc.s3 %}
@ -80,11 +78,14 @@ external.scaleway.s3.{{ svc.name }}
{{ svc.key }} -> {{ mail_key }}: { {{ svc.key }} -> {{ mail_key }}: {
style.stroke: "#C9B81F" style.stroke: "#C9B81F"
} }
{{ mail_subkey }}.{{ svc.name }} {{ mail_key }}.{{ svc.name }}
{% endif %} {% endif %}
{% endfor %}{# svc #} {% endfor %}{# svc #}
{% for svc in grid_svcs %} {% for svc in grid_svcs %}
{{ svc }}.class: zero_grid {{ svc }}: {
grid-columns: 3
grid-gap: 0
}
{% endfor %} {% endfor %}

View file

@ -148,7 +148,6 @@ variable "services" {
monitoring = optional(object({ monitoring = optional(object({
url = optional(string) url = optional(string)
group = optional(string) group = optional(string)
interval = optional(string)
conditions = optional(list(string)) conditions = optional(list(string))
})) }))
ports = optional(list(object({ ports = optional(list(object({

View file

@ -11,7 +11,6 @@ icon_overrides = {
"backup": "restic", "backup": "restic",
"dokku": None, "dokku": None,
"extra_services": None, "extra_services": None,
"factorio": None,
"forgejo_runner": "forgejo", "forgejo_runner": "forgejo",
"healthcheck": "healthchecks", "healthcheck": "healthchecks",
"lego": "lets-encrypt", "lego": "lets-encrypt",
@ -97,21 +96,20 @@ if __name__ == '__main__':
with open('./services.auto.tfvars', 'r') as file: with open('./services.auto.tfvars', 'r') as file:
services = hcl2.load(file)["services"][0] services = hcl2.load(file)["services"][0]
keys = {} db_key = service_key_find("postgresql", services, hosts)
keys["db_key"] = service_key_find("postgresql", services, hosts) auth_key = service_key_find("authentik", services, hosts)
keys["db_subkey"] = f"{keys["db_key"]}.dbs" monitoring_key = service_key_find("gatus", services, hosts)
keys["auth_key"] = service_key_find("authentik", services, hosts) mail_key = service_key_find("mailcowdockerized", services, hosts)
keys["auth_subkey"] = f"{keys["auth_key"]}.apps"
keys["mail_key"] = service_key_find("mailcowdockerized", services, hosts)
keys["mail_subkey"] = f"{keys["mail_key"]}.mailboxes"
keys["monitoring_key"] = service_key_find("gatus", services, hosts)
jinja_loader = jinja2.FileSystemLoader(searchpath="./templates") jinja_loader = jinja2.FileSystemLoader(searchpath="./templates")
jinja_env = jinja2.Environment(loader=jinja_loader) jinja_env = jinja2.Environment(loader=jinja_loader)
template = jinja_env.get_template("infrastructure.d2.j2") template = jinja_env.get_template("infrastructure.d2.j2")
print(template.render( print(template.render(
grid_svcs=[keys["db_subkey"], keys["auth_subkey"], keys["mail_subkey"]], grid_svcs=[db_key, auth_key, mail_key],
svcs=parse_services(services, hosts), svcs=parse_services(services, hosts),
hosts=parse_hosts(hosts), hosts=parse_hosts(hosts),
**keys db_key=db_key,
auth_key=auth_key,
monitoring_key=monitoring_key,
mail_key=mail_key,
)) ))