Uppdated service, defaults, etc

This commit is contained in:
Eric Renfro 2018-05-17 19:16:38 -04:00
parent 423f3ae8f2
commit 7dbfd54a70
6 changed files with 24 additions and 14 deletions

View file

@ -1,5 +1,6 @@
{%- from slspath + '/map.jinja' import fabio with context -%}
{#
fabio-config:
file.serialize:
- name: /etc/fabio/config.json
@ -41,3 +42,4 @@ fabio-script-config:
- formatter: json
- dataset:
services: {{ fabio.register }}
#}

View file

@ -5,10 +5,11 @@ fabio:
service: false
user: root
group: root
user: fabio
group: fabio
config:
consul_address: localhost:8500
server: false
bind_addr: 0.0.0.0
data_dir: /var/fabio

View file

@ -5,11 +5,16 @@ After=network.target
[Service]
EnvironmentFile=-/etc/{% if grains['os_family'] == 'Debian' %}default{% else %}sysconfig{% endif %}/fabio
ExecStart=/usr/local/bin/fabio agent -config-dir=/etc/fabio.d
ExecStart=/usr/local/bin/fabio -registry.consul.addr consul.service.dc1.consul:8500
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=TERM
User={{ user }}
Group={{ group }}
Restart=on-failure
CapabilityBoundingSet=CAP_SYSLOG CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
SecureBits=keep-caps
NoNewPrivileges=yes
KillSignal=TERM
[Install]
WantedBy=multi-user.target

View file

@ -2,5 +2,5 @@
include:
- {{ slspath }}.install
- {{ slspath }}.config
{# - {{ slspath }}.config #}
- {{ slspath }}.service

View file

@ -5,8 +5,6 @@ fabio-bin-dir:
- name: /usr/local/bin
- makedirs: True
{#
# Create fabio user
fabio-group:
group.present:
@ -22,7 +20,6 @@ fabio-user:
- system: True
- require:
- group: fabio-group
#}
# Create directories
fabio-config-dir:
@ -32,7 +29,6 @@ fabio-config-dir:
- group: {{ fabio.group }}
- mode: 0750
{#
fabio-data-dir:
file.directory:
- name: {{ fabio.config.data_dir }}
@ -40,7 +36,6 @@ fabio-data-dir:
- user: {{ fabio.user }}
- group: {{ fabio.group }}
- mode: 0750
#}
# Install agent
fabio-download:
@ -48,6 +43,7 @@ fabio-download:
- name: /tmp/fabio-{{ fabio.version }}
- source: https://{{ fabio.download_host }}/fabiolb/fabio/releases/download/v{{ fabio.version }}/fabio-{{ fabio.version }}-go{{ fabio.goversion }}-linux_{{ fabio.arch }}
- source_hash: https://github.com/fabiolb/fabio/releases/download/v{{ fabio.version }}/fabio-{{ fabio.version }}-go{{ fabio.goversion }}.sha256
- mode: 0755
- unless: test -f /usr/local/bin/fabio-{{ fabio.version }}
fabio-install:
@ -71,3 +67,9 @@ fabio-link:
- name: /usr/local/bin/fabio
- watch:
- file: fabio-install
fabio-setcap:
cmd.run:
- name: "setcap cap_net_bind_service=+ep /usr/local/bin/fabio-{{ fabio.version }}"
- onchanges:
- file: fabio-install

View file

@ -12,9 +12,8 @@ fabio-init-env:
- group: root
- mode: 0644
- contents:
- fabio_USER={{ fabio.user }}
- fabio_GROUP={{ fabio.group }}
- fabio_UI_BETA={{ fabio.ui_beta }}
- FABIO_USER={{ fabio.user }}
- FABIO_GROUP={{ fabio.group }}
- GOMAXPROCS=2
- PATH=/usr/local/bin:/usr/bin:/bin
@ -27,6 +26,7 @@ fabio-init-file:
- context:
user: {{ fabio.user }}
group: {{ fabio.group }}
consul_address: {{ fabio.config.consul_address }}
- mode: 0644
{%- elif salt['test.provider']('service') == 'upstart' %}
- source: salt://{{ slspath }}/files/fabio.upstart