{"action":"created","comment":{"url":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls/comments/152304472","pull_request_review_id":78145267,"id":152304472,"diff_hunk":"@@ -0,0 +1,47 @@\n+# only supports 16.04!\n+\n+{% if pillar.elife.php.processes.enabled %}\n+{% for name, configuration in pillar.elife.php.processes.configuration.items() %}\n+{% set hyphenized = name | replace('_', '-') %}\n+{% set service_name = salt['elife.project_name']() + '-' + hyphenized %}\n+php-long-running-process-service-{{ hyphenized }}:\n+    file.managed:\n+        - name: /lib/systemd/system/{{ service_name }}@.service\n+        - source: salt://elife/config/lib-systemd-system-php-service.service\n+        - template: jinja\n+        - context:\n+            name: {{ hyphenized }}\n+            folder: {{ configuration.folder }}\n+            command: {{ configuration.command }}\n+        - require:\n+            - php\n+            {% if configuration.get('require', None) -%}\n+            - {{ configuration.get('require') }}\n+            {%- endif %}\n+        - require_in:\n+            - cmd: php-long-running-processes-load-configuration\n+{% endfor %}\n+\n+php-long-running-processes-load-configuration:\n+    cmd.run:\n+        - name: systemctl daemon-reload\n+\n+{% for name, configuration in pillar.elife.php.processes.configuration.items() %}\n+{% set hyphenized = name | replace('_', '-') %}\n+{% set service_name = salt['elife.project_name']() + '-' + hyphenized %}\n+{% for i in range(1, configuration['number'] + 1) %}\n+php-long-running-process-service-{{ hyphenized }}-{{ i }}-enable:\n+    cmd.run:\n+        - name: systemctl enable {{ service_name }}@{{ i }}\n+        - require:\n+            - php-long-running-process-service-{{ hyphenized }}\n+        - require_in:\n+            - file: php-long-running-process-service-{{ hyphenized }}-parallel-restart\n+{% endfor %}\n+\n+# TODO: this could be a single command for all kinds of processes","path":"elife/php-long-running-processes.sls","position":42,"original_position":42,"commit_id":"894708618f57c3028f609297bf4d03fc3e2f09be","original_commit_id":"894708618f57c3028f609297bf4d03fc3e2f09be","user":{"login":"giorgiosironi","id":160299,"avatar_url":"https://avatars3.githubusercontent.com/u/160299?v=4","gravatar_id":"","url":"https://api.github.com/users/giorgiosironi","html_url":"https://github.com/giorgiosironi","followers_url":"https://api.github.com/users/giorgiosironi/followers","following_url":"https://api.github.com/users/giorgiosironi/following{/other_user}","gists_url":"https://api.github.com/users/giorgiosironi/gists{/gist_id}","starred_url":"https://api.github.com/users/giorgiosironi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giorgiosironi/subscriptions","organizations_url":"https://api.github.com/users/giorgiosironi/orgs","repos_url":"https://api.github.com/users/giorgiosironi/repos","events_url":"https://api.github.com/users/giorgiosironi/events{/privacy}","received_events_url":"https://api.github.com/users/giorgiosironi/received_events","type":"User","site_admin":false},"body":"I think they can all put in the same `systemctl restart` call. But YAGNI at the moment, as multiple types of processes are still supported but restarts not as fast as possible :thinking: ","created_at":"2017-11-21T15:14:22Z","updated_at":"2017-11-21T15:14:22Z","html_url":"https://github.com/elifesciences/builder-base-formula/pull/87#discussion_r152304472","pull_request_url":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls/87","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls/comments/152304472"},"html":{"href":"https://github.com/elifesciences/builder-base-formula/pull/87#discussion_r152304472"},"pull_request":{"href":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls/87"}},"in_reply_to_id":152300189},"pull_request":{"url":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls/87","id":153892697,"html_url":"https://github.com/elifesciences/builder-base-formula/pull/87","diff_url":"https://github.com/elifesciences/builder-base-formula/pull/87.diff","patch_url":"https://github.com/elifesciences/builder-base-formula/pull/87.patch","issue_url":"https://api.github.com/repos/elifesciences/builder-base-formula/issues/87","number":87,"state":"open","locked":false,"title":"Support PHP long-running processes in 16.04","user":{"login":"giorgiosironi","id":160299,"avatar_url":"https://avatars3.githubusercontent.com/u/160299?v=4","gravatar_id":"","url":"https://api.github.com/users/giorgiosironi","html_url":"https://github.com/giorgiosironi","followers_url":"https://api.github.com/users/giorgiosironi/followers","following_url":"https://api.github.com/users/giorgiosironi/following{/other_user}","gists_url":"https://api.github.com/users/giorgiosironi/gists{/gist_id}","starred_url":"https://api.github.com/users/giorgiosironi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giorgiosironi/subscriptions","organizations_url":"https://api.github.com/users/giorgiosironi/orgs","repos_url":"https://api.github.com/users/giorgiosironi/repos","events_url":"https://api.github.com/users/giorgiosironi/events{/privacy}","received_events_url":"https://api.github.com/users/giorgiosironi/received_events","type":"User","site_admin":false},"body":"Purely through pillar configuration, since we are already tired of creating systemd service files.\r\n\r\nI think this can be extended to Python (or generic) processes later, but with customization of the template to allow for things like New Relic coreography or custom options, so not trivial.","created_at":"2017-11-21T13:39:55Z","updated_at":"2017-11-21T15:14:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71a98aeb4920a792b6cc5331f25958785042c9f9","assignee":null,"assignees":[],"requested_reviewers":[{"login":"lsh-0","id":2142748,"avatar_url":"https://avatars0.githubusercontent.com/u/2142748?v=4","gravatar_id":"","url":"https://api.github.com/users/lsh-0","html_url":"https://github.com/lsh-0","followers_url":"https://api.github.com/users/lsh-0/followers","following_url":"https://api.github.com/users/lsh-0/following{/other_user}","gists_url":"https://api.github.com/users/lsh-0/gists{/gist_id}","starred_url":"https://api.github.com/users/lsh-0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsh-0/subscriptions","organizations_url":"https://api.github.com/users/lsh-0/orgs","repos_url":"https://api.github.com/users/lsh-0/repos","events_url":"https://api.github.com/users/lsh-0/events{/privacy}","received_events_url":"https://api.github.com/users/lsh-0/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls/87/commits","review_comments_url":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls/87/comments","review_comment_url":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elifesciences/builder-base-formula/issues/87/comments","statuses_url":"https://api.github.com/repos/elifesciences/builder-base-formula/statuses/894708618f57c3028f609297bf4d03fc3e2f09be","head":{"label":"elifesciences:long_running_php_processes_systemd","ref":"long_running_php_processes_systemd","sha":"894708618f57c3028f609297bf4d03fc3e2f09be","user":{"login":"elifesciences","id":1777367,"avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"repo":{"id":59044017,"name":"builder-base-formula","full_name":"elifesciences/builder-base-formula","owner":{"login":"elifesciences","id":1777367,"avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elifesciences/builder-base-formula","description":null,"fork":false,"url":"https://api.github.com/repos/elifesciences/builder-base-formula","forks_url":"https://api.github.com/repos/elifesciences/builder-base-formula/forks","keys_url":"https://api.github.com/repos/elifesciences/builder-base-formula/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elifesciences/builder-base-formula/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elifesciences/builder-base-formula/teams","hooks_url":"https://api.github.com/repos/elifesciences/builder-base-formula/hooks","issue_events_url":"https://api.github.com/repos/elifesciences/builder-base-formula/issues/events{/number}","events_url":"https://api.github.com/repos/elifesciences/builder-base-formula/events","assignees_url":"https://api.github.com/repos/elifesciences/builder-base-formula/assignees{/user}","branches_url":"https://api.github.com/repos/elifesciences/builder-base-formula/branches{/branch}","tags_url":"https://api.github.com/repos/elifesciences/builder-base-formula/tags","blobs_url":"https://api.github.com/repos/elifesciences/builder-base-formula/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elifesciences/builder-base-formula/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elifesciences/builder-base-formula/git/refs{/sha}","trees_url":"https://api.github.com/repos/elifesciences/builder-base-formula/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elifesciences/builder-base-formula/statuses/{sha}","languages_url":"https://api.github.com/repos/elifesciences/builder-base-formula/languages","stargazers_url":"https://api.github.com/repos/elifesciences/builder-base-formula/stargazers","contributors_url":"https://api.github.com/repos/elifesciences/builder-base-formula/contributors","subscribers_url":"https://api.github.com/repos/elifesciences/builder-base-formula/subscribers","subscription_url":"https://api.github.com/repos/elifesciences/builder-base-formula/subscription","commits_url":"https://api.github.com/repos/elifesciences/builder-base-formula/commits{/sha}","git_commits_url":"https://api.github.com/repos/elifesciences/builder-base-formula/git/commits{/sha}","comments_url":"https://api.github.com/repos/elifesciences/builder-base-formula/comments{/number}","issue_comment_url":"https://api.github.com/repos/elifesciences/builder-base-formula/issues/comments{/number}","contents_url":"https://api.github.com/repos/elifesciences/builder-base-formula/contents/{+path}","compare_url":"https://api.github.com/repos/elifesciences/builder-base-formula/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elifesciences/builder-base-formula/merges","archive_url":"https://api.github.com/repos/elifesciences/builder-base-formula/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elifesciences/builder-base-formula/downloads","issues_url":"https://api.github.com/repos/elifesciences/builder-base-formula/issues{/number}","pulls_url":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls{/number}","milestones_url":"https://api.github.com/repos/elifesciences/builder-base-formula/milestones{/number}","notifications_url":"https://api.github.com/repos/elifesciences/builder-base-formula/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elifesciences/builder-base-formula/labels{/name}","releases_url":"https://api.github.com/repos/elifesciences/builder-base-formula/releases{/id}","deployments_url":"https://api.github.com/repos/elifesciences/builder-base-formula/deployments","created_at":"2016-05-17T17:27:01Z","updated_at":"2017-03-07T14:36:24Z","pushed_at":"2017-11-21T13:45:07Z","git_url":"git://github.com/elifesciences/builder-base-formula.git","ssh_url":"git@github.com:elifesciences/builder-base-formula.git","clone_url":"https://github.com/elifesciences/builder-base-formula.git","svn_url":"https://github.com/elifesciences/builder-base-formula","homepage":null,"size":641,"stargazers_count":1,"watchers_count":1,"language":"SaltStack","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":4,"forks":5,"open_issues":4,"watchers":1,"default_branch":"master"}},"base":{"label":"elifesciences:master","ref":"master","sha":"42bf5141d1236c7742c0ab73350c6aff5b64cd32","user":{"login":"elifesciences","id":1777367,"avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"repo":{"id":59044017,"name":"builder-base-formula","full_name":"elifesciences/builder-base-formula","owner":{"login":"elifesciences","id":1777367,"avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elifesciences/builder-base-formula","description":null,"fork":false,"url":"https://api.github.com/repos/elifesciences/builder-base-formula","forks_url":"https://api.github.com/repos/elifesciences/builder-base-formula/forks","keys_url":"https://api.github.com/repos/elifesciences/builder-base-formula/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elifesciences/builder-base-formula/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elifesciences/builder-base-formula/teams","hooks_url":"https://api.github.com/repos/elifesciences/builder-base-formula/hooks","issue_events_url":"https://api.github.com/repos/elifesciences/builder-base-formula/issues/events{/number}","events_url":"https://api.github.com/repos/elifesciences/builder-base-formula/events","assignees_url":"https://api.github.com/repos/elifesciences/builder-base-formula/assignees{/user}","branches_url":"https://api.github.com/repos/elifesciences/builder-base-formula/branches{/branch}","tags_url":"https://api.github.com/repos/elifesciences/builder-base-formula/tags","blobs_url":"https://api.github.com/repos/elifesciences/builder-base-formula/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elifesciences/builder-base-formula/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elifesciences/builder-base-formula/git/refs{/sha}","trees_url":"https://api.github.com/repos/elifesciences/builder-base-formula/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elifesciences/builder-base-formula/statuses/{sha}","languages_url":"https://api.github.com/repos/elifesciences/builder-base-formula/languages","stargazers_url":"https://api.github.com/repos/elifesciences/builder-base-formula/stargazers","contributors_url":"https://api.github.com/repos/elifesciences/builder-base-formula/contributors","subscribers_url":"https://api.github.com/repos/elifesciences/builder-base-formula/subscribers","subscription_url":"https://api.github.com/repos/elifesciences/builder-base-formula/subscription","commits_url":"https://api.github.com/repos/elifesciences/builder-base-formula/commits{/sha}","git_commits_url":"https://api.github.com/repos/elifesciences/builder-base-formula/git/commits{/sha}","comments_url":"https://api.github.com/repos/elifesciences/builder-base-formula/comments{/number}","issue_comment_url":"https://api.github.com/repos/elifesciences/builder-base-formula/issues/comments{/number}","contents_url":"https://api.github.com/repos/elifesciences/builder-base-formula/contents/{+path}","compare_url":"https://api.github.com/repos/elifesciences/builder-base-formula/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elifesciences/builder-base-formula/merges","archive_url":"https://api.github.com/repos/elifesciences/builder-base-formula/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elifesciences/builder-base-formula/downloads","issues_url":"https://api.github.com/repos/elifesciences/builder-base-formula/issues{/number}","pulls_url":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls{/number}","milestones_url":"https://api.github.com/repos/elifesciences/builder-base-formula/milestones{/number}","notifications_url":"https://api.github.com/repos/elifesciences/builder-base-formula/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elifesciences/builder-base-formula/labels{/name}","releases_url":"https://api.github.com/repos/elifesciences/builder-base-formula/releases{/id}","deployments_url":"https://api.github.com/repos/elifesciences/builder-base-formula/deployments","created_at":"2016-05-17T17:27:01Z","updated_at":"2017-03-07T14:36:24Z","pushed_at":"2017-11-21T13:45:07Z","git_url":"git://github.com/elifesciences/builder-base-formula.git","ssh_url":"git@github.com:elifesciences/builder-base-formula.git","clone_url":"https://github.com/elifesciences/builder-base-formula.git","svn_url":"https://github.com/elifesciences/builder-base-formula","homepage":null,"size":641,"stargazers_count":1,"watchers_count":1,"language":"SaltStack","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":4,"forks":5,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls/87"},"html":{"href":"https://github.com/elifesciences/builder-base-formula/pull/87"},"issue":{"href":"https://api.github.com/repos/elifesciences/builder-base-formula/issues/87"},"comments":{"href":"https://api.github.com/repos/elifesciences/builder-base-formula/issues/87/comments"},"review_comments":{"href":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls/87/comments"},"review_comment":{"href":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elifesciences/builder-base-formula/pulls/87/commits"},"statuses":{"href":"https://api.github.com/repos/elifesciences/builder-base-formula/statuses/894708618f57c3028f609297bf4d03fc3e2f09be"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"giorgiosironi"}}