restart docker-compose on failure and allow continuous deployment

This commit is contained in:
Elizabeth Hunt 2024-04-03 16:02:52 -04:00
parent 50f053e7db
commit b167d75be5
3 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,4 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEBEAOOzWvuGoaj0HRVIod5KPtqkZgO0jEVsqOvKaJoE continuousdeploymentdrone@hatecomputers.club
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDRHu3h9mDjQyFbojcxGKW0hPUDfgUmb2WCzd4Dv2qISM3GGt9LjD8o0IbWRNaTf5UyId5lu7wNHtygs5ZDfUVnlfxrI1CmoExuqkYFjy+R9Cu0x1J2w7+MrKPBd5akLCuKTTnXbyv79T0tLb07rCpGHojW8HH6wdDtg0siVqsPqZVTjg7WGbBYqiqlA5p8s+V9xN1q8lTOZrRI0PdgoU8W+1oIr9OHSG1ZeUBQx60izTEwMnWBxY2aA8SQolIVvsJCcMMc/EAnaz/rdJ5IkeqXGslIhUI7WCPHnPWN8CSdwMOLi5BNaOAK7Y2FkfKTUlO7I52BL87Cl3YpMxR0mTDrfSJTSp0B3ZAbUIXDA7biSh04YLwGQVI799vcyJf355A60btPaiuiBgI0am3h0WxnOACg7K6eV023EiUQ24UjlQ8pufHcJ1oDW8v6LHlp/atCWOl9KQIun9UUg8DD8/BLPprc0wzAV6Nco0ZIedouxZuUhduYYvUrLJ+ICpaZg6oPGitVJPIgyyI+WTfjRN4WTj/Z3Yhuj0RqF8b5ea4FNWuJtfF724t7SVnZsYlZGSCqL8gaEzbIATVe3THn5VwbK+S4ELD/9W6MOd6aZcTOK2yP3jlwjcjnW8sLuX+2qNwtSVVa4o5VsRZU40Da+3flzoBsyUwSE3H2PsFPH29lIQ==
lizzy@yubikey

View File

@ -44,6 +44,13 @@
notify: notify:
- Restart sshd - Restart sshd
- name: Copy authorized keys
ansible.builtin.copy:
src: files/authorized_keys
dest: /root/.ssh/authorized_keys
owner: root
group: root
## FAIL2BAN ## FAIL2BAN
- name: Install Fail2Ban - name: Install Fail2Ban
ansible.builtin.apt: ansible.builtin.apt:

View File

@ -4,12 +4,15 @@ Requires=docker.service
After=docker.service After=docker.service
[Service] [Service]
Type=oneshot
RemainAfterExit=true RemainAfterExit=true
WorkingDirectory=/etc/docker/compose/%i WorkingDirectory=/etc/docker/compose/%i
ExecStartPre=/usr/bin/docker compose pull ExecStartPre=/usr/bin/docker compose pull
ExecStart=/usr/bin/docker compose up --detach --remove-orphans ExecStart=/usr/bin/docker compose up --detach --remove-orphans
ExecStop=/usr/bin/docker compose down ExecStop=/usr/bin/docker compose down
Restart=always
RestartSec=5
StartLimitInterval=500
StartLimitBurst=3
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target