diff --git a/roles/badges/backend/files/systemd/systemd-memory-limit.conf b/roles/badges/backend/files/systemd/systemd-memory-limit.conf new file mode 100644 index 0000000000..6a91cce212 --- /dev/null +++ b/roles/badges/backend/files/systemd/systemd-memory-limit.conf @@ -0,0 +1,2 @@ +[Service] +MemoryLimit=8G diff --git a/roles/badges/backend/tasks/main.yml b/roles/badges/backend/tasks/main.yml index 7befdbbfbb..87d8952608 100644 --- a/roles/badges/backend/tasks/main.yml +++ b/roles/badges/backend/tasks/main.yml @@ -14,6 +14,61 @@ - badges - badges/backend +- name: create systemd config directories + file: > + path="/etc/systemd/system/{{ item }}.service.d" + state=directory + with_items: + - fedmsg-hub + notify: + - reload systemd + tags: + - badges/backend + - config + - service + +- name: install systemd config files (memory) + copy: > + src=systemd/systemd-memory-limit.conf + dest=/etc/systemd/system/{{ item }}.service.d/memory-limit.conf + with_items: + - fedmsg-hub + notify: + - reload systemd + - restart fedmsg-hub + tags: + - badges/backend + - config + - service + +- name: install systemd config files (restart) + template: > + src=systemd-restart-limit.conf.j2 + dest=/etc/systemd/system/{{ item }}.service.d/restart.conf + with_items: + - fedmsg-hub + notify: + - reload systemd + tags: + - badges/backend + - config + - service + +- name: install systemd config files (environment) + template: > + src=systemd-environment.conf.j2 + dest=/etc/systemd/system/{{ item }}.service.d/environment.conf + with_items: + - fedmsg-hub + notify: + - reload systemd + - restart fedmsg-hub + tags: + - badges/backend + - config + - service + + - name: copy database configuration template: > src={{ item }} dest="/etc/fedmsg.d/{{ item }}" diff --git a/roles/badges/backend/templates/systemd-environment.conf.j2 b/roles/badges/backend/templates/systemd-environment.conf.j2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/roles/badges/backend/templates/systemd-restart-limit.conf.j2 b/roles/badges/backend/templates/systemd-restart-limit.conf.j2 new file mode 100644 index 0000000000..9cf6fd950d --- /dev/null +++ b/roles/badges/backend/templates/systemd-restart-limit.conf.j2 @@ -0,0 +1,6 @@ +[Service] +{% if env == 'staging' %} +RestartSec=600 +{% else %} +RestartSec=10 +{% endif %}