OP#647 initial commit after fork
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,3 +2,5 @@
|
|||||||
Gemfile.lock
|
Gemfile.lock
|
||||||
FileList
|
FileList
|
||||||
.scannerwork
|
.scannerwork
|
||||||
|
.vscode
|
||||||
|
.puppet-lint.rc
|
||||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -5,6 +5,8 @@
|
|||||||
"missingok",
|
"missingok",
|
||||||
"postrotate",
|
"postrotate",
|
||||||
"sharedscripts",
|
"sharedscripts",
|
||||||
"syslogs"
|
"syslogs",
|
||||||
|
"userpass",
|
||||||
|
"yumrepo"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
36
Jenkinsfile
vendored
36
Jenkinsfile
vendored
@@ -69,7 +69,7 @@ pipeline {
|
|||||||
withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) {
|
withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) {
|
||||||
sh '''
|
sh '''
|
||||||
/opt/sonar-scanner/bin/sonar-scanner \
|
/opt/sonar-scanner/bin/sonar-scanner \
|
||||||
-Dsonar.projectKey=alloy_cd \
|
-Dsonar.projectKey=confdroid_alloy \
|
||||||
-Dsonar.sources=. \
|
-Dsonar.sources=. \
|
||||||
-Dsonar.host.url=https://sonarqube.confdroid.com \
|
-Dsonar.host.url=https://sonarqube.confdroid.com \
|
||||||
-Dsonar.token=$SONAR_TOKEN
|
-Dsonar.token=$SONAR_TOKEN
|
||||||
@@ -90,16 +90,38 @@ pipeline {
|
|||||||
sh '''
|
sh '''
|
||||||
git config user.name "Jenkins Server"
|
git config user.name "Jenkins Server"
|
||||||
git config user.email jenkins@confdroid.com
|
git config user.email jenkins@confdroid.com
|
||||||
|
git rm -r --cached .vscode || echo "No .vscode to remove from git"
|
||||||
git add -A && git commit -am "Recommit for updates in build $BUILD_NUMBER" || echo "No changes to commit"
|
git add -A && git commit -am "Recommit for updates in build $BUILD_NUMBER" || echo "No changes to commit"
|
||||||
git push -o merge_request.create \
|
git push origin HEAD:master
|
||||||
-o merge_request.target=master \
|
'''
|
||||||
-o merge_request.title="Auto-merge for build $BUILD_NUMBER" \
|
}
|
||||||
-o merge_request.description="Automated changes from Jenkins build $BUILD_NUMBER" \
|
}
|
||||||
-o merge_request.merge_when_pipeline_succeeds=true \
|
}
|
||||||
origin jenkins-build-$BUILD_NUMBER
|
stage('Mirror to Gitea') {
|
||||||
|
steps {
|
||||||
|
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||||
|
withCredentials([usernamePassword(
|
||||||
|
credentialsId: 'Jenkins-gitea',
|
||||||
|
usernameVariable: 'GITEA_USER',
|
||||||
|
passwordVariable: 'GITEA_TOKEN')]) {
|
||||||
|
script {
|
||||||
|
// Checkout from GitLab (already done implicitly)
|
||||||
|
sh '''
|
||||||
|
git checkout master
|
||||||
|
git pull origin master
|
||||||
|
git branch -D development
|
||||||
|
git branch -D jenkins-build-$BUILD_NUMBER
|
||||||
|
git rm -f Jenkinsfile
|
||||||
|
git rm -r --cached .vscode || echo "No .vscode to remove from git"
|
||||||
|
git commit --amend --no-edit --allow-empty
|
||||||
|
git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_alloy.git
|
||||||
|
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
||||||
|
push master --mirror
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
49
README.md
49
README.md
@@ -1,14 +1,26 @@
|
|||||||
# Readme
|
# Readme
|
||||||
|
|
||||||
[](https://jenkins.confdroid.com/job/alloy_cd/)
|
[](https://jenkins.confdroid.com/job/confdroid_alloy/)
|
||||||
|
|
||||||
[[_TOC_]]
|
- [Readme](#readme)
|
||||||
|
- [Synopsis](#synopsis)
|
||||||
|
- [WARNING](#warning)
|
||||||
|
- [Features](#features)
|
||||||
|
- [Repo Documentation](#repo-documentation)
|
||||||
|
- [Dependencies](#dependencies)
|
||||||
|
- [Deployment](#deployment)
|
||||||
|
- [SELINUX](#selinux)
|
||||||
|
- [Known Problems](#known-problems)
|
||||||
|
- [Support](#support)
|
||||||
|
- [Tests](#tests)
|
||||||
|
- [Contact Us](#contact-us)
|
||||||
|
- [Disclaimer](#disclaimer)
|
||||||
|
|
||||||
## Synopsis
|
## Synopsis
|
||||||
|
|
||||||
Grafana Alloy is a log management agent built by Grafana labs to scrape and forward logs to Loki, a log management system also built by Grafana labs. Then you can use Grafana itself to visualize those logs and built an alerting system.
|
Grafana Alloy is a log management agent built by Grafana labs to scrape and forward logs to Loki, a log management system also built by Grafana labs. Then you can use Grafana itself to visualize those logs and built an alerting system.
|
||||||
|
|
||||||
`alloy_cd` is a Puppet module to automate installation and configuration of alloy.
|
`confdroid_alloy` is a Puppet module to automate installation and configuration of alloy.
|
||||||
|
|
||||||
## WARNING
|
## WARNING
|
||||||
|
|
||||||
@@ -18,13 +30,13 @@ Grafana Alloy is a log management agent built by Grafana labs to scrape and forw
|
|||||||
|
|
||||||
INSTALLATION
|
INSTALLATION
|
||||||
|
|
||||||
* installs alloy binaries
|
- installs alloy binaries
|
||||||
|
|
||||||
CONFIGURATION
|
CONFIGURATION
|
||||||
|
|
||||||
* manage directories and files including templates
|
- manage directories and files including templates
|
||||||
* manages the main alloy jenkins for loki and prometheus
|
- manages the main alloy jenkins for loki and prometheus
|
||||||
* manage service
|
- manage service
|
||||||
|
|
||||||
## Repo Documentation
|
## Repo Documentation
|
||||||
|
|
||||||
@@ -36,17 +48,17 @@ All dependencies must be included in the catalogue.
|
|||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
* native Puppet deployment
|
- native Puppet deployment
|
||||||
|
|
||||||
via site.pp or nodes.pp
|
via site.pp or nodes.pp
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
node 'example.example.net' {
|
node 'example.example.net' {
|
||||||
include cd_kubernetes
|
include confdroid_alloy
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
* through Foreman:
|
- through Foreman:
|
||||||
|
|
||||||
In order to apply parameters through Foreman, the params.pp must be added to the host or host group in question.
|
In order to apply parameters through Foreman, the params.pp must be added to the host or host group in question.
|
||||||
|
|
||||||
@@ -60,19 +72,22 @@ All files and directories are configured with correct selinux context. If selinu
|
|||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
* OS: Rocky 9
|
- OS: Rocky 9
|
||||||
* Puppet 6,8
|
- Puppet 8
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
* Puppet Lint
|
- Puppet Lint
|
||||||
* Puppet Parser
|
- excluded tests:
|
||||||
* ERB Template Parser
|
- `--no-variable_scope-check`: not applicable as we are inheriting parameters from params class. the lint check does not distinguish between facts and inherited parameters.
|
||||||
* Sonar Quality Gate
|
- Puppet Parser
|
||||||
|
- ERB Template Parser
|
||||||
|
- Sonar Quality Gate
|
||||||
|
|
||||||
## Contact Us
|
## Contact Us
|
||||||
|
|
||||||
[contact Us](https://confdroid.com/contact/)
|
- [contact Us](https://confdroid.com/contact/)
|
||||||
|
- [Feedback Portal](https://feedback.confdroid.com)
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
## alloy_cd::init.pp
|
## confdroid_alloy::init.pp
|
||||||
# Module name: alloy_cd
|
# Module name: confdroid_alloy
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary Class initializes the alloy_cd module.
|
# @summary Class initializes the confdroid_alloy module.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
class alloy_cd {
|
class confdroid_alloy {
|
||||||
include alloy_cd::params
|
include confdroid_alloy::params
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#### alloy_cd::main::config.pp
|
#### confdroid_alloy::main::config.pp
|
||||||
# Module name: alloy_cd
|
# Module name: confdroid_alloy
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary Class manages module logic for the alloy_cd module
|
# @summary Class manages module logic for the confdroid_alloy module
|
||||||
###############################################################################
|
###############################################################################
|
||||||
class alloy_cd::main::config (
|
class confdroid_alloy::main::config (
|
||||||
|
|
||||||
) inherits alloy_cd::params {
|
) inherits confdroid_alloy::params {
|
||||||
include alloy_cd::main::service
|
include confdroid_alloy::main::service
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
## alloy_cd::main::dirs.pp
|
## confdroid_alloy::main::dirs.pp
|
||||||
# Module name: alloy_cd
|
# Module name: confdroid_alloy
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary Class manages required directories for the alloy_cd module
|
# @summary Class manages required directories for the confdroid_alloy module
|
||||||
###############################################################################
|
###############################################################################
|
||||||
class alloy_cd::main::dirs (
|
class confdroid_alloy::main::dirs (
|
||||||
|
|
||||||
) inherits alloy_cd::params {
|
) inherits confdroid_alloy::params {
|
||||||
require alloy_cd::main::install
|
require confdroid_alloy::main::install
|
||||||
|
|
||||||
# main config dir
|
# main config dir
|
||||||
file { $ay_main_dir:
|
file { $ay_main_dir:
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
## alloy_cd::main::files.pp
|
## confdroid_alloy::main::files.pp
|
||||||
# Module name: alloy_cd
|
# Module name: confdroid_alloy
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary Class manages required config files for the alloy_cd module
|
# @summary Class manages required config files for the confdroid_alloy module
|
||||||
###############################################################################
|
###############################################################################
|
||||||
class alloy_cd::main::files (
|
class confdroid_alloy::main::files (
|
||||||
|
|
||||||
) inherits alloy_cd::params {
|
) inherits confdroid_alloy::params {
|
||||||
require alloy_cd::main::dirs
|
require confdroid_alloy::main::dirs
|
||||||
|
|
||||||
# Ensure log_targets is always an array
|
# Ensure log_targets is always an array
|
||||||
$log_targets_array = Array($alloy_cd::params::ay_log_targets, true)
|
$log_targets_array = Array($confdroid_alloy::params::ay_log_targets, true)
|
||||||
|
|
||||||
file { $ay_main_file:
|
file { $ay_main_file:
|
||||||
ensure => file,
|
ensure => file,
|
||||||
@@ -20,7 +20,7 @@ class alloy_cd::main::files (
|
|||||||
selrole => object_r,
|
selrole => object_r,
|
||||||
seltype => etc_t,
|
seltype => etc_t,
|
||||||
seluser => system_u,
|
seluser => system_u,
|
||||||
content => template('alloy_cd/config.alloy.erb'),
|
content => template('confdroid_alloy/config.alloy.erb'),
|
||||||
notify => Service[$ay_service],
|
notify => Service[$ay_service],
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ class alloy_cd::main::files (
|
|||||||
selrole => object_r,
|
selrole => object_r,
|
||||||
seltype => etc_t,
|
seltype => etc_t,
|
||||||
seluser => system_u,
|
seluser => system_u,
|
||||||
content => template('alloy_cd/logrotate.rsyslog.erb'),
|
content => template('confdroid_alloy/logrotate.rsyslog.erb'),
|
||||||
}
|
}
|
||||||
|
|
||||||
# manage log file group permissions
|
# manage log file group permissions
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
## alloy_cd::main::install.pp
|
## confdroid_alloy::main::install.pp
|
||||||
# Module name: alloy_cd
|
# Module name: confdroid_alloy
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary Class installs packages for the alloy_cd module
|
# @summary Class installs packages for the confdroid_alloy module
|
||||||
###############################################################################
|
###############################################################################
|
||||||
class alloy_cd::main::install (
|
class confdroid_alloy::main::install (
|
||||||
|
|
||||||
) inherits alloy_cd::params {
|
) inherits confdroid_alloy::params {
|
||||||
require alloy_cd::main::yumrepo
|
require confdroid_alloy::main::yumrepo
|
||||||
|
|
||||||
package { $reqpackages:
|
package { $ay_reqpackages:
|
||||||
ensure => $pkg_ensure,
|
ensure => $ay_pkg_ensure,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
## alloy_cd::main::service.pp
|
## confdroid_alloy::main::service.pp
|
||||||
# Module name: alloy_cd
|
# Module name: confdroid_alloy
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary Class manages the alloy service
|
# @summary Class manages the alloy service
|
||||||
###############################################################################
|
###############################################################################
|
||||||
class alloy_cd::main::service (
|
class confdroid_alloy::main::service (
|
||||||
|
|
||||||
) inherits alloy_cd::params {
|
) inherits confdroid_alloy::params {
|
||||||
require alloy_cd::main::files
|
require confdroid_alloy::main::files
|
||||||
|
|
||||||
service { $ay_service:
|
service { $ay_service:
|
||||||
ensure => running,
|
ensure => running,
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
## alloy_cd::main::yumrepo.pp
|
## confdroid_alloy::main::yumrepo.pp
|
||||||
# Module name: alloy_cd
|
# Module name: confdroid_alloy
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary class install yum repos for the alloy_cd module
|
# @summary class install yum repos for the confdroid_alloy module
|
||||||
##############################################################################
|
##############################################################################
|
||||||
class alloy_cd::main::yumrepo (
|
class confdroid_alloy::main::yumrepo (
|
||||||
|
|
||||||
) inherits alloy_cd::params {
|
) inherits confdroid_alloy::params {
|
||||||
# test
|
# test
|
||||||
yumrepo { 'grafana':
|
yumrepo { 'grafana':
|
||||||
ensure => 'present',
|
ensure => 'present',
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
## alloy_cd::params.pp
|
## confdroid_alloy::params.pp
|
||||||
# Module name: alloy_cd
|
# Module name: confdroid_alloy
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @param [String] reqpackages which packages to install
|
# @param [String] ay_reqpackages which packages to install
|
||||||
# @param [String] pkg_ensure 'latest' or 'present'
|
# @param [String] ay_pkg_ensure 'latest' or 'present'
|
||||||
# @param [String] ay_loki_url the url where alloy will send logs to.
|
# @param [String] ay_loki_url the url where alloy will send logs to.
|
||||||
# @param [String] ay_loki_username the username to logon to loki
|
# @param [String] ay_loki_username the username to logon to loki
|
||||||
# @param [String] ay_loki_userpass the password to logon to loki
|
# @param [String] ay_loki_userpass the password to logon to loki
|
||||||
@@ -12,12 +12,12 @@
|
|||||||
# the node exporter (external)
|
# the node exporter (external)
|
||||||
# @param [String] ay_prom_url the url where alloy will send metrics
|
# @param [String] ay_prom_url the url where alloy will send metrics
|
||||||
# @param [Array] ay_log_targets the logging targets
|
# @param [Array] ay_log_targets the logging targets
|
||||||
# @summary Class contains all parameters for the alloy_cd module.
|
# @summary Class contains all parameters for the confdroid_alloy module.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
class alloy_cd::params (
|
class confdroid_alloy::params (
|
||||||
|
|
||||||
String $reqpackages = 'alloy',
|
String $ay_reqpackages = 'alloy',
|
||||||
String $pkg_ensure = 'latest',
|
String $ay_pkg_ensure = 'latest',
|
||||||
|
|
||||||
# loki
|
# loki
|
||||||
Boolean $ay_manage_loki = true,
|
Boolean $ay_manage_loki = true,
|
||||||
@@ -44,5 +44,5 @@ class alloy_cd::params (
|
|||||||
$ay_main_file = "${ay_main_dir}/config.alloy"
|
$ay_main_file = "${ay_main_dir}/config.alloy"
|
||||||
|
|
||||||
# includes must be last
|
# includes must be last
|
||||||
include alloy_cd::main::config
|
include confdroid_alloy::main::config
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user