~evilham/cdist-evilham

8a9cda31bd35516f80fdc3966d6fca916a26fbd9 — Michelle 1 year, 6 months ago 3b917b3
Woodpecker-ci types added

woodpecker-server and woodpecker-agent binaries for linux are
configurated through these two types, facilitating the quick setup of
the woodpecker service.
A type/__evilham_woodpecker_ci_agent/man.rst => type/__evilham_woodpecker_ci_agent/man.rst +70 -0
@@ 0,0 1,70 @@
cdist-type__evilham_victoriametrics(7)
===================================

NAME
----
cdist-type__evilham_victoriametrics - Setup a victoriametrics service


DESCRIPTION
-----------

VictoriaMetrics is a monitoring software solution and time-series database, 
written in go. It can provide long-term storage for Prometheus.

The object identification given to the type will be the subfolder use for the
data storage inside the home directory for the user. This allows for multiple
node instances in the same victoria metrics service.

OPTIONAL PARAMETERS
-------------------
user
    User that owns the victoria metrics data directory.
    Defaults to `victoriametrics`.

data-path
    Alternative path for the storage of victoria metrics.
    Defaults to `/var/lib/victoria-metrics-data`.

retention-period
    Alternative retention period for the data storage in storage-data-path.
    It accepts a number follow by the unit; h(hours), d(days), w(weeks),
    y(years). If the unit isn't specified, months is the default.
    Defaults to 1 month.

listen-address
    Address and port to listen to TCP connections.
    Defaults to `:8428`.

extra-args
    Extra arguments for configurating flags on victoria metrics.

EXAMPLES
--------

.. code-block:: sh

        # Setup Victoria Metrics instances
        __evilham_victoriametrics vm0 \
        --retention-period 5y --listen-address '[::1]:8420'
        __evilham_victoriametrics vm1 \
        --retention-period 5y --listen-address '[::1]:8421' \
        --extra-args '-relabelConfig /var/lib/vm-data/vm1.relabel.yml'
        require="__evilham_victoriametrics/vm0\
                __file '/var/lib/vm-data/vm0.relabel.yml'\
                --mode 0444 \
                --source - <<EOF
# Drop environment label
- action: labeldrop
  regex: 'environment'
EOF
"

AUTHORS
-------
Evilham <contact@evilham.com>
Michelle <michellequinteroh@gmail.com>

COPYING
-------
Copyright \(C) 2023 Evilham.

A type/__evilham_woodpecker_ci_agent/manifest => type/__evilham_woodpecker_ci_agent/manifest +44 -0
@@ 0,0 1,44 @@
#!/bin/sh -eu

os="$(cat "${__global}/explorer/kernel_name")"
ETC_DIR="/etc"
case "${os}" in
	Linux)
	;;
	*)
		echo "Your OS '${os}' is currently not supported." > /dev/stderr
		exit 1
	;;
esac

CHECKSUM='sha256:ee604b7df5f5f63441c06afd37bdb534243c854089f650ec631d428cc14b1a4a'
TYPE_VERSION="0.15.7"
DOWNLOAD_URL="https://github.com/woodpecker-ci/woodpecker/releases/download/v${TYPE_VERSION}/woodpecker-agent_linux_amd64.tar.gz"

USER="$(cat "${__object}/parameter/user")"
EXTRA_ARGS="$(cat "${__object}/parameter/extra-args")"
DATA_PATH="$(cat "${__object}/parameter/work-dir")"

WORK_DIR="$(echo "${DATA_PATH}/${__object_id}")"

# Install and enable the service
__evilham_single_binary_service "${__object_id}"\
	--user "${USER}" \
	--version "${TYPE_VERSION}" \
	--checksum "${CHECKSUM}" \
	--url "${DOWNLOAD_URL}" \
	--working-directory "${WORK_DIR}" \
	--user-home-dir "${WORK_DIR}" \
	--state "present" \
	--unpack \
	--unpack-extension ".tar.gz" \
	--binary "woodpecker-agent"\
	--custom-code "$(cat <<DONE
${EXTRA_ARGS}
DONE
)"

# Create this instance's data dir, with restrictive permissions
require="__evilham_single_binary_service/${__object_id}" __directory \
	"${WORK_DIR}" --state present \
	--mode 0750 --owner "${USER}" --group "${USER}"

A type/__evilham_woodpecker_ci_agent/parameter/default/extra-args => type/__evilham_woodpecker_ci_agent/parameter/default/extra-args +0 -0
A type/__evilham_woodpecker_ci_agent/parameter/default/user => type/__evilham_woodpecker_ci_agent/parameter/default/user +1 -0
@@ 0,0 1,1 @@
woodpecker

A type/__evilham_woodpecker_ci_agent/parameter/default/work-dir => type/__evilham_woodpecker_ci_agent/parameter/default/work-dir +1 -0
@@ 0,0 1,1 @@
/var/lib/woodpecker-agent

