diff --git a/sample_pet/README b/sample_pet/README index 89ee9b4..ce04201 100644 --- a/sample_pet/README +++ b/sample_pet/README @@ -1 +1,31 @@ Pets configuration examples. + +This directory contains sample pet files demonstrating various use cases: + +cron/ + certbot - Let's Encrypt certificate renewal cron job + mdadm - RAID monitoring cron job + +docker/ + docker-compose.yml - Deploy a docker-compose stack (nginx + redis) + +git/ + gitconfig - System-wide git configuration with sensible defaults + +ssh/ + sshd_config - SSH daemon configuration with key-only auth + user_ssh_config - User SSH client configuration + +ssmtp/ + ssmtp.conf - Simple SMTP relay configuration + revaliases - Reverse aliases for outgoing mail + +sudo/ + sudoers - Sudo configuration + sudo_group - Sudo group membership + +systemd/ + backup.service - Systemd service unit for scheduled backups + backup.timer - Systemd timer for daily backup execution + +vimrc - Vim editor configuration diff --git a/sample_pet/docker/docker-compose.yml b/sample_pet/docker/docker-compose.yml new file mode 100644 index 0000000..a13068c --- /dev/null +++ b/sample_pet/docker/docker-compose.yml @@ -0,0 +1,29 @@ +# pets: destfile=/opt/myapp/docker-compose.yml, owner=root, group=docker, mode=0640 +# pets: package=docker.io +# pets: package=docker-compose +# pets: post=/usr/bin/docker-compose -f /opt/myapp/docker-compose.yml up -d +# +# Example: Deploy a simple web application with nginx and redis +# Run 'pets' to install docker packages and deploy the compose stack + +version: '3.8' + +services: + web: + image: nginx:alpine + ports: + - "80:80" + volumes: + - ./html:/usr/share/nginx/html:ro + depends_on: + - cache + restart: unless-stopped + + cache: + image: redis:alpine + volumes: + - redis_data:/data + restart: unless-stopped + +volumes: + redis_data: diff --git a/sample_pet/git/gitconfig b/sample_pet/git/gitconfig new file mode 100644 index 0000000..dfad0db --- /dev/null +++ b/sample_pet/git/gitconfig @@ -0,0 +1,26 @@ +# pets: destfile=/etc/gitconfig, owner=root, group=root, mode=0644 +# pets: package=git +# +# Example: System-wide git configuration +# Sets sensible defaults for all users on the system + +[init] + defaultBranch = main + +[core] + autocrlf = input + editor = vim + +[pull] + rebase = true + +[push] + default = current + autoSetupRemote = true + +[alias] + st = status + co = checkout + br = branch + ci = commit + lg = log --oneline --graph --decorate diff --git a/sample_pet/systemd/backup.service b/sample_pet/systemd/backup.service new file mode 100644 index 0000000..bc90b9b --- /dev/null +++ b/sample_pet/systemd/backup.service @@ -0,0 +1,19 @@ +# pets: destfile=/etc/systemd/system/backup.service, owner=root, group=root, mode=0644 +# pets: post=/bin/systemctl daemon-reload +# +# Example: A systemd service unit for scheduled backups +# Use with backup.timer to run backups on a schedule + +[Unit] +Description=System backup service +After=network-online.target +Wants=network-online.target + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/backup.sh +StandardOutput=journal +StandardError=journal + +[Install] +WantedBy=multi-user.target diff --git a/sample_pet/systemd/backup.timer b/sample_pet/systemd/backup.timer new file mode 100644 index 0000000..796e93b --- /dev/null +++ b/sample_pet/systemd/backup.timer @@ -0,0 +1,16 @@ +# pets: destfile=/etc/systemd/system/backup.timer, owner=root, group=root, mode=0644 +# pets: post=/bin/systemctl daemon-reload +# pets: post=/bin/systemctl enable --now backup.timer +# +# Example: A systemd timer to trigger daily backups at 3am + +[Unit] +Description=Run backup daily + +[Timer] +OnCalendar=*-*-* 03:00:00 +Persistent=true +RandomizedDelaySec=1800 + +[Install] +WantedBy=timers.target