chronicle first run
This commit is contained in:
48
cronicle.tf
Normal file
48
cronicle.tf
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
resource "proxmox_lxc" "cronicle" {
|
||||||
|
target_node = "pve"
|
||||||
|
hostname = "cronicle"
|
||||||
|
vmid = 221
|
||||||
|
ostemplate = "local:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst"
|
||||||
|
password = "terraform"
|
||||||
|
unprivileged = true
|
||||||
|
cores = 6
|
||||||
|
memory = 4096
|
||||||
|
swap = 1024
|
||||||
|
start = true
|
||||||
|
tags = "terraform"
|
||||||
|
nameserver = "192.168.0.24"
|
||||||
|
ssh_public_keys = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINFw70PrMsilcsqCrwW1I6PAt3anQbhmVg+t/HUfomug ryan@mxDesktop"
|
||||||
|
|
||||||
|
features {
|
||||||
|
nesting = true
|
||||||
|
}
|
||||||
|
|
||||||
|
rootfs {
|
||||||
|
storage = "nvme"
|
||||||
|
size = "64G"
|
||||||
|
}
|
||||||
|
|
||||||
|
#mountpoint{
|
||||||
|
# key = "0"
|
||||||
|
# slot = 0
|
||||||
|
# storage = "Cephtest"
|
||||||
|
# mp = "/ceph"
|
||||||
|
# size = "200G"
|
||||||
|
#}
|
||||||
|
|
||||||
|
network {
|
||||||
|
name = "eth0"
|
||||||
|
bridge = "vmbr0"
|
||||||
|
ip = "192.168.0.60/24"
|
||||||
|
gw = "192.168.0.1"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
provisioner "local-exec" {
|
||||||
|
command = "./.ansible.d/setup.sh $IP"
|
||||||
|
environment = {
|
||||||
|
IP = "192.168.0.60"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
99
roles/ind/cronicle/chronicle-install.yml
Normal file
99
roles/ind/cronicle/chronicle-install.yml
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
become: yes
|
||||||
|
remote_user: ansible
|
||||||
|
gather_facts: false
|
||||||
|
|
||||||
|
vars:
|
||||||
|
docker_compose_definition: |
|
||||||
|
services:
|
||||||
|
cronicle:
|
||||||
|
image: ghcr.io/soulteary/cronicle:latest
|
||||||
|
container_name: cronicle
|
||||||
|
hostname: cronicle
|
||||||
|
environment:
|
||||||
|
- TZ=America/Chicago
|
||||||
|
volumes:
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
- /etc/timezone:/etc/timezone:ro
|
||||||
|
- ./data/data:/opt/cronicle/data
|
||||||
|
- ./data/logs:/opt/cronicle/logs
|
||||||
|
- ./data/plugins:/opt/cronicle/plugins
|
||||||
|
ports:
|
||||||
|
- 3012:3012
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider localhost:3012/api/app/ping || exit 1"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 1s
|
||||||
|
retries: 3
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "10m"
|
||||||
|
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Upgrade-packages.yml - update packages
|
||||||
|
include: ../../lib/upgrade-packages.yml
|
||||||
|
|
||||||
|
- name: Install-docker.yml - setting up docker
|
||||||
|
include: ../../lib/install-docker.yml
|
||||||
|
|
||||||
|
- name: Install Restic and setup
|
||||||
|
include: ../../lib/setup-restic.yml
|
||||||
|
|
||||||
|
- name: Setup Restic Cron jobs
|
||||||
|
include: ../../lib/setup-restic-cron.yml
|
||||||
|
|
||||||
|
- name: Setup Service
|
||||||
|
copy:
|
||||||
|
dest: /etc/systemd/system/cronicle.service
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=cronicle
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=cronicle
|
||||||
|
WorkingDirectory=/home/docker/
|
||||||
|
ExecStart=docker compose up -d
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
# docker image is broken using manual install method
|
||||||
|
- name: Write docker-compose.yml
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: "{{ docker_compose_definition }}"
|
||||||
|
dest: /home/docker/docker-compose.yml
|
||||||
|
owner: docker
|
||||||
|
group: docker
|
||||||
|
mode: u=rw,g=r,o=r
|
||||||
|
|
||||||
|
- name: Check if cronicle's data directory exists
|
||||||
|
stat:
|
||||||
|
path: /data/data
|
||||||
|
register: cronicle_stat
|
||||||
|
|
||||||
|
- name: Restore cronicle Dir
|
||||||
|
shell: |
|
||||||
|
restic --password-file /home/restic/.resticpassword -r sftp:misamisa://home/restic/$(hostname) --target / restore latest
|
||||||
|
args:
|
||||||
|
chdir: /home/restic
|
||||||
|
creates: /data/cronicle
|
||||||
|
when: not cronicle_stat.stat.exists or not cronicle_stat.stat.isdir
|
||||||
|
|
||||||
|
- name: Reload systemd daemon
|
||||||
|
systemd:
|
||||||
|
daemon_reload: yes
|
||||||
|
|
||||||
|
- name: Start cronicle Service
|
||||||
|
systemd:
|
||||||
|
name: cronicle
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
18
roles/ind/cronicle/cron.vars
Normal file
18
roles/ind/cronicle/cron.vars
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
cronjob:
|
||||||
|
|
||||||
|
- name: appdata
|
||||||
|
job_name: "Daily /data/ Backup"
|
||||||
|
job_minute: "0"
|
||||||
|
job_hour: "3"
|
||||||
|
job_day: "*"
|
||||||
|
user: "root"
|
||||||
|
job_command: "/home/restic/restic.sh --backup /data/ "
|
||||||
|
|
||||||
|
- name: weeklydb
|
||||||
|
job_name: "Weekly /data/ verification"
|
||||||
|
job_minute: "10"
|
||||||
|
job_hour: "6"
|
||||||
|
job_day: "1"
|
||||||
|
user: "root"
|
||||||
|
job_command: "/home/restic/restic.sh --verify /data/"
|
||||||
Reference in New Issue
Block a user