瀏覽代碼

Use separate systemd services, because sigar is broken (needed by eye)

tags/v1.0.0
Benjamin Neff 7 年之前
父節點
當前提交
da97ec747a
No account linked to committer's email address
共有 5 個文件被更改,包括 73 次插入18 次删除
  1. +14
    -0
      diaspora/files/diaspora-sidekiq.service
  2. +14
    -0
      diaspora/files/diaspora-web.service
  3. +0
    -15
      diaspora/files/diaspora.service
  4. +9
    -0
      diaspora/files/diaspora.target
  5. +36
    -3
      diaspora/service.sls

+ 14
- 0
diaspora/files/diaspora-sidekiq.service 查看文件

@@ -0,0 +1,14 @@
[Unit]
Description=Diaspora social network (sidekiq)
PartOf=diaspora.target
StopWhenUnneeded=true

[Service]
User={{ diaspora.user.username }}
Environment=RAILS_ENV={{ diaspora.configuration.server.rails_environment }}
WorkingDirectory={{ diaspora.install_path }}
ExecStart=/bin/bash -lc "bin/bundle exec sidekiq"
Restart=always

[Install]
WantedBy=diaspora.target

+ 14
- 0
diaspora/files/diaspora-web.service 查看文件

@@ -0,0 +1,14 @@
[Unit]
Description=Diaspora social network (unicorn)
PartOf=diaspora.target
StopWhenUnneeded=true

[Service]
User={{ diaspora.user.username }}
Environment=RAILS_ENV={{ diaspora.configuration.server.rails_environment }}
WorkingDirectory={{ diaspora.install_path }}
ExecStart=/bin/bash -lc "bin/bundle exec unicorn -c config/unicorn.rb -E {{ diaspora.configuration.server.rails_environment }}"
Restart=always

[Install]
WantedBy=diaspora.target

+ 0
- 15
diaspora/files/diaspora.service 查看文件

@@ -1,15 +0,0 @@
[Unit]
Description=A privacy aware distributed social network
{%- if diaspora.install_redis %}
Wants={{ diaspora.redis_service }}.service
{%- endif %}

[Service]
User={{ diaspora.user.username }}
Environment=RAILS_ENV={{ diaspora.configuration.server.rails_environment }}
WorkingDirectory={{ diaspora.install_path }}
ExecStart=/bin/bash -lc "script/server"
Restart=on-failure

[Install]
WantedBy=multi-user.target

+ 9
- 0
diaspora/files/diaspora.target 查看文件

@@ -0,0 +1,9 @@
[Unit]
Description=Diaspora social network
{%- if diaspora.install_redis %}
Wants={{ diaspora.redis_service }}.service
After={{ diaspora.redis_service }}.service
{%- endif %}

[Install]
WantedBy=multi-user.target

+ 36
- 3
diaspora/service.sls 查看文件

@@ -4,21 +4,54 @@ include:
- diaspora.install
- diaspora.config

/etc/systemd/system/diaspora.service:
/etc/systemd/system/diaspora-sidekiq.service:
file.managed:
- user: root
- mode: 644
- source: salt://diaspora/files/diaspora.service
- source: salt://diaspora/files/diaspora-sidekiq.service
- template: jinja
- context:
diaspora: {{ diaspora|json }}

/etc/systemd/system/diaspora-web.service:
file.managed:
- user: root
- mode: 644
- source: salt://diaspora/files/diaspora-web.service
- template: jinja
- context:
diaspora: {{ diaspora|json }}

/etc/systemd/system/diaspora.target:
file.managed:
- user: root
- mode: 644
- source: salt://diaspora/files/diaspora.target
- template: jinja
- context:
diaspora: {{ diaspora|json }}

diaspora_sidekiq_service:
service.enabled:
- name: diaspora-sidekiq
- requre:
- file: /etc/systemd/system/diaspora-sidekiq.service

diaspora_web_service:
service.enabled:
- name: diaspora-web
- requre:
- file: /etc/systemd/system/diaspora-web.service

diaspora_service:
service.running:
- name: diaspora
- name: diaspora.target
- enable: True
- requre:
- cmd: diaspora_precompile_assets
- file: /etc/systemd/system/diaspora.target
- service: diaspora_sidekiq_service
- service: diaspora_web_service
- watch:
- git: diaspora_git
- file: {{ diaspora.install_path }}/config/database.yml

Loading…
取消
儲存