A type/__evilham_woodpecker_ci_agent/parameter/optional => type/__evilham_woodpecker_ci_agent/parameter/optional +6 -0
@@ 0,0 1,6 @@
extra-args
host
server
user
username
work-dir

A type/__evilham_woodpecker_ci_server/man.rst => type/__evilham_woodpecker_ci_server/man.rst +70 -0
@@ 0,0 1,70 @@
cdist-type__evilham_victoriametrics(7)
===================================

NAME
----
cdist-type__evilham_victoriametrics - Setup a victoriametrics service


DESCRIPTION
-----------

VictoriaMetrics is a monitoring software solution and time-series database, 
written in go. It can provide long-term storage for Prometheus.

The object identification given to the type will be the subfolder use for the
data storage inside the home directory for the user. This allows for multiple
node instances in the same victoria metrics service.

OPTIONAL PARAMETERS
-------------------
user
    User that owns the victoria metrics data directory.
    Defaults to `victoriametrics`.

data-path
    Alternative path for the storage of victoria metrics.
    Defaults to `/var/lib/victoria-metrics-data`.

retention-period
    Alternative retention period for the data storage in storage-data-path.
    It accepts a number follow by the unit; h(hours), d(days), w(weeks),
    y(years). If the unit isn't specified, months is the default.
    Defaults to 1 month.

listen-address
    Address and port to listen to TCP connections.
    Defaults to `:8428`.

extra-args
    Extra arguments for configurating flags on victoria metrics.

EXAMPLES
--------

.. code-block:: sh

        # Setup Victoria Metrics instances
        __evilham_victoriametrics vm0 \
        --retention-period 5y --listen-address '[::1]:8420'
        __evilham_victoriametrics vm1 \
        --retention-period 5y --listen-address '[::1]:8421' \
        --extra-args '-relabelConfig /var/lib/vm-data/vm1.relabel.yml'
        require="__evilham_victoriametrics/vm0\
                __file '/var/lib/vm-data/vm0.relabel.yml'\
                --mode 0444 \
                --source - <<EOF
# Drop environment label
- action: labeldrop
  regex: 'environment'
EOF
"

AUTHORS
-------
Evilham <contact@evilham.com>
Michelle <michellequinteroh@gmail.com>

COPYING
-------
Copyright \(C) 2023 Evilham.

A type/__evilham_woodpecker_ci_server/manifest => type/__evilham_woodpecker_ci_server/manifest +43 -0
@@ 0,0 1,43 @@
#!/bin/sh -eu

os="$(cat "${__global}/explorer/kernel_name")"
ETC_DIR="/etc"
case "${os}" in
	Linux)
	;;
	*)
		echo "Your OS '${os}' is currently not supported." > /dev/stderr
		exit 1
	;;
esac

CHECKSUM='sha256:9e86630dc2274dc0dd22ea6967cc069a67b6522aaac88af27199a711138c3e32'
TYPE_VERSION="0.15.7"
DOWNLOAD_URL="https://github.com/woodpecker-ci/woodpecker/releases/download/v${TYPE_VERSION}/woodpecker-server_linux_amd64.tar.gz"

USER="$(cat "${__object}/parameter/user")"
EXTRA_ARGS="$(cat "${__object}/parameter/extra-args")"
WORK_DIR="$(cat "${__object}/parameter/work-dir")"

# Install and enable the service
__evilham_single_binary_service woodpecker-server \
	--user "${USER}" \
	--version "${TYPE_VERSION}" \
	--checksum "${CHECKSUM}" \
	--url "${DOWNLOAD_URL}" \
	--working-directory "${WORK_DIR}" \
	--user-home-dir "${WORK_DIR}" \
	--state "present" \
	--unpack \
	--unpack-extension ".tar.gz" \
	--binary "woodpecker-server"\
	--custom-code "$(cat << DONE
${EXTRA_ARGS}
DONE
)"


# Create this instance's data dir, with restrictive permissions
require="__evilham_single_binary_service/woodpecker-server" __directory \
	"${WORK_DIR}" --state present \
	--mode 0750 --owner "${USER}" --group "${USER}"

A type/__evilham_woodpecker_ci_server/parameter/default/extra-args => type/__evilham_woodpecker_ci_server/parameter/default/extra-args +0 -0
A type/__evilham_woodpecker_ci_server/parameter/default/user => type/__evilham_woodpecker_ci_server/parameter/default/user +1 -0
@@ 0,0 1,1 @@
woodpecker

A type/__evilham_woodpecker_ci_server/parameter/default/work-dir => type/__evilham_woodpecker_ci_server/parameter/default/work-dir +1 -0
@@ 0,0 1,1 @@
/var/lib/woodpecker-server

A type/__evilham_woodpecker_ci_server/parameter/optional => type/__evilham_woodpecker_ci_server/parameter/optional +3 -0
@@ 0,0 1,3 @@
extra-args
user
work-dir

A type/__evilham_woodpecker_ci_server/singleton => type/__evilham_woodpecker_ci_server/singleton +0 -0