bundles/nginx: prepare for arch linux

This commit is contained in:
Franzi 2021-06-01 16:52:03 +02:00
parent 6b90d568cf
commit cf3c45fdd5
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 35 additions and 3 deletions

View file

@ -0,0 +1,9 @@
[Service]
ExecStart=
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=
ExecReload=/bin/sh -c "/bin/kill -s HUP $(/bin/cat /var/run/nginx.pid)"
ExecStop=
ExecStop=/bin/sh -c "/bin/kill -s TERM $(/bin/cat /var/run/nginx.pid)"

View file

@ -1,4 +1,4 @@
user www-data; user ${username};
worker_processes ${worker_processes}; worker_processes ${worker_processes};
pid /var/run/nginx.pid; pid /var/run/nginx.pid;

View file

@ -1,3 +1,10 @@
if node.has_bundle('pacman'):
package = 'pkg_pacman:nginx'
username = 'http'
else:
package = 'pkg_apt:nginx'
username = 'www-data'
directories = { directories = {
'/etc/nginx/sites': { '/etc/nginx/sites': {
'purge': True, 'purge': True,
@ -17,7 +24,10 @@ directories = {
files = { files = {
'/etc/nginx/nginx.conf': { '/etc/nginx/nginx.conf': {
'content_type': 'mako', 'content_type': 'mako',
'context': node.metadata['nginx'], 'context': {
'username': username,
**node.metadata['nginx'],
},
'triggers': { 'triggers': {
'svc_systemd:nginx:restart', 'svc_systemd:nginx:restart',
}, },
@ -42,6 +52,14 @@ files = {
'mode': '0755', 'mode': '0755',
}, },
} }
if node.has_bundle('pacman'):
files['/etc/systemd/system/nginx.service.d/bundlewrap.conf'] = {
'source': 'arch-override.conf',
'triggers': {
'action:systemd-reload',
'svc_systemd:nginx:restart',
},
}
actions = { actions = {
'nginx-generate-dhparam': { 'nginx-generate-dhparam': {
@ -54,7 +72,7 @@ svc_systemd = {
'nginx': { 'nginx': {
'needs': { 'needs': {
'action:nginx-generate-dhparam', 'action:nginx-generate-dhparam',
'pkg_apt:nginx', package,
}, },
}, },
} }

View file

@ -33,6 +33,11 @@ defaults = {
'nginx': { 'nginx': {
'worker_connections': 768, 'worker_connections': 768,
}, },
'pacman': {
'packages': {
'nginx': {},
},
},
} }
if node.has_bundle('telegraf'): if node.has_bundle('telegraf'):