Skip to content

Commit

Permalink
Adding appsignal and only restarting once
Browse files Browse the repository at this point in the history
  • Loading branch information
clone1018 committed Jan 21, 2021
1 parent 00a3564 commit 9a08dc2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
3 changes: 2 additions & 1 deletion ansible/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
hosts
hosts
hosts.ini
10 changes: 6 additions & 4 deletions ansible/roles/glimesh-web/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---

- name: reload systemctl
command: systemctl daemon-reload

- name: restarted glimesh
systemd:
name: glimesh
state: restarted
daemon_reload: yes
state: restarted

- name: reloaded systemd
systemd:
daemon_reload: yes
18 changes: 9 additions & 9 deletions ansible/roles/glimesh-web/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@
MIX_ENV: prod
# when: glimesh.changed

- name: setup unit file for glimesh.tv
template: src=glimesh.service.j2 dest=/etc/systemd/system/glimesh.service mode=644
tags: config

- name: reload systemd immediately
systemd:
daemon_reload: yes

# Copying the file will automatically restart the daemon.
- name: copy built glimesh.tv
command: cp -Rf /tmp/glimesh.tv/_build/prod /opt/glimesh.tv

Expand All @@ -94,15 +103,6 @@
owner: nobody
recurse: yes

- name: create unit file for glimesh.tv
template: src=glimesh.service.j2 dest=/etc/systemd/system/glimesh.service mode=644
notify:
- reload systemctl
- restarted glimesh

- name: start glimesh
service: name=glimesh.service state=started enabled=yes

- name: wait for service to be online
wait_for:
port: 8080
Expand Down
7 changes: 6 additions & 1 deletion ansible/roles/glimesh-web/templates/glimesh.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ After=syslog.target network.target
User=nobody
Nice=1
Restart=on-abnormal
RestartSec=5
LimitNOFILE=65536
ExecStart=/opt/glimesh.tv/prod/rel/glimesh/bin/glimesh start

Expand Down Expand Up @@ -39,7 +40,7 @@ Environment="HCAPTCHA_SECRET={{ glimesh_hcaptcha_secret }}"

Environment="WAFFLE_ENDPOINT={{ glimesh_waffle_endpoint }}"
Environment="DO_SPACES_PUBLIC_KEY={{ glimesh_do_spaces_public_key }}"
Environment="DO_SPACES_PRIVATE_KEY=+{{ glimesh_do_spaces_private_key }}"
Environment="DO_SPACES_PRIVATE_KEY={{ glimesh_do_spaces_private_key }}"
Environment="DO_SPACES_BUCKET={{ glimesh_do_spaces_bucket }}"

Environment="WAFFLE_ASSET_HOST={{ glimesh_waffle_asset_host }}"
Expand All @@ -48,5 +49,9 @@ Environment="TWITTER_CONSUMER_SECRET={{ glimesh_twitter_consumer_secret }}"
Environment="TWITTER_ACCESS_TOKEN={{ glimesh_twitter_access_token }}"
Environment="TWITTER_ACCESS_SECRET={{ glimesh_twitter_access_secret }}"

Environment="APP_REVISION={{ glimesh_git_hash.stdout }}"
Environment="APPSIGNAL_NAME={{ appsignal_name }}"
Environment="APPSIGNAL_API_KEY={{ appsignal_api_key }}"

[Install]
WantedBy=multi-user.target

0 comments on commit 9a08dc2

Please sign in to comment.