fix missing dependencies in __prometheus_*, __go_get
This commit is contained in:
		
					parent
					
						
							
								e32f2110ab
							
						
					
				
			
			
				commit
				
					
						5d148a58d2
					
				
			
		
					 10 changed files with 23 additions and 32 deletions
				
			
		| 
						 | 
				
			
			@ -24,7 +24,7 @@ from-package
 | 
			
		|||
BOOLEAN PARAMETERS
 | 
			
		||||
------------------
 | 
			
		||||
install-init-script
 | 
			
		||||
   Add an init script and set it to start on boot. Default yes.
 | 
			
		||||
   Add an init script and set it to start on boot.
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
command -v svc
 | 
			
		||||
command -v svc || true
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,3 +15,4 @@ case $os in
 | 
			
		|||
		;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
__package git
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,9 @@ DESCRIPTION
 | 
			
		|||
-----------
 | 
			
		||||
Install and configure Prometheus Alertmanager (https://prometheus.io/docs/alerting/alertmanager/).
 | 
			
		||||
 | 
			
		||||
This type create a daemontools-compatible service directory under /service/prometheus.
 | 
			
		||||
Daemontools (or something compatible) must be installed (in particular, the command `svc` must be executable).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
| 
						 | 
				
			
			@ -27,10 +30,7 @@ storage-path
 | 
			
		|||
 | 
			
		||||
BOOLEAN PARAMETERS
 | 
			
		||||
------------------
 | 
			
		||||
with-daemontools
 | 
			
		||||
   Create a daemontools service directory under /service/prometheus. Default: yes.
 | 
			
		||||
   Note: If you do not use this, Alertmanager will not be launched, and will not reload config on change.
 | 
			
		||||
   If you use this, daemontools (or something compatible) must be installed.
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
| 
						 | 
				
			
			@ -44,6 +44,7 @@ EXAMPLES
 | 
			
		|||
    __golang_from_vendor --version 1.8.1  # required for prometheus and many exporters
 | 
			
		||||
 | 
			
		||||
    require="__daemontools __golang_from_vendor" __prometheus_alertmanager \
 | 
			
		||||
      --with-daemontools \
 | 
			
		||||
      --config "$__manifest/files/alertmanager.yml" \
 | 
			
		||||
      --storage-path /data/alertmanager \
 | 
			
		||||
      --listen-address "[::]:$ALERTPORT"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,12 +11,6 @@ config="$(cat "$__object/parameter/config")"
 | 
			
		|||
storage_path="$(cat "$__object/parameter/storage-path")"
 | 
			
		||||
listen_address="$(cat "$__object/parameter/listen-address")"
 | 
			
		||||
 | 
			
		||||
ONCHANGE=""
 | 
			
		||||
if [ -f "$__object/parameter/with-daemontools" ]; then
 | 
			
		||||
	__daemontools_service prometheus --run "setuidgid prometheus $GOBIN/prometheus $REAL_FLAGS"
 | 
			
		||||
	ONCHANGE="svc -h /service/prometheus"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
FLAGS="config.file '$CONF'
 | 
			
		||||
storage.path '$storage_path'
 | 
			
		||||
web.listen-address '$listen_address'
 | 
			
		||||
| 
						 | 
				
			
			@ -27,12 +21,12 @@ REAL_FLAGS="$(echo "$FLAGS" | sed -nE 's/^([^#]+).*/ --\1 \\/p')"
 | 
			
		|||
__go_get github.com/prometheus/alertmanager/cmd/...
 | 
			
		||||
 | 
			
		||||
__user prometheus --system
 | 
			
		||||
__directory "$storage_path" --owner prometheus
 | 
			
		||||
__directory "$CONF_DIR" --owner prometheus
 | 
			
		||||
require="__user/prometheus" __directory "$storage_path" --owner prometheus
 | 
			
		||||
require="__user/prometheus" __directory "$CONF_DIR" --owner prometheus
 | 
			
		||||
 | 
			
		||||
__daemontools_service alertmanager --run "setuidgid prometheus $GOBIN/alertmanager $REAL_FLAGS"
 | 
			
		||||
 | 
			
		||||
require="$require __directory/$storage_path" \
 | 
			
		||||
require="$require __directory/$storage_path __user/prometheus" \
 | 
			
		||||
__config_file $CONF \
 | 
			
		||||
    --source $config \
 | 
			
		||||
    --group prometheus --mode 640 \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,9 @@ DESCRIPTION
 | 
			
		|||
-----------
 | 
			
		||||
Install and configure Prometheus (https://prometheus.io/).
 | 
			
		||||
 | 
			
		||||
This type creates a daemontools-compatible service directory under /service/prometheus.
 | 
			
		||||
Daemontools (or something compatible) must be installed (in particular, the command `svc` must be executable).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
| 
						 | 
				
			
			@ -35,10 +38,7 @@ target-heap-size
 | 
			
		|||
 | 
			
		||||
BOOLEAN PARAMETERS
 | 
			
		||||
------------------
 | 
			
		||||
with-daemontools
 | 
			
		||||
   Create a daemontools service directory under /service/prometheus. Default: yes.
 | 
			
		||||
   Note: If you do not use this, Prometheus will not be launched, and will not reload config on change.
 | 
			
		||||
   If you use this, daemontools (or something compatible) must be installed.
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
| 
						 | 
				
			
			@ -53,6 +53,7 @@ EXAMPLES
 | 
			
		|||
    __golang_from_vendor --version 1.8.1  # required for prometheus and many exporters
 | 
			
		||||
 | 
			
		||||
    require="__daemontools __golang_from_vendor" __prometheus_server \
 | 
			
		||||
        --with-daemontools \
 | 
			
		||||
        --config "$__manifest/files/prometheus.yml" \
 | 
			
		||||
        --retention-days 14 \
 | 
			
		||||
        --storage-path /data/prometheus \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,11 +16,6 @@ rule_files="$(cat "$__object/parameter/rule-files")"
 | 
			
		|||
# explorer in kB => convert; by default we go with 1/2 RAM
 | 
			
		||||
[ "$target_heap_size" = "auto" ] && target_heap_size=$(($(cat $__global/explorer/memory)*1024/2))
 | 
			
		||||
 | 
			
		||||
ONCHANGE=""
 | 
			
		||||
if [ -f "$__object/parameter/with-daemontools" ]; then
 | 
			
		||||
	__daemontools_service prometheus --run "setuidgid prometheus $GOBIN/prometheus $REAL_FLAGS"
 | 
			
		||||
	ONCHANGE="&& svc -h /service/prometheus"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
FLAGS="config.file '$CONF'
 | 
			
		||||
storage.local.path '$storage_path'
 | 
			
		||||
| 
						 | 
				
			
			@ -35,23 +30,23 @@ REAL_FLAGS="$(echo "$FLAGS" | sed -nE 's/^([^#]+).*/ --\1 \\/p')"
 | 
			
		|||
__go_get github.com/prometheus/prometheus/cmd/...
 | 
			
		||||
 | 
			
		||||
__user prometheus --system
 | 
			
		||||
__directory "$storage_path" --owner prometheus
 | 
			
		||||
__directory "$CONF_DIR" --owner prometheus
 | 
			
		||||
require="__user/prometheus" __directory "$storage_path" --owner prometheus
 | 
			
		||||
require="__user/prometheus" __directory "$CONF_DIR" --owner prometheus
 | 
			
		||||
 | 
			
		||||
__daemontools_service prometheus --run "setuidgid prometheus $GOBIN/prometheus $REAL_FLAGS"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
require="$require __directory/$storage_path" \
 | 
			
		||||
require="$require __directory/$storage_path __user/prometheus" \
 | 
			
		||||
__config_file $CONF \
 | 
			
		||||
	--source $config \
 | 
			
		||||
	--group prometheus --mode 640 \
 | 
			
		||||
	--onchange "$GOBIN/promtool check-config $CONF $ONCHANGE"
 | 
			
		||||
	--onchange "$GOBIN/promtool check-config $CONF && svc -h /service/prometheus"
 | 
			
		||||
 | 
			
		||||
for file in $rule_files; do
 | 
			
		||||
	dest=$CONF_DIR/$(basename $file)
 | 
			
		||||
	require="$require __directory/$CONF_DIR" \
 | 
			
		||||
	require="$require __directory/$CONF_DIR __user/prometheus" \
 | 
			
		||||
	__config_file "$dest" \
 | 
			
		||||
		--source "$file" \
 | 
			
		||||
		--owner prometheus \
 | 
			
		||||
		--onchange "$GOBIN/promtool check-rules '$dest' $ONCHANGE"
 | 
			
		||||
		--onchange "$GOBIN/promtool check-rules '$dest' && svc -h /service/prometheus"
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
with-daemontools
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue