Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3769559
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/roles/webserver-alkane/php/files/restart-php-fpm.sh b/roles/webserver-alkane/php/files/restart-php-fpm.sh
new file mode 100755
index 0000000..c121cbe
--- /dev/null
+++ b/roles/webserver-alkane/php/files/restart-php-fpm.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+# Restart php-fpm
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/webserver-alkane/php/files/restart-php-fpm.sh
+# Description: Deploy and restart php-fpm service
+# -------------------------------------------------------------
+
+set -e
+
+# -------------------------------------------------------------
+# Ensure user is root
+#
+# Note: POSIX shells don't always define $UID or $EUID.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ "${EUID:-$(id -u)}" -ne 0 ]; then
+ echo "This command must be run as root." >&2
+ exit 1
+fi
+
+
+# -------------------------------------------------------------
+# Update through Salt the service if needed & restart php-fpm
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+grep -q auto-generated /usr/local/etc/rc.d/php-fpm || salt-call state.apply roles/webserver-alkane/php/service
+/usr/local/etc/rc.d/php-fpm restart
diff --git a/roles/webserver-alkane/php/service.sls b/roles/webserver-alkane/php/service.sls
index 5e130e1..dd87f51 100644
--- a/roles/webserver-alkane/php/service.sls
+++ b/roles/webserver-alkane/php/service.sls
@@ -1,41 +1,46 @@
# -------------------------------------------------------------
# Salt — Provision PHP websites — php-fpm service
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
# -------------------------------------------------------------
# Service
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{% if grains['os'] == 'FreeBSD' %}
{% set instances = " ".join(pillar['php_fpm_instances'].keys()) %}
/usr/local/etc/rc.d/php-fpm:
file.managed:
- source: salt://roles/webserver-alkane/php/files/rc/php-fpm
- mode: 755
+/usr/local/bin/restart-php-fpm:
+ file.managed:
+ - source: salt://roles/webserver-alkane/php/files/restart-php-fpm.sh
+ - mode: 755
+
/etc/rc.conf.d/php_fpm:
file.directory
/etc/rc.conf.d/php_fpm/instances:
file.managed:
- source: salt://roles/webserver-alkane/php/files/rc/instances
- template: jinja
- context:
instances: {{ instances }}
{% for instance, config in pillar['php_fpm_instances'].items() %}
/etc/rc.conf.d/php_fpm/{{ instance }}:
file.managed:
- source: salt://roles/webserver-alkane/php/files/rc/per_instance
- template: jinja
- context:
instance: {{ instance }}
command: {{ config['command'] | default('') }}
{% endfor %}
{% endif %}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Nov 25, 15:49 (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258815
Default Alt Text
(3 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment