Page MenuHomeDevCentral

No OneTemporary

diff --git a/AGENTS.md b/AGENTS.md
index 1f0418c..af37d0b 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,133 +1,133 @@
## Salt Code Conventions
These conventions apply to Salt state and configuration-management code in this repository.
### State dependencies
-Salt executes states in file order, so execution order within an SLS file is deterministic.
+Salt executes states in file order, so the execution order within an SLS file is deterministic.
Do **not** add `require`, `watch`, `onchanges`, or similar requisites merely to express the dependency between successive states in the same file.
Prefer the simplest code that relies on the file's execution order.
Use requisites when they provide actual behavior that cannot be expressed by file order, especially when a service must be reloaded or restarted when its configuration changes.
For example, if a configuration file should trigger a service reload when changed, use an appropriate requisite rather than relying only on the order of the states.
### Managed file contents
For `file.managed`, store repository-managed file contents in the corresponding `files/` directory.
Do **not** put file contents directly in the `contents` parameter when the content belongs in the repository.
Add a header to repository-managed files that clearly identifies them as being managed by this repository.
For example:
```yaml
/etc/example.conf:
file.managed:
- source: salt://path/to/files/example.conf
```
with the repository file containing an appropriate repository-management header.
### Template file extensions
When a file is a template, normally preserve the original file extension.
For example:
```text
files/foo.conf
files/script.sh
files/config.yaml
```
-If adding Jinja syntax would cause the file to be incorrectly handled by a shell, Python, YAML, or other language linter, append `.jinja` to the original extension:
+If adding Jinja syntax causes the file to be incorrectly handled by a shell, Python, YAML, or other language linter, append `.jinja` to the original extension:
```text
files/foo.sh.jinja
files/config.yaml.jinja
```
Use `.jinja`, **not `.j2`**.
The extension in the repository should reflect the language of the deployed file. When a command or script is deployed without its source-language extension, keep the language extension in the repository but omit it from the deployed filename.
For example:
```text
files/foo.sh
```
may be deployed as:
```text
/usr/local/bin/foo
```
### State block names
When a state deploys a file to a specific path, use that destination path as the state ID.
For example:
```yaml
/etc/example/example.conf:
file.managed:
- source: salt://example/files/example.conf
```
The state ID is therefore the actual path being managed.
Do not introduce an arbitrary descriptive state ID such as:
```yaml
deploy_example_config:
file.managed:
- name: /etc/example/example.conf
```
when the state manages a file at a precise path.
The state ID is implicitly the `name` parameter when `name` is not specified, so using the path directly keeps the state concise and makes the managed resource immediately visible.
Use a descriptive state ID when there are duplicates.
### Template variables
Make template variables visible from the .sls file that uses the template.
Do **not** query Pillar data, grains, or Salt functions directly from inside a Jinja template.
Instead, resolve the values in the `context` of the `file.managed` state and pass them explicitly to the template.
Prefer:
```yaml
/etc/example/example.conf:
file.managed:
- source: salt://example/files/example.conf.jinja
- context:
hostname: {{ grains['host'] }}
setting: {{ pillar['example']['setting'] }}
```
with the template using:
```jinja
hostname = {{ hostname }}
setting = {{ setting }}
```
rather than having the template directly access:
```jinja
{{ grains['host'] }}
{{ pillar['example']['setting'] }}
```
or invoke Salt functions itself.
This makes the inputs to a template visible where the state is declared, simplifies the template, and makes dependencies on external Salt data explicit.
diff --git a/README.md b/README.md
index 3992d22..932dc45 100644
--- a/README.md
+++ b/README.md
@@ -1,181 +1,181 @@
Nasqueron operations
====================
Welcome to **[rOPS](https://devcentral.nasqueron.org/diffusion/OPS/)**,
the Nasqueron operations repository.
------------
Introduction
------------
This repository contains the configuration of our infrastructure servers,
mostly relying on [Salt](https://docs.saltproject.io/en/latest/contents.html)
for deployment and automation.
Additional utilities for humans and Terraform provisioning are also provided.
Nasqueron infrastructure servers support our community
of creative people, writers, developers, and thinkers.
Nasqueron follows the principle of *Infrastructure as Code*
to offer documentation, reproducibility, transparency and
to allow external contributions.
-----------------
Content and scope
-----------------
The repository contains:
- server configuration
- deployment information for our applications and services
Combining this repository with NetBox, the goal is to constitute
an exhaustive inventory and source of truth for our infrastructure.
Both Nasqueron servers and side projects we manage are in scope.
For example, the [Eglide](http://www.eglide.org/) service is configured through
`roles/core` (common to every server) and `roles/shellserver` (specific).
---------
Structure
---------
This repository is organized as follows:
### A. Services
Services are organized in roles and units.
* **Roles:** a role is a full high-level service (e.g., mailserver, paas-docker)
* **Units:** a unit is a component to achieve the service's goals
- (e.g., a userland software collection, a nginx server)
+ (e.g., a userland software collection, an nginx server)
Directories follow `roles/<role>/<unit>`.
Those files are known as **states** or **formulas**.
They are generally written in YAML, with Jinja2 templating.
If configuration files for a unit should be stored,
a subfolder `files/` is created at unit level.
The `top.sls` file defines which states are loaded by server,
while the `services.sls` describes service configurations
that aren't server-specific.
The `map.jinja` file is used to provide “Omni-OS” configuration:
as we deploy onto several Linux distributions (Debian, Rocky) and FreeBSD,
we need to provide a way to map packages and directories.
*Note:* If anything escapes to the role and unit logic organization,
like for CVE hotfixes, `hotfixes/` directory is used.
### B. Structured data
Structured data is stored in the `pillar/` directory.
Those files are known as **pillar**.
This data is structured as we found suitable to express it
cleanly, and queried from states, directly or through functions.
Each pillar .sls file is directly written in YAML.
The `top.sls` file defines which pillar files are loaded by server,
while the `tower.sls` file acts similarly and allows more flexibility.
### C. SaltStack modules
While states offer powerful templating capabilities, they can easily become
too complex to maintain when evolving from declarations to full programs.
For this reason, we use Salt modules to express more complex logic.
Modules are written in Python. The Python functions can directly be called
from states.
The modules are stored in the following directories:
* Execution modules are stored in `_modules/`
* States modules are stored in `_states/`
As any program, modules should be tested. See section E.
### D. UNIX resource assignments
This repository is the source of truth for service accounts, groups, and ports:
* `pillar/core/ids.sls` maps unique usernames and groups with their UIDs/GIDs
* `PORTS` contains the list of reserved application ports
When a service needs one of these resources, assign it in the corresponding file.
### E. Tests
Unit and integration tests are stored in `_tests/`
You can test the correctness of several repository aspects:
- Salt configuration files in `_tests/config/`
- Salt execution modules in `_tests/modules/`
- Salt pillar in `_tests/pillar/`
- Scripts deployed within this repository in `_tests/scripts/`
If you add a new directory, you should add a corresponding entry in `Makefile`.
### F. Resources
Resources used by automated tasks to generate repository files are stored
in `_resources/`, for example, templates for new services.
It also contains JSON schemas to validate key pillar data.
### G. Utilities
Scripts and other utilities to be run by Nasqueron Operations SIG members
are stored in `utils/`.
----------
Contribute
----------
Contributions are welcome to this repository, especially if you wish to:
1. improve our infrastructure
2. install or configure something on a Nasqueron server
3. install or configure something on a project we manage (like Eglide)
4. automate deployment of one of your Nasqueron projects
You can follow this [contributor guide](https://agora.nasqueron.org/How%20to%20contribute%20code)
to send a commit for review. This procedure is open to everyone.
Issues can be reported on the [#Servers component](https://devcentral.nasqueron.org/tag/servers/)
on DevCentral, the Nasqueron Phabricator instance.
Documentation about the repository and tips for IDEs are available on Agora:
https://agora.nasqueron.org/Operations_grimoire/Operations_repository
Minimum Salt version: 3006
Support for contributors is provided on Libera #nasqueron-ops.
---------------------
Inclusive terminology
---------------------
The repository uses the following terminology:
- **Salt primary server**: a server that issues commands to other servers or itself
- **Node**: a server, baremetal, or VM configured by Salt
Nasqueron follows the inclusive language conventions to ensure that our
community is welcoming to everyone.
-------
License
-------
A lot of configuration as code is trivial, and so ineligible for copyright per
[threshold of originality](https://en.wikipedia.org/wiki/Threshold_of_originality)
When this is not the case, the code is licensed under
[BSD-2-Clause](https://opensource.org/licenses/BSD-2-Clause)
if not otherwise specified.
diff --git a/_modules/forest.py b/_modules/forest.py
index 659ecf7..4452fe8 100644
--- a/_modules/forest.py
+++ b/_modules/forest.py
@@ -1,133 +1,133 @@
# -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Salt — Forest execution module
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Functions related to forests
# License: BSD-2-Clause
# -------------------------------------------------------------
def exists(forest):
"""
A function to check if a forest exists.
CLI Example::
salt '*' forest.exists eglide
"""
return forest in __pillar__.get("forests", [])
def get():
"""
A function to get the forest of the current minion
CLI Example::
salt '*' forest.get
"""
nodes = __pillar__.get("nodes")
minion = __grains__["id"]
return nodes[minion]["forest"]
def list_groups(forest=None):
"""
A function to list groups for a forest.
CLI Example::
salt '*' forest.list_groups
"""
if forest is None:
forest = get()
groups = __pillar__.get("shellgroups_ubiquity", [])
groups_by_forest = __pillar__.get("shellgroups_by_forest", {})
if forest in groups_by_forest:
groups.extend(groups_by_forest[forest])
return groups
def get_groups(forest=None):
"""
A function to get groups for a forest as a dictionary,
including the group properties.
CLI Example::
salt '*' forest.get_groups
"""
groups = {}
for groupname in list_groups(forest):
groups[groupname] = __pillar__["shellgroups"][groupname]
return groups
def list_users(forest=None):
"""
A function to list groups for a forest.
CLI Example::
salt '*' forest.list_users
"""
users = []
for group in get_groups(forest).values():
if "members" in group:
users.extend(group["members"])
return list(set(users))
def _get_user(forest, username):
user = __pillar__["shellusers"][username]
if "ssh_keys" not in user:
user["ssh_keys"] = []
try:
user["ssh_keys"].extend(user["ssh_keys_by_forest"][forest])
except KeyError:
pass
return user
def get_users(forest=None):
"""
A function to get users for a forest as a dictionary,
- including the users properties.
+ including the user's properties.
CLI Example::
salt '*' forest.get_users
"""
users = {}
if forest is None:
forest = get()
for username in list_users(forest):
users[username] = _get_user(forest, username)
return users
def get_wheel_users():
"""
A function to get users to provision to the wheel group.
CLI Example::
salt '*' forest.get_wheel_users
"""
return ["root", *__pillar__["shellgroups"]["ops"]["members"]]
diff --git a/_states/credentials.py b/_states/credentials.py
index 6148262..3d343b0 100644
--- a/_states/credentials.py
+++ b/_states/credentials.py
@@ -1,36 +1,36 @@
# -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Salt — Credentials state
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
-# Description: Allow to declare credentials-related states
+# Description: Allow declaring credentials-related states
# License: BSD-2-Clause
# -------------------------------------------------------------
from salt.utils.files import fopen
def vault_policy_present(name, policy_file):
"""
Ensure a Vault policy with the given name is present.
name
The name of the policy
policy_file
Path to a file on the minion containing rules,
formatted in HCL.
.. code-block:: yaml
demo_policy:
vault.policy_present:
- name: foo/bar
- policy_file: /opt/vault-policies/demo.hcl
"""
with fopen(policy_file) as fd:
rules = fd.read()
return __states__["vault.policy_present"](name, rules)
diff --git a/pillar/paas/docker/dwellers/main.sls b/pillar/paas/docker/dwellers/main.sls
index 93a867d..37e3611 100644
--- a/pillar/paas/docker/dwellers/main.sls
+++ b/pillar/paas/docker/dwellers/main.sls
@@ -1,127 +1,127 @@
# -------------------------------------------------------------
# Salt — Provision Docker engine
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
# -------------------------------------------------------------
# Images
#
# You can append a :tag (by default, latest is used).
#
# It's not possible to specify Docker library images only by final name.
# See https://docs.saltstack.com/en/latest/ref/states/all/salt.states.docker_image.html
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
docker_images:
- certbot/certbot
# Core service
- nasqueron/mysql:5.7
# Continuous deployment jobs
- jenkins/jenkins
- nasqueron/jenkins-agent-php
# -------------------------------------------------------------
# Networks
#
# Containers can be grouped by network, instead to use links.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
docker_networks:
bugzilla:
subnet: 172.21.3.0/24
jenkinsTest:
subnet: 172.21.5.0/24
# -------------------------------------------------------------
# Docker engine configuration
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
docker_daemon:
data-root: /srv/docker
group: nasqueron-dev-docker
# -------------------------------------------------------------
# Containers
#
# The docker_containers entry allow to declare
# containers by image by servers
#
# The hierarchy is so as following.
#
# docker_containers:
# service codename:
# instance name:
# container properties
#
# The service codename must match a state file in
# the roles/paas-docker/containers/ directory.
#
# The container will be run with the specified instance name.
#
# **nginx**
#
# The container properties can also describe the information
# needed to configure nginx with the host and app_port key.
#
# In such case, a matching vhost file should be declared as
# roles/paas-docker/nginx/files/vhosts/<service codename>.sls
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
docker_containers:
#
# Core services
#
mysql:
bugzilla_db:
network: bugzilla
version: 5.7
credentials:
root: espacewin/bugzilla/mysql_root
#
# Bugzilla
#
bugzilla:
ew_bugzilla:
host: bugzilla.espace-win.org
app_port: 33080
network: bugzilla
mysql:
host: bugzilla_db
db: EspaceWin_Bugs
credential: espacewin/bugzilla/mysql
#
# Jenkins
#
jenkins:
jenkins_test:
realm: test
host: jenkins.test.nasqueron.org
app_port: 47080
jnlp_port: 52000
jenkins_agent:
zosso:
image_flavour: php
realm: test
#
# Mastodon
#
# Mastodon is currently deployed manually through docker-compose
# and not yet integrated to the platform. This declaration is
- # currently only used for extra utilities deployment.
+ # currently only used for extra utilities' deployment.
mastodon_sidekiq:
mastodon_sidekiq_1:
realm: nasqueron
diff --git a/roles/core/network/init.sls b/roles/core/network/init.sls
index 2240210..9bfc072 100644
--- a/roles/core/network/init.sls
+++ b/roles/core/network/init.sls
@@ -1,23 +1,23 @@
# -------------------------------------------------------------
# Salt — Network
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
include:
- .ipv4
- .ipv6
- .ipv6_tunnel
- .ipv6_fixes
- .dhclient6
- .gre
- .gre_logging
- .routes
# Drake can be configured as:
#
# - ipv4 (e.g. IntraNought network cards on EXSi hypervisor VMs)
# - gre (e.g. isolated servers needing a tunnel)
#
-# Both are needed for servers with router role.
+# Both are needed for servers with the router role.
diff --git a/roles/core/sshd/init.sls b/roles/core/sshd/init.sls
index 75a8c87..b08b65d 100644
--- a/roles/core/sshd/init.sls
+++ b/roles/core/sshd/init.sls
@@ -1,50 +1,50 @@
# -------------------------------------------------------------
# Salt — OpenSSH configuration
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
{% from "map.jinja" import paths, capabilities with context %}
{% set network = salt["node.resolve_network"]() %}
# -------------------------------------------------------------
# OpenSSH
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/etc/ssh/sshd_config:
file.managed:
- source: salt://roles/core/sshd/files/sshd_config
- template: jinja
- context:
listen_private_address: {{ network["private_ipv4_address"] | default("localhost") }}
should_listen_to_private_address: {{ network["is_private_network_stable"] | default(false) }}
sftp: {{ paths.sftp }}
print_motd: {{ not capabilities["MOTD-printed-at-login"] }}
# -------------------------------------------------------------
# Service
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{% if grains["os"] == "FreeBSD" %}
/etc/rc.conf.d/sshd:
file.managed:
- source: salt://roles/core/sshd/files/rc.conf
{% endif %}
# -------------------------------------------------------------
# PAM
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# T1194 - Debian offers a nologin pam module avoiding people
# to log in when /etc/nologin exists. OS can pop this file,
-# for example at shutdown time or when systemd boot hasn't
+# for example, at shutdown time or when systemd boot hasn't
# finished.
pam_disable_nologin:
file.comment:
- name: /etc/pam.d/sshd
- regex: ^account.*pam_nologin\.so
- ignore_missing: True
- backup: None
diff --git a/roles/devserver/poudriere/content.sls b/roles/devserver/poudriere/content.sls
index 32e7fcf..21a98a9 100644
--- a/roles/devserver/poudriere/content.sls
+++ b/roles/devserver/poudriere/content.sls
@@ -1,66 +1,66 @@
#!py
# -------------------------------------------------------------
# Poudriere :: Jails
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: BSD-2-Clause
# -------------------------------------------------------------
# -------------------------------------------------------------
# Data helper methods
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def get_kernel_version():
# "14.1-RELEASE-p5" -> "14.1-RELEASE"
return "-".join(__grains__["kernelrelease"].split("-")[0:2])
# -------------------------------------------------------------
# Configuration provider
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def provide_port_state(name, path):
name = name.replace("-", "_")
return "poudriere_ports_" + name, {
"cmd.run": [
{"name": f"poudriere ports -c -m null -M {path} -p {name}"},
{"creates": f"/usr/local/etc/poudriere.d/ports/{name}"},
]
}
def provide_port_states():
ports = __pillar__.get("poudriere", {}).get("ports", {})
return dict([provide_port_state(name, path) for name, path in ports.items()])
def run():
major = __grains__["osmajorrelease"]
version = get_kernel_version()
arch = __grains__["cpuarch"]
- # Base jail and ports tree
+ # Base jail and ports' tree
states = {
"poudriere_jails_base": {
"cmd.run": [
{"name": f"poudriere jail -c -j base{major} -v {version} -a {arch}"},
{"creates": f"/usr/local/poudriere/jails/base{major}"},
]
},
"poudriere_ports_default": {
"cmd.run": [
{"name": "poudriere ports -c -m git+https -B main"},
{"creates": "/usr/local/poudriere/ports/default"},
]
},
}
# Additional block according pillar
states.update(provide_port_states())
return states
diff --git a/roles/devserver/userland-home/cron.sls b/roles/devserver/userland-home/cron.sls
index bb8802e..eade554 100644
--- a/roles/devserver/userland-home/cron.sls
+++ b/roles/devserver/userland-home/cron.sls
@@ -1,36 +1,36 @@
#!py
# -------------------------------------------------------------
# Salt — Provision user content
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
def get_cron_path(user):
- """Get source cron path in operations repository."""
+ """Get the source cron path in operations repository."""
return f"roles/devserver/userland-home/files/_crons/{user}"
def has_crontab(user):
return salt["slsutil.file_exists"](get_cron_path(user))
def build_cron_file(user):
cron_source_path = get_cron_path(user)
return {
"cron.file": [
{"name": f"salt://{cron_source_path}"},
{"user": user},
]
}
def run():
return {
f"devserver_crontab_{user}": build_cron_file(user)
for user in salt["forest.get_users"]()
if has_crontab(user)
}
diff --git a/roles/devserver/userland-software/dev.sls b/roles/devserver/userland-software/dev.sls
index a05ef79..0ca0772 100644
--- a/roles/devserver/userland-software/dev.sls
+++ b/roles/devserver/userland-software/dev.sls
@@ -1,284 +1,284 @@
# -------------------------------------------------------------
# Salt — Provision dev software
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
{% from "map.jinja" import dirs, packages, packages_prefixes with context %}
# -------------------------------------------------------------
# C/C++
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_c:
pkg.installed:
- pkgs:
- {{ packages.boost }}
- cmocka
- doxygen
- {{ packages.librabbitmq }}
{% if grains["os_family"] == "FreeBSD" %}
- gcc14
{% endif %}
{% if grains["os_family"] == "FreeBSD" %}
/usr/local/bin/gcc:
file.symlink:
- target: /usr/local/bin/gcc14
{% endif %}
# -------------------------------------------------------------
# Haskell
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_haskell:
pkg.installed:
- pkgs:
- ghc
# -------------------------------------------------------------
# Java
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_java:
pkg.installed:
- pkgs:
- openjdk17
- apache-ant
- maven
devserver_software_dev_java_to_prune:
pkg.removed:
- pkgs:
- openjdk8
# -------------------------------------------------------------
# .Net languages
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_dotnet:
pkg.installed:
- pkgs:
- mono
# -------------------------------------------------------------
# Node
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_node:
pkg.installed:
- pkgs:
- {{ packages.node }}
- npm
devserver_node_packages:
npm.installed:
- pkgs:
- bower
- browserify
- csslint
- eslint
- gulp
- grunt
- jscs
- jshint
- jsonlint
- react-tools
- require:
- pkg: devserver_software_dev_node
# -------------------------------------------------------------
# PHP
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_php:
pkg.installed:
- pkgs:
- {{ packages_prefixes.pecl }}ast
- {{ packages_prefixes.pecl }}xdebug
# T1728 - xdebug should be disabled by default and invoked when needed
/usr/local/etc/php/ext-20-xdebug.ini:
file.absent
/opt/phpcpd.phar:
file.managed:
- source: https://phar.phpunit.de/phpcpd-6.0.3.phar
- source_hash: 2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb
- mode: 755
/opt/phploc.phar:
file.managed:
- source: https://phar.phpunit.de/phploc-7.0.2.phar
- source_hash: 3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46
- mode: 755
phpdox:
cmd.run:
- name: |
git clone --depth 1 https://github.com/nasqueron/phpdox
cd phpdox && composer install
- cwd: /opt
- creates: /opt/phpdox/phpdox
phpunit:
cmd.run:
- name: |
curl --silent https://sebastian-bergmann.de/gpg.asc | gpg --import
wget -O /opt/phpunit.phar https://phar.phpunit.de/phpunit-10.phar
wget -O /opt/phpunit.phar.asc https://phar.phpunit.de/phpunit-10.phar.asc
cd /opt && gpg --verify ./phpunit.phar.asc
rm /opt/phpunit.phar.asc
- creates: /opt/phpunit.phar
{{ dirs.bin }}/run-php-script:
file.managed:
- source: salt://roles/devserver/userland-software/files/run-php-script.sh
- mode: 755
{% for command in ["phan", "phpcpd", "phpdox", "phploc", "phpmd", "phpstan", "phpunit", "psalm", "rector"] %}
{{ dirs.bin }}/{{ command }}:
file.managed:
- source: salt://roles/devserver/userland-software/files/run-php-script-alias.sh.jinja
- mode: 755
- template: jinja
- context:
command: {{ command }}
{% endfor %}
# -------------------------------------------------------------
# Python
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_python:
pkg.installed:
- pkgs:
- {{ packages_prefixes.python3 }}beautifulsoup
- {{ packages_prefixes.python3 }}nltk
- {{ packages_prefixes.python3 }}numpy
# -------------------------------------------------------------
# Ruby
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_ruby:
pkg.installed:
- pkgs:
- {{ packages_prefixes.rubygem }}rubocop
# -------------------------------------------------------------
# Rust
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_rust:
pkg.installed:
- pkgs:
- rust
{{ dirs.bin }}/rustup-init:
file.managed:
- source: salt://roles/devserver/userland-software/files/rustup-init.sh
- mode: 755
{{ dirs.bin }}/cargo-index-update:
file.managed:
- source: salt://roles/devserver/userland-software/files/rust/cargo-index-update.sh
- mode: 755
# -------------------------------------------------------------
# Shell
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_shell:
pkg.installed:
- pkgs:
- hs-ShellCheck
# -------------------------------------------------------------
# TCL
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_tcl:
pkg.installed:
- pkgs:
- rlwrap
- tcllib
- tclsoap
- {{ packages.tcltls }}
- {{ packages.tdom }}
# -------------------------------------------------------------
# Web development
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_web:
pkg.installed:
- pkgs:
- memcached
# -------------------------------------------------------------
# Editors and IDE
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_vim:
pkg.installed:
- pkgs:
- # Vim itself is already declared in core role.
- # FreeBSD also offers nvi in base system.
+ # Vim itself is already declared in the core role.
+ # FreeBSD also offers nvi in the base system.
# Neovim
- neovim
- {{ packages_prefixes.python3 }}pynvim
# -------------------------------------------------------------
# Tools like code review utilities
#
# Arcanist is installed in the Phabricator states
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_misctools:
pkg.installed:
- pkgs:
- git-review
# -------------------------------------------------------------
# Nasqueron development and operations
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_terraform:
pkg.installed:
- pkgs:
- opentofu
- terraform
devserver_software_dev_operations:
pkg.installed:
- pkgs:
- ovhcloud-cli
{{ dirs.bin }}/create-vault-approle:
file.managed:
- source: salt://roles/devserver/userland-software/files/create-vault-approle.sh
- mode: 755
devserver_software_dev_vault:
pkg.installed:
- pkgs:
- {{ packages_prefixes.python3 }}pyhcl
- {{ packages_prefixes.python3 }}hvac
- vault-medusa
# -------------------------------------------------------------
# MediaWiki development
#
# Include tools for some extensions like ProofreadPage
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_mediawiki:
pkg.installed:
- pkgs:
- netpbm
- {{ packages["djvulibre"] }}
diff --git a/roles/opensearch/opensearch/config.sls b/roles/opensearch/opensearch/config.sls
index dfc9fff..769ed1b 100644
--- a/roles/opensearch/opensearch/config.sls
+++ b/roles/opensearch/opensearch/config.sls
@@ -1,79 +1,79 @@
# -------------------------------------------------------------
# Salt — Provision OpenSearch
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# -------------------------------------------------------------
{% set config = salt["opensearch.get_config"]() %}
# -------------------------------------------------------------
# OpenSearch
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/opt/opensearch/config/opensearch.yml:
file.managed:
- source: salt://roles/opensearch/opensearch/files/opensearch.conf
- user: opensearch
- group: opensearch
- template: jinja
- context:
config: {{ config }}
/opt/opensearch/config/jvm.options:
file.managed:
- source: salt://roles/opensearch/opensearch/files/jvm.options
- user: opensearch
- group: opensearch
- template: jinja
- context:
heap_size: {{ config["heap_size"] }}
# -------------------------------------------------------------
# TLS certificates
#
# This method is based on OpenSearch Ansible playbook to
-# generate self-signed certificates for node to node (transport)
+# generate self-signed certificates for node-to-node (transport)
# communication, and for the rest API.
#
# The certificates are generated by Search Guard Offline TLS Tool.
#
# This should only run on one node, then provisioned everywhere.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/usr/local/dl/search-guard-tlstool.zip:
file.managed:
- source: https://maven.search-guard.com/search-guard-tlstool/1.8/search-guard-tlstool-1.8.zip
- source_hash: f59f963c7ee28d557849ccde297660a3c593a6bf3531d7852fb9ab8b4fc7597e
/opt/tlstool:
file.directory:
- mode: 700
archive.extracted:
- source: /usr/local/dl/search-guard-tlstool.zip
- enforce_toplevel: False
/opt/tlstool/config/tlsconfig.yml:
file.managed:
- source: salt://roles/opensearch/opensearch/files/tlsconfig.yml.jinja
- template: jinja
- context:
config: {{ config }}
domain_name: {{ grains["domain"] }}
node_full_domain_name: {{ grains["fqdn"] }}
opensearch_generate_certificates:
cmd.run:
- name: /opt/tlstool/tools/sgtlstool.sh -c /opt/tlstool/config/tlsconfig.yml -ca -crt -t /opt/tlstool/config/
- env:
JAVA_HOME: /opt/opensearch/jdk
- creates: /opt/tlstool/config/root-ca.pem
{% for certificate in salt["opensearch.list_certificates"]() %}
opensearch_deploy_certificate_{{ certificate }}:
cmd.run:
- name: install --mode=0600 --owner=opensearch {{ certificate }}.pem {{ certificate }}.key /opt/opensearch/config
- cwd: /opt/tlstool/config
- creates: /opt/opensearch/config/{{ certificate }}.pem
{% endfor %}
diff --git a/roles/paas-docker/containers/files/orbeon/nasqueron_forms/web.xml b/roles/paas-docker/containers/files/orbeon/nasqueron_forms/web.xml
index dbee43a..9bf0ded 100644
--- a/roles/paas-docker/containers/files/orbeon/nasqueron_forms/web.xml
+++ b/roles/paas-docker/containers/files/orbeon/nasqueron_forms/web.xml
@@ -1,409 +1,409 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Orbeon :: Configuration
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Project: Nasqueron
License: Trivial work, not eligible to copyright
Source file: roles/paas-docker/containers/files/orbeon/nasqueron_forms/properties-local.xml
_____________________________________________________________
<auto-generated>
This file is managed by our rOPS SaltStack repository.
Changes to this file may cause incorrect behavior
and will be lost if the state is redeployed.
</auto-generated>
-->
<web-app
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Nasqueron Forms</display-name>
<description>
- Nasqueron Forms is an Orbeon Forms, a XForms web forms solutions
+ Nasqueron Forms is an Orbeon Forms, a XForms web forms solution
to create and fill complex forms.
</description>
<distributable/>
<!--Initialize main resource manager-->
<context-param>
<param-name>oxf.resources.factory</param-name>
<param-value>org.orbeon.oxf.resources.PriorityResourceManagerFactory</param-value>
</context-param>
<!--Web application resource manager for resources-->
<context-param>
<param-name>oxf.resources.priority.2</param-name>
<param-value>org.orbeon.oxf.resources.WebAppResourceManagerFactory</param-value>
</context-param>
<context-param>
<param-name>oxf.resources.priority.2.oxf.resources.webapp.rootdir</param-name>
<param-value>/WEB-INF/resources</param-value>
</context-param>
<!--Classloader resource manager-->
<context-param>
<param-name>oxf.resources.priority.6</param-name>
<param-value>org.orbeon.oxf.resources.ClassLoaderResourceManagerFactory</param-value>
</context-param>
<!--Set run mode ("dev" or "prod")-->
<context-param>
<param-name>oxf.run-mode</param-name>
<param-value>prod</param-value>
</context-param>
<!--Set location of properties.xml-->
<context-param>
<param-name>oxf.properties</param-name>
<param-value>oxf:/config/properties-${oxf.run-mode}.xml</param-value>
</context-param>
<!--Determine whether logging initialization must take place-->
<context-param>
<param-name>oxf.initialize-logging</param-name>
<param-value>true</param-value>
</context-param>
<!--Set context listener processors-->
<!-- Uncomment this for the context listener processors -->
<!--
<context-param>
<param-name>oxf.context-initialized-processor.name</param-name>
<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
</context-param>
<context-param>
<param-name>oxf.context-initialized-processor.input.config</param-name>
<param-value>oxf:/apps/context/context-initialized.xpl</param-value>
</context-param>
<context-param>
<param-name>oxf.context-destroyed-processor.name</param-name>
<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
</context-param>
<context-param>
<param-name>oxf.context-destroyed-processor.input.config</param-name>
<param-value>oxf:/apps/context/context-destroyed.xpl</param-value>
</context-param>-->
<!-- End context listener processors -->
<!--Set session listener processors-->
<!-- Uncomment this for the session listener processors -->
<!--
<context-param>
<param-name>oxf.session-created-processor.name</param-name>
<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
</context-param>
<context-param>
<param-name>oxf.session-created-processor.input.config</param-name>
<param-value>oxf:/apps/context/session-created.xpl</param-value>
</context-param>
<context-param>
<param-name>oxf.session-destroyed-processor.name</param-name>
<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
</context-param>
<context-param>
<param-name>oxf.session-destroyed-processor.input.config</param-name>
<param-value>oxf:/apps/context/session-destroyed.xpl</param-value>
</context-param>-->
<!-- End session listener processors -->
<!--Security filter for eXist-->
<filter>
<filter-name>orbeon-exist-filter</filter-name>
<filter-class>org.orbeon.oxf.servlet.TokenSecurityFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>orbeon-exist-filter</filter-name>
<url-pattern>/exist/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<!--Limit concurrent access to Form Runner-->
<filter>
<filter-name>orbeon-limiter-filter</filter-name>
<filter-class>org.orbeon.oxf.servlet.LimiterFilter</filter-class>
<!--Include Form Runner pages and XForms Ajax requests-->
<init-param>
<param-name>include</param-name>
<param-value>(/fr/.*)|(/xforms-server)</param-value>
</init-param>
<!--Exclude resources not produced by services-->
<init-param>
<param-name>exclude</param-name>
<param-value>(?!/([^/]+)/service/).+\.(gif|css|pdf|json|js|coffee|map|png|jpg|xsd|htc|ico|swf|html|htm|txt)</param-value>
</init-param>
<!--Minimum, requested, and maximum number of concurrent threads allowed-->
<!--The `x` prefix specifies a multiple of the number of CPU cores reported by the JVM-->
<init-param>
<param-name>min-threads</param-name>
<param-value>1</param-value>
</init-param>
<init-param>
<param-name>num-threads</param-name>
<param-value>x1</param-value>
</init-param>
<init-param>
<param-name>max-threads</param-name>
<param-value>x1</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>orbeon-limiter-filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<!--Add internal Orbeon-* headers for auth-->
<filter>
<filter-name>orbeon-form-runner-auth-servlet-filter</filter-name>
<filter-class>org.orbeon.oxf.servlet.FormRunnerAuthFilter</filter-class>
<!--
<init-param>
<param-name>content-security-policy</param-name>
<param-value>default-src 'self'; img-src 'self' data:</param-value>
</init-param>
-->
</filter>
<filter-mapping>
<filter-name>orbeon-form-runner-auth-servlet-filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<!--All JSP files under /xforms-jsp go through the XForms filter-->
<filter>
<filter-name>orbeon-xforms-filter</filter-name>
<filter-class>org.orbeon.oxf.servlet.OrbeonXFormsFilter</filter-class>
<!-- Uncomment this for the separate WAR deployment -->
<!--
<init-param>
<param-name>oxf.xforms.renderer.context</param-name>
<param-value>/orbeon</param-value>
</init-param>
<init-param>
<param-name>oxf.xforms.renderer.default-encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>-->
<!-- End separate WAR deployment -->
</filter>
<filter-mapping>
<filter-name>orbeon-xforms-filter</filter-name>
<url-pattern>/xforms-jsp/*</url-pattern>
<!--Servlet 2.4 configuration allowing the filter to run upon forward in addition to request-->
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<!--Orbeon context listener-->
<listener>
<listener-class>org.orbeon.oxf.webapp.OrbeonServletContextListener</listener-class>
</listener>
<!--Context listener for deployment with replication-->
<listener>
<listener-class>org.orbeon.oxf.xforms.ReplicationServletContextListener</listener-class>
</listener>
<!--XForms session listener-->
<listener>
<listener-class>org.orbeon.oxf.xforms.XFormsServletContextListener</listener-class>
</listener>
<!--General-purpose session listener-->
<listener>
<listener-class>org.orbeon.oxf.webapp.OrbeonSessionListener</listener-class>
</listener>
<!--Ehcache shutdown listener-->
<listener>
<listener-class>net.sf.ehcache.constructs.web.ShutdownListener</listener-class>
</listener>
<!--This is the main Orbeon Forms servlet-->
<servlet>
<servlet-name>orbeon-main-servlet</servlet-name>
<servlet-class>org.orbeon.oxf.servlet.OrbeonServlet</servlet-class>
<!--Set main processor-->
<init-param>
<param-name>oxf.main-processor.name</param-name>
<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
</init-param>
<init-param>
<param-name>oxf.main-processor.input.config</param-name>
<param-value>oxf:/config/prologue-servlet.xpl</param-value>
</init-param>
<!--Set error processor-->
<init-param>
<param-name>oxf.error-processor.name</param-name>
<param-value>{http://www.orbeon.com/oxf/processors}page-flow</param-value>
</init-param>
<init-param>
<param-name>oxf.error-processor.input.controller</param-name>
<param-value>oxf:/config/error-page-flow.xml</param-value>
</init-param>
<!--Set supported methods-->
<init-param>
<param-name>oxf.http.accept-methods</param-name>
<param-value>get,post,head,put,delete,lock,unlock</param-value>
</init-param>
<!--Set servlet initialization and destruction listeners-->
<!-- Uncomment this for the servlet listener processors -->
<!--
<init-param>
<param-name>oxf.servlet-initialized-processor.name</param-name>
<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
</init-param>
<init-param>
<param-name>oxf.servlet-initialized-processor.input.config</param-name>
<param-value>oxf:/apps/context/servlet-initialized.xpl</param-value>
</init-param>
<init-param>
<param-name>oxf.servlet-destroyed-processor.name</param-name>
<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
</init-param>
<init-param>
<param-name>oxf.servlet-destroyed-processor.input.config</param-name>
<param-value>oxf:/apps/context/servlet-destroyed.xpl</param-value>
</init-param>-->
<!-- End servlet listener processors -->
</servlet>
<!--This is the XForms Renderer servlet, used to deploy Orbeon Forms as a separate WAR-->
<servlet>
<servlet-name>orbeon-renderer-servlet</servlet-name>
<servlet-class>org.orbeon.oxf.servlet.OrbeonServlet</servlet-class>
<!--Set main processor-->
<init-param>
<param-name>oxf.main-processor.name</param-name>
<param-value>{http://www.orbeon.com/oxf/processors}page-flow</param-value>
</init-param>
<init-param>
<param-name>oxf.main-processor.input.controller</param-name>
<param-value>oxf:/ops/xforms/xforms-renderer-page-flow.xml</param-value>
</init-param>
<!--Set error processor-->
<init-param>
<param-name>oxf.error-processor.name</param-name>
<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
</init-param>
<init-param>
<param-name>oxf.error-processor.input.config</param-name>
<param-value>oxf:/config/error.xpl</param-value>
</init-param>
</servlet>
<!-- Uncomment this for the eXist XMLRPC support -->
<!--
<servlet>
<servlet-name>exist-xmlrpc-servlet</servlet-name>
<servlet-class>org.exist.xmlrpc.RpcServlet</servlet-class>
</servlet>-->
<!-- End eXist XMLRPC support -->
<servlet>
<servlet-name>exist-rest-servlet</servlet-name>
<servlet-class>org.exist.http.servlets.EXistServlet</servlet-class>
<init-param>
<param-name>basedir</param-name>
<param-value>WEB-INF/</param-value>
</init-param>
<init-param>
<param-name>configuration</param-name>
<param-value>exist-conf.xml</param-value>
</init-param>
<init-param>
<param-name>start</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>orbeon-main-servlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>orbeon-renderer-servlet</servlet-name>
<url-pattern>/xforms-renderer</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>exist-rest-servlet</servlet-name>
<url-pattern>/exist/rest/*</url-pattern>
</servlet-mapping>
<!-- Uncomment this for the eXist XMLRPC support -->
<!--
<servlet-mapping>
<servlet-name>exist-xmlrpc-servlet</servlet-name>
<url-pattern>/exist/xmlrpc/*</url-pattern>
</servlet-mapping>-->
<!-- End eXist XMLRPC support -->
- <!-- Uncomment this for the relational persistence, and change oracle if necessary -->
+ <!-- Uncomment this for the relational persistence and change oracle if necessary -->
<!--
<resource-ref>
<description>DataSource</description>
<res-ref-name>jdbc/oracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>-->
- <!-- End relational persistence, and change oracle if necessary -->
+ <!-- End relational persistence and change oracle if necessary -->
<!-- Form Runner authentication -->
- <!-- Require the security role on /fr/auth by default. To protect everything this must be changed. -->
+ <!-- Require the security role on /fr/auth by default. To protect everything, this must be changed. -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Form Runner</web-resource-name>
<url-pattern>/fr/auth</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>orbeon-user</role-name>
</auth-constraint>
</security-constraint>
<!-- The following pages and services are allowed without constraints by default -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Form Runner services and public pages and resources</web-resource-name>
<url-pattern>/fr/service/*</url-pattern>
<url-pattern>/fr/style/*</url-pattern>
<url-pattern>/fr/not-found</url-pattern>
<url-pattern>/fr/error</url-pattern>
<url-pattern>/fr/login</url-pattern>
<url-pattern>/fr/login-error</url-pattern>
</web-resource-collection>
</security-constraint>
<!-- Form builder requires authentication -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Form Builder</web-resource-name>
<url-pattern>/fr/orbeon/builder/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>orbeon-admin</role-name>
</auth-constraint>
</security-constraint>
<!-- Form admin requires authentication -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Form Administration</web-resource-name>
<url-pattern>/fr/admin</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>orbeon-admin</role-name>
</auth-constraint>
</security-constraint>
<!-- Landing pages requires authentication -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Form landing pages</web-resource-name>
<url-pattern>/fr/</url-pattern>
<url-pattern>/fr/forms</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>orbeon-admin</role-name>
</auth-constraint>
</security-constraint>
<!-- Default security role -->
<security-role>
<role-name>orbeon-user</role-name>
</security-role>
<!-- Use the form-based method by default -->
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/fr/login</form-login-page>
<form-error-page>/fr/login-error</form-error-page>
</form-login-config>
</login-config>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
</web-app>
diff --git a/roles/paas-docker/kernel/init.sls b/roles/paas-docker/kernel/init.sls
index ec82f2d..1b2a375 100644
--- a/roles/paas-docker/kernel/init.sls
+++ b/roles/paas-docker/kernel/init.sls
@@ -1,33 +1,33 @@
# -------------------------------------------------------------
# Salt — Provision Docker engine
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
{% if grains["os_family"] == "RedHat" %}
{% if salt["file.file_exists"]("/etc/tuned") %}
/etc/tuned/paas-docker:
file.directory
/etc/tuned/paas-docker/tuned.conf:
file.managed:
- source: salt://roles/paas-docker/kernel/files/tuned.conf
apply_paas_docker_tuned_configuration:
cmd.run:
- name: tuned-adm profile paas-docker
- onchanges:
- file: /etc/tuned/paas-docker/tuned.conf
{% else %}
-# /sys/kernel allows to write settings and display the selected one in []
+# /sys/kernel allows writing settings and display the selected one in []
restrict_hugepages:
cmd.run:
- name: echo madvise > /sys/kernel/mm/transparent_hugepage/enabled
- unless: grep -q "\[madvise\]" /sys/kernel/mm/transparent_hugepage/enabled
{% endif %}
{% endif %}
diff --git a/roles/paas-docker/nginx/config.sls b/roles/paas-docker/nginx/config.sls
index c30c41d..253c64a 100644
--- a/roles/paas-docker/nginx/config.sls
+++ b/roles/paas-docker/nginx/config.sls
@@ -1,77 +1,77 @@
# -------------------------------------------------------------
# Salt — Provision Docker engine
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
{% from "map.jinja" import dirs with context %}
{% set containers = pillar.get("docker_containers", {}) %}
# -------------------------------------------------------------
# vhosts folder
#
# :: fallback when a domain isn't found
# :: server cover page
# :: containers
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ dirs.etc }}/nginx/vhosts/000-fallback.conf:
file.managed:
- source: salt://roles/paas-docker/nginx/files/vhosts/base/fallback.conf
{{ dirs.etc }}/nginx/vhosts/001-server.conf:
file.managed:
- source: salt://roles/paas-docker/nginx/files/vhosts/base/server.conf
- template: jinja
- context:
fqdn: {{ grains["fqdn"] }}
ipv4: {{ grains["ipv4"] | join(" ") }}
ipv6: "{{ salt["node.get_ipv6_list"]() }}"
/var/log/www/_server:
file.directory:
- user: nginx
- group: root
{% for service, instances in containers.items() %}
{% if salt["paas_docker.is_nginx_service"](instances) %}
/var/log/www/{{ service }}:
file.directory:
- user: nginx
- group: root
{% for instance, container in instances.items() %}
{% if "host" in container %}
{% set vhost_config = salt["paas_docker.resolve_vhost_config_file"](service) %}
{{ dirs.etc }}/nginx/vhosts/{{ service }}/{{ instance }}.conf:
file.managed:
- source: salt://{{ vhost_config }}
- mode: 644
- makedirs: True
- template: jinja
- context:
service: {{ service }}
instance: {{ instance }}
fqdn: {{ container["host"] }}
app_port: {{ container["app_port"] }}
aliases: {{ container["aliases"] | default("", true) | join(" ") }}
# If the nginx configuration needs more key,
- # pass directly the container dictionary.
+ # directly pass the container dictionary.
args: {{ container }}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
# -------------------------------------------------------------
# Log
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/etc/logrotate.d/nginx:
file.managed:
- source: salt://roles/paas-docker/nginx/files/logrotate/nginx.conf
diff --git a/roles/shellserver/userland-software/base.sls b/roles/shellserver/userland-software/base.sls
index 344b493..2cb97e8 100644
--- a/roles/shellserver/userland-software/base.sls
+++ b/roles/shellserver/userland-software/base.sls
@@ -1,309 +1,309 @@
# -------------------------------------------------------------
# Salt — Provision base software
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
{% from "map.jinja" import dirs, packages, packages_prefixes with context %}
# -------------------------------------------------------------
# Editors
#
# Disclaimer: We don't caution the views of Richard Stallman
# or the Church of Emacs positions.
# See http://geekfeminism.wikia.com/wiki/EMACS_virgins_joke
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
editors:
pkg.installed:
- pkgs:
- joe
- vim
- emacs-nox
# -------------------------------------------------------------
# General UNIX utilities
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
utilities:
pkg.installed:
- pkgs:
- cmatrix
- datamash
- figlet
- glow
- {{ packages.gpg }}
- grc
- mc
- moreutils
- mosh
- nmap
- {{ packages.pandoc }}
- reptyr
- toilet
- unrar
- whois
- zip
{% if grains["os_family"] == "Debian" %}
- bsdmainutils
- dnsutils
- sockstat
- sysvbanner
- toilet-fonts
{% endif %}
{% if grains["os"] == "FreeBSD" %}
- bind-tools
- coreutils
- figlet-fonts
- findutils
- gsed
- sudo
- wurf
{% endif %}
utilities_www:
pkg.installed:
- pkgs:
- links
- lynx
- w3m
# -------------------------------------------------------------
# Fortune data
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{% if grains["os"] == "FreeBSD" %}
fortune_data:
pkg.installed:
- pkgs:
- fortune-mod-bofh
- fortune-mod-epictetus
- fortune-mod-freebsd-classic
- fortune-mod-futurama
{% endif %}
# -------------------------------------------------------------
# More exotic shells
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
userland_software_shells:
pkg.installed:
- pkgs:
- fish
# -------------------------------------------------------------
# Development
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
dev:
pkg.installed:
- pkgs:
- {{ packages.ag }}
- autoconf
- automake
- {{ packages.bats }}
- cmake
- {{ packages.cppunit }}
- git-absorb
- git-lfs
- jq
- valgrind
{% if grains["os"] == "FreeBSD" %}
- hub
# Recent clang/llvm versions
- llvm22
{% else %}
- arcanist
- clang
- llvm
- strace
{% endif %}
{% if grains["os_family"] == "Debian" %}
dev_popular_libs:
pkg.installed:
- pkgs:
- libssl-dev
{% endif %}
# -------------------------------------------------------------
# Languages
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
languages_removed:
pkg.removed:
- pkgs:
{% if grains["os_family"] == "Debian" %}
- php7.0
- php7.1
- php7.2
- php7.3
- php7.4
- php8.0
- php8.1
{% elif grains["os"] == "FreeBSD" %}
- php70
- php71
- php72
- php73
- php74
- php80
- php81
{% endif %}
languages:
pkg.installed:
- pkgs:
- python3
- name: {{ packages_prefixes.python3 }}pip
- {{ packages.tcl }}
{% if grains["os_family"] == "Debian" %}
- php8.2
{% elif grains["os"] == "FreeBSD" %}
- php83
{% endif %}
# -------------------------------------------------------------
# De facto standard libraries for languages
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
languages_libs:
pkg.installed:
- pkgs:
# PHP extensions
- {{ packages_prefixes.php }}bcmath
- {{ packages_prefixes.php }}curl
- {{ packages_prefixes.php }}gd
- {{ packages_prefixes.php }}intl
- {{ packages_prefixes.php }}mbstring
- {{ packages_prefixes.php }}soap
- {{ packages_prefixes.php }}xml
- {{ packages_prefixes.php }}xsl
{% if grains["os_family"] == "Debian" %}
- {{ packages_prefixes.php }}json
- # On Debian, these PDO extensions doesn't follow regular names
+ # On Debian, these PDO extensions don't follow regular names
# but are installed if you require the legacy extension name.
- {{ packages_prefixes.php }}mysql
- {{ packages_prefixes.php }}pgsql
- {{ packages_prefixes.php }}sqlite3
{% else %}
# On Debian, these extensions are now shipped by default:
- {{ packages_prefixes.php }}calendar
- {{ packages_prefixes.php }}ctype
- {{ packages_prefixes.php }}dom
- {{ packages_prefixes.php }}fileinfo
- {{ packages_prefixes.php }}filter
- {{ packages_prefixes.php }}gettext
- {{ packages_prefixes.php }}iconv
- {{ packages_prefixes.php }}mysqli
- {{ packages_prefixes.php }}pcntl
- {{ packages_prefixes.php }}pdo
- {{ packages_prefixes.php }}phar
- {{ packages_prefixes.php }}session
- {{ packages_prefixes.php }}simplexml
- {{ packages_prefixes.php }}sockets
- {{ packages_prefixes.php }}sodium
- {{ packages_prefixes.php }}tokenizer
- {{ packages_prefixes.php }}xmlreader
- {{ packages_prefixes.php }}xmlwriter
- {{ packages_prefixes.php }}zip
- {{ packages_prefixes.php }}zlib
- # On Debian, these PDO extensions doesn't follow regular names:
+ # On Debian, these PDO extensions don't follow regular names:
- {{ packages_prefixes.php }}pdo_mysql
- {{ packages_prefixes.php }}pdo_pgsql
- {{ packages_prefixes.php }}pdo_sqlite
{% endif %}
# PECL extensions
- {{ packages_prefixes.pecl }}yaml
# PHP utilities
- {{ packages.composer }}
{% if grains["os"] != "FreeBSD" %}
# On FreeBSD, PEAR is still a PHP 5.6 package (last tested 2018-02-17).
# Same for Composer (last tested 2018-02-28)
- {{ packages.pear }}
- {{ packages.phpcs }}
{% endif %}
# Standard Python modules
{% if grains["os"] == "FreeBSD" %}
- {{ packages_prefixes.python3 }}gdbm
- {{ packages_prefixes.python3 }}sqlite3
{% endif %}
# TCL
- tcllib
- {{ packages.tcltls }}
languages_libs_removed_files:
file.absent:
- names:
- /usr/local/etc/php/ext-20-openssl.ini
# -------------------------------------------------------------
# Workaround : install phpcs on FreeBSD
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{% if grains["os"] == "FreeBSD" %}
/opt/phpcs:
file.directory
{% for command in ["phpcs", "phpcbf"] %}
/opt/phpcs/{{ command }}:
file.managed:
- source: https://squizlabs.github.io/PHP_CodeSniffer/{{ command }}.phar
- skip_verify: True
- mode: 755
{{ dirs.bin }}/{{ command }}:
file.symlink:
- target: /opt/phpcs/{{ command }}
- require:
- file: /opt/phpcs/{{ command }}
{% endfor %}
{% endif %}
# -------------------------------------------------------------
# Spelling and language utilities
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
spelling:
pkg.installed:
- pkgs:
- {{ packages["aspell-en"] }}
- {{ packages["aspell-fr"] }}
- {{ packages.verbiste }}
# -------------------------------------------------------------
# Media utilities
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
media:
pkg.installed:
- pkgs:
- {{ packages.exiftool }}
- gifsicle
- id3v2
- {{ packages.imagemagick }}
- mozjpeg
- optipng
- sox
# -------------------------------------------------------------
# Office utilities (bureautique)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
office_software:
pkg.installed:
- pkgs:
- gcal
- pdftk
- {{ packages.poppler }}
- qpdf
diff --git a/roles/webserver-alkane/php/cleanup.sls b/roles/webserver-alkane/php/cleanup.sls
index e474cd6..73b06f3 100644
--- a/roles/webserver-alkane/php/cleanup.sls
+++ b/roles/webserver-alkane/php/cleanup.sls
@@ -1,45 +1,45 @@
#!py
# -------------------------------------------------------------
# Salt — Provision PHP websites — php-fpm pools
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# Description: When a site is declared to be served by
# an instance, pools from other instances
# should be deleted if they exist.
#
-# That allows to move pools among instances.
+# That allows moving pools among instances.
# -------------------------------------------------------------
def get_etc_dir():
if __grains__["os"] == "FreeBSD":
return "/usr/local/etc"
return "/etc"
def files_to_delete_if_they_exist():
files = []
etc_dir = get_etc_dir()
for instance in __pillar__["php_fpm_instances"]:
files.extend(
[
etc_dir + "/php-fpm.d/" + instance + "-pools/" + site["user"] + ".conf"
for _, site in __pillar__["web_php_sites"].items()
if site["php-fpm"] != instance
]
)
return files
def run():
config = {}
# Task: delete php-fpm stale files
for file in files_to_delete_if_they_exist():
config[file] = {"file.absent": []}
return config
diff --git a/roles/webserver-alkane/php/php.sls b/roles/webserver-alkane/php/php.sls
index ea8e072..bca9aa1 100644
--- a/roles/webserver-alkane/php/php.sls
+++ b/roles/webserver-alkane/php/php.sls
@@ -1,105 +1,105 @@
# -------------------------------------------------------------
# Salt — Provision PHP websites — php-fpm pools
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
{% from "map.jinja" import dirs, packages, packages_prefixes with context %}
{% set is_devserver = salt["node.has_role"]("devserver") %}
# -------------------------------------------------------------
# Install PHP through packages
#
# The extensions cover a standard PHP installation,
# and the needs of the known applications we use.
#
# If you need Debian compatibility, this list should be
# replaced by the shellserver one.
#
# The devserver role already install PHP through two layers:
# - roles/shellserver/userland-software/base.sls
# - roles/devserver/userland-software/dev.sls
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{% if not is_devserver %}
php_software:
pkg.installed:
- pkgs:
- php83
# PHP extensions
- {{ packages_prefixes.php }}bcmath
- {{ packages_prefixes.php }}curl
- {{ packages_prefixes.php }}gd
- {{ packages_prefixes.php }}intl
- {{ packages_prefixes.php }}mbstring
- {{ packages_prefixes.php }}soap
- {{ packages_prefixes.php }}xml
- {{ packages_prefixes.php }}xsl
- {{ packages_prefixes.php }}calendar
- {{ packages_prefixes.php }}ctype
- {{ packages_prefixes.php }}dom
- {{ packages_prefixes.php }}fileinfo
- {{ packages_prefixes.php }}filter
- {{ packages_prefixes.php }}gettext
- {{ packages_prefixes.php }}iconv
- {{ packages_prefixes.php }}mysqli
- {{ packages_prefixes.php }}pcntl
- {{ packages_prefixes.php }}pdo
- {{ packages_prefixes.php }}phar
- {{ packages_prefixes.php }}session
- {{ packages_prefixes.php }}simplexml
- {{ packages_prefixes.php }}sodium
- {{ packages_prefixes.php }}sockets
- {{ packages_prefixes.php }}tokenizer
- {{ packages_prefixes.php }}xmlreader
- {{ packages_prefixes.php }}xmlwriter
- {{ packages_prefixes.php }}zip
- {{ packages_prefixes.php }}zlib
- {{ packages_prefixes.php }}pdo_mysql
- {{ packages_prefixes.php }}pdo_pgsql
- {{ packages_prefixes.php }}pdo_sqlite
# PECL extensions
- {{ packages_prefixes.pecl }}yaml
# PHP utilities
- {{ packages.composer }}
{% endif %}
# -------------------------------------------------------------
# PHP global configuration
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ dirs.etc }}/php.ini:
file.managed:
- source: salt://roles/webserver-alkane/php/files/php.ini
- template: jinja
- context:
tasks:
{% if is_devserver %}
# Since D2655, devserver uses /var/run/mysql
- # This is not needed on production as MySQL is on another node
+ # This is not needed in production as MySQL is on another node
- set_mysql_sockets
{% else %}
# Enable Opcache, with aggressive caching
# This is not suitable in devserver: it needs a php-fpm restart
# when a PHP site is updated to invalidate the cache
- optimize_opcache
{% endif %}
{% for build in pillar.get("php_custom_builds", {}) %}
/opt/php/{{ build }}/lib/php.ini:
file.managed:
- source: {{ dirs.etc }}/php.ini:
{% endfor %}
# T1728 - xdebug should be disabled by default and invoked when needed
/usr/local/etc/php/ext-20-xdebug.ini:
file.absent
diff --git a/roles/webserver-content/README.md b/roles/webserver-content/README.md
index 9e0c7f8..8f677d4 100644
--- a/roles/webserver-content/README.md
+++ b/roles/webserver-content/README.md
@@ -1,63 +1,63 @@
# Webserver content
## Goal of this role
This role provisions the `/var/wwwroot` folder with the website content,
when there is a custom logic to prepare it, like a specific Git repository
-to clone, or a build process to follow.
+to clone or a build process to follow.
These roles do NOT describe web server configuration,
which is done in other `webserver-` roles.
## Structure
This role doesn't follow the role/unit folder hierarchy.
Instead, it follows a tld/domain/subdomain.sls logic.
For example, the folder for the `*.acme.tld` sites will be `tld/acme`.
This structure goal is to play nice with the Salt include syntax, as dots
are a directory separator.
The bipbip.acme.tld site will be described in `tld/acme/bipbip.sls` file.
The _generic folder offers common solutions to generic problems
like provision a .env file with database credentials or secret key.
## Add a new domain
1. Create a new folder hierarchy for the domain
2. Include a `init.sls` file for your subdomains
3. Declare the new domain in pillar/webserver
For example, the tld/acme/init.sls file could be:
```
include:
- .www
- .acme
```
Alphabetical order is followed, but www is generally first.
In the pillar file, a website is assigned to a role.
If you wish to deploy all the sites in one role, you can directly include
the folder, and your init.sls will do the rest.
If not, you can list the path to the subdomain file, without the .sls extension.
For example, to deploy bipbip.acme.tld (`tld/acme/bipbip.sls`) on servers
with the shellserver role:
```
shellserver:
- .tld/acme/bibpip
```
## Prune old files
If you need to prune a former website, you can add
the directory to the /hotfixes/old-directories.sls state.
There is no need to revert your commit when the
directories or files are deleted.
diff --git a/roles/webserver-content/org/nasqueron/init.sls b/roles/webserver-content/org/nasqueron/init.sls
index 421b6bd..3bac555 100644
--- a/roles/webserver-content/org/nasqueron/init.sls
+++ b/roles/webserver-content/org/nasqueron/init.sls
@@ -1,11 +1,11 @@
# -------------------------------------------------------------
# Salt — Provision *.nasqueron.org sites
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
# This section is intentionally left blank.
# As Nasqueron sites are distributed among several servers,
-# per domain files should be directly included instead.
+# per-domain files should be directly included instead.
diff --git a/utils/netbox/document-hypervisors.py b/utils/netbox/document-hypervisors.py
index b995e0b..443bf1e 100755
--- a/utils/netbox/document-hypervisors.py
+++ b/utils/netbox/document-hypervisors.py
@@ -1,181 +1,181 @@
#!/usr/bin/env python3
# -------------------------------------------------------------
-# NetBox — Document hypervisors facts in NetBox
+# NetBox — Document hypervisors' facts in NetBox
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: BSD-2-Clause
# Description: This script connects to hypervisors,
-# gather facts like last version used,
-# and document them to NetBox config context.
+# gathers facts like the last version used,
+# and documents them to NetBox config context.
# Dependencies: PyYAML, pynetbox
# -------------------------------------------------------------
import logging
import os
import sys
import pynetbox
import subprocess
import yaml
TAG_VMWARE = "VMWare ESXi"
# -------------------------------------------------------------
# Get NetBox config and credentials
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def get_netbox_config_from_salt():
config_path = "/usr/local/etc/salt/master.d/netbox.conf"
if not os.path.exists(config_path):
return False, None
with open(config_path) as fd:
salt_config = yaml.safe_load(fd)
salt_config = salt_config["ext_pillar"][0]["netbox"]
return True, {
"server": salt_config["api_url"].replace("/api/", ""),
"token": salt_config["api_token"],
}
def get_netbox_config_from_config_dir():
try:
config_path = os.path.join(os.environ["HOME"], ".config", "netbox", "auth.yaml")
except KeyError:
return False, None
if not os.path.exists(config_path):
return False, None
with open(config_path) as fd:
return True, yaml.safe_load(fd)
def get_netbox_config():
methods = [get_netbox_config_from_salt, get_netbox_config_from_config_dir]
for method in methods:
has_config, config = method()
if has_config:
return config
raise RuntimeError("Can't find NetBox config")
# -------------------------------------------------------------
# Service container
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def init_app():
"""Prepare a service container for application."""
config = get_netbox_config()
return {
"config": config,
"netbox": connect_to_netbox(config),
}
def connect_to_netbox(config):
return pynetbox.api(config["server"], token=config["token"])
# -------------------------------------------------------------
# Document hypervisors
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def document_hypervisors(app):
logging.info("Query NetBox DCIM to get devices")
devices = app["netbox"].dcim.devices.all()
for device in devices:
if is_device_tagged(device, TAG_VMWARE):
document_vmware_hypervisor(app["netbox"], device)
def document_vmware_hypervisor(nb, device):
logging.info(f"Documenting {device.name}")
ip = get_device_primary_ip_address(device)
logging.info(f"Connecting to {ip}")
version = ssh(ip, ["vmware", "-v"])
logging.debug(f"Version found: {version}")
update_actual_context_version(device, version)
# -------------------------------------------------------------
# Helper functions to use NetBox API
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def is_device_tagged(device, tag):
tags = [tag.name for tag in device.tags]
return tag in tags
def get_device_primary_ip_address(device):
pos = device.primary_ip.address.find("/")
return device.primary_ip.address[0:pos]
def update_actual_context_version(device, version):
try:
current_version = device.local_context_data["actual_context"]["version"]
if version == current_version:
return
except KeyError:
pass
if "actual_context" not in device.local_context_data:
device.local_context_data["actual_context"] = {}
device.local_context_data["actual_context"]["version"] = version
logging.info(f"Saving new local context for {device.name}: version is {version}")
device.save()
# -------------------------------------------------------------
# Helper functions to use SSH
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def ssh(host, command):
return run_process(["ssh", host, *command])
def run_process(command):
process = subprocess.run(command, capture_output=True)
if process.returncode == 0:
return process.stdout.decode("UTF-8").strip()
if len(process.stderr) > 0:
print(process.stderr.decode("UTF-8").strip(), file=sys.stderr)
logging.warning(
f"When running {command}: {process.stderr} (exit code: {process.returncode})"
)
return None
# -------------------------------------------------------------
# Application entry-point
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def run_document_hypervisors():
app = init_app()
document_hypervisors(app)
if __name__ == "__main__":
LOGLEVEL = os.environ.get("LOGLEVEL", "WARNING").upper()
logging.basicConfig(level=LOGLEVEL)
run_document_hypervisors()

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 14, 19:18 (4 d, 8 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4249828
Default Alt Text
(79 KB)

Event Timeline