SuperTux88's Diaspora Saltstack Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 satır
2.8KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=sls
  3. {#- Get the `tplroot` from `tpldir` #}
  4. {%- set tplroot = tpldir.split('/')[0] %}
  5. {%- from tplroot ~ "/map.jinja" import diaspora with context %}
  6. {%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
  7. include:
  8. - {{ tplroot }}.install
  9. - {{ tplroot }}.config
  10. /etc/systemd/system/diaspora-sidekiq.service:
  11. file.managed:
  12. - user: root
  13. - mode: 644
  14. - source: {{ files_switch(['diaspora-sidekiq.service'],
  15. lookup='sidekiq_service'
  16. )
  17. }}
  18. - template: jinja
  19. - context:
  20. diaspora: {{ diaspora|json }}
  21. /etc/systemd/system/diaspora-web.service:
  22. file.managed:
  23. - user: root
  24. - mode: 644
  25. - source: {{ diaspora.systemd.web_template if diaspora.systemd is defined and diaspora.systemd.web_template is defined
  26. else files_switch(['diaspora-web.service'],
  27. lookup='web_service'
  28. )
  29. }}
  30. - template: jinja
  31. - context:
  32. diaspora: {{ diaspora|json }}
  33. /etc/systemd/system/diaspora.target:
  34. file.managed:
  35. - user: root
  36. - mode: 644
  37. - source: {{ files_switch(['diaspora.target'],
  38. lookup='diaspora_target'
  39. )
  40. }}
  41. - template: jinja
  42. - context:
  43. diaspora: {{ diaspora|json }}
  44. {%- if diaspora.install_redis %}
  45. redis_service:
  46. service.running:
  47. - name: {{ diaspora.redis_service }}
  48. - require:
  49. - pkg: redis_package
  50. - require_in:
  51. - service: diaspora_service
  52. {%- endif %}
  53. diaspora_sidekiq_service:
  54. service.enabled:
  55. - name: diaspora-sidekiq
  56. - require:
  57. - file: /etc/systemd/system/diaspora-sidekiq.service
  58. diaspora_web_service:
  59. service.enabled:
  60. - name: diaspora-web
  61. - require:
  62. - file: /etc/systemd/system/diaspora-web.service
  63. diaspora_service:
  64. service.running:
  65. - name: diaspora.target
  66. - enable: True
  67. - require:
  68. - cmd: diaspora_precompile_assets
  69. - file: /etc/systemd/system/diaspora.target
  70. - service: diaspora_sidekiq_service
  71. - service: diaspora_web_service
  72. diaspora_sidekiq_service_restart:
  73. service.running:
  74. - name: diaspora-sidekiq.service
  75. - require:
  76. - service: diaspora_service
  77. - watch:
  78. - git: diaspora_git
  79. - file: {{ diaspora.install_path }}/config/database.yml
  80. - file: {{ diaspora.install_path }}/config/diaspora.yml
  81. diaspora_web_service_restart:
  82. service.running:
  83. - name: diaspora-web.service
  84. - reload: True
  85. - unless: >-
  86. systemctl is-active diaspora-web.service | grep -E 'activ(e|ating)' &&
  87. test $(ps -p $(systemctl show --property MainPID diaspora-web.service | cut -d= -f2) -oetimes=) -lt 10
  88. - require:
  89. - service: diaspora_service
  90. - watch:
  91. - service: diaspora_sidekiq_service_restart