Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3766511
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
18 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/map.jinja b/map.jinja
index b8674d8..3c9bd76 100644
--- a/map.jinja
+++ b/map.jinja
@@ -1,237 +1,234 @@
{% set dirs = salt['grains.filter_by']({
'Debian': {
'etc': '/etc',
'bin': '/usr/bin',
'home': '/home',
'include': '/usr/include',
'lib': '/usr/lib',
'libexec': '/usr/libexec',
'man': '/usr/share/man',
'sbin': '/usr/sbin',
'share': '/usr/share',
},
'FreeBSD' : {
'etc': '/usr/local/etc',
'bin': '/usr/local/bin',
'home': '/home',
'include': '/usr/local/include',
'lib': '/usr/local/lib',
'libexec': '/usr/local/libexec',
'man': '/usr/local/man',
'sbin': '/usr/local/sbin',
'share': '/usr/local/share',
},
}, default='Debian') %}
{% set services = salt['grains.filter_by']({
'Debian': {
'manager': 'systemd',
'firewall': 'iptables',
},
'RedHat': {
'manager': 'systemd',
'firewall': 'firewalld',
},
'FreeBSD' : {
'manager': 'rc',
'firewall': 'pf',
},
}, default='Debian') %}
{% set shells = salt['grains.filter_by']({
'Debian': {
'bash': '/bin/bash',
'fish': '/usr/bin/fish',
'nologin': '/usr/sbin/nologin',
'tcsh': '/usr/bin/tcsh',
'zsh': '/bin/zsh',
},
'FreeBSD' : {
'bash': '/usr/local/bin/bash',
'fish': '/usr/local/bin/fish',
'nologin': '/sbin/nologin',
'tcsh': '/bin/tcsh',
'zsh': '/usr/local/bin/zsh',
},
'Arch': {
'bash': '/bin/bash',
'fish': '/usr/bin/fish',
'nologin': '/sbin/nologin',
'tcsh': '/usr/bin/tcsh',
'zsh': '/bin/zsh',
},
}, default='Debian') %}
{% set paths = salt['grains.filter_by']({
'FreeBSD': {
'sshd': '/usr/sbin/sshd',
'sftp': '/usr/libexec/sftp-server',
},
'Debian': {
'sshd': '/usr/sbin/sshd',
'sftp': '/usr/lib/openssh/sftp-server',
},
'RedHat': {
'sshd': '/sbin/sshd',
'sftp': '/usr/libexec/openssh/sftp-server',
},
'Arch': {
'sshd': '/usr/sbin/sshd',
'sftp': '/usr/lib/ssh/sftp-server',
},
}, default='FreeBSD') %}
{% set packages_prefixes = salt['grains.filter_by']({
'Debian': {
'pecl': 'php-',
'php': 'php7.4-',
- 'python2': '',
'python3': 'python3-',
'rubygem': '',
},
'RedHat': {
'pecl': 'php-pecl-',
- 'python2': 'python-',
'python3': 'python3-',
'rubygem': 'rubygem-',
},
'FreeBSD' : {
'pecl': 'php83-pecl-',
'php': 'php83-',
- 'python2': 'py27-',
'python3': 'py39-',
'rubygem': 'rubygem-',
},
}, default='Debian') %}
{% set packages = salt['grains.filter_by']({
'Debian' : {
'7zip': '7zip',
'ag': 'silversearcher-ag',
'aspell-fr': 'aspell-fr',
'aspell-en': 'aspell-en',
'bats': 'bats',
'boost': 'libboost-all-dev',
'certbot': 'certbot',
'composer': 'composer',
'cppunit': 'libcppunit-dev',
'djvulibre': 'djvulibre-bin',
'exiftool': 'libimage-exiftool-perl',
'gpg': 'gpg',
'imagemagick': 'imagemagick',
'jpeg-turbo' : 'libjpeg-turbo',
'librabbitmq': 'librabbitmq-dev',
'lua': 'lua5.1',
'mariadb': 'mariadb-server',
'netcat': 'netcat-openbsd',
'node': 'nodejs',
'pear': 'php-pear',
'phpcs': 'php-codesniffer',
'postgresql': 'postgresql-15',
'prometheus-node-exporter': 'prometheus-node-exporter',
'sphinx': 'python3-sphinx',
'tcl': 'tcl8.6-dev',
'tcltls': 'tcl-tls',
'tdom': 'tdom',
'varnish': 'varnish',
'verbiste': 'verbiste',
'youtube-dl': 'youtube-dl',
'yubico-pam': 'libpam-yubico',
},
'RedHat': {
'ag': 'the_silver_searcher',
'aspell-fr': 'aspell-fr',
'certbot': 'python3-certbot',
'cppunit': 'cppunit-devel',
'djvulibre': 'djvulibre',
'exiftool': 'perl-Image-ExifTool',
'jpeg-turbo' : 'libjpeg-turbo',
'librabbitmq': 'librabbitmq',
'lua': 'lua',
'mariadb': 'mariadb-server',
'netcat': 'nmap-ncat',
'node': 'nodejs',
'pear': 'php-pear',
'phpcs': 'php-pear-PHP-CodeSniffer',
'prometheus-node-exporter': 'golang-github-prometheus-node-exporter',
'sphinx': 'python3-sphinx',
'tcl': 'tcl',
'tcltls': 'tcltls',
'varnish': 'varnish',
'youtube-dl': 'youtube-dl',
'yubico-pam': 'pam_yubico',
},
'Arch': {
'ag': 'the_silver_searcher',
'aspell-fr': 'aspell-fr',
'certbot': 'certbot',
'cppunit': 'cppunit',
'mariadb': 'mariadb',
'sphinx': 'python-sphinx',
'tcltls': 'tcltls',
'varnish': 'varnish',
'youtube-dl': 'youtube-dl',
'yubico-pam': 'yubico-pam',
},
'FreeBSD' : {
'7zip': '7-zip',
'ag': 'the_silver_searcher',
'aspell-fr': 'fr-aspell',
'aspell-en': 'en-aspell',
'bats': 'bats-core',
'boost': 'boost-all',
'certbot': 'py311-certbot',
'composer': 'php83-composer',
'cppunit': 'cppunit',
'djvulibre': 'djvulibre',
'exiftool': 'p5-Image-ExifTool-devel',
'gpg': 'gnupg',
'imagemagick': 'ImageMagick6-nox11',
'jpeg-turbo' : 'jpeg-turbo',
'librabbitmq': 'rabbitmq-c-devel',
'lua': 'lua51',
'mariadb': 'mariadb1011-server',
'node': 'node',
'pear': 'pear',
'phpcs': 'pear-PHP_CodeSniffer',
'postgresql': 'postgresql15-server',
'postgresql-contrib': 'postgresql15-contrib',
'prometheus-node-exporter': 'node_exporter',
'sphinx': 'py311-sphinx',
'tcl': 'tcl86',
'tcltls': 'tcltls',
'tdom': 'tDOM',
'varnish': 'varnish5',
'verbiste': 'fr-verbiste',
'youtube-dl': 'youtube_dl',
'yubico-pam': 'pam_yubico',
},
}, default='Debian') %}
{% set utilities = salt['grains.filter_by']({
'FreeBSD': {
'gmake': 'gmake',
},
'Debian': {
'gmake': 'make',
},
}, default='Debian') %}
{# -------------------------------------------------------------
Capabilities of OS and distributions
:: MOTD-printed-at-login
Login mechanism, through PAM or dotfiles,
prints the MOTD when a session is opened.
When at False, OpenSSH will take care of it.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #}
{% set capabilities = salt['grains.filter_by']({
'Debian': {
'MOTD-printed-at-login': True,
},
'FreeBSD' : {
'MOTD-printed-at-login': False,
},
}, default='Debian') %}
diff --git a/roles/devserver/userland-software/dev.sls b/roles/devserver/userland-software/dev.sls
index f3d072e..5b30b70 100644
--- a/roles/devserver/userland-software/dev.sls
+++ b/roles/devserver/userland-software/dev.sls
@@ -1,261 +1,257 @@
# -------------------------------------------------------------
# Salt — Provision dev software
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2017-10-20
# 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 }}
# -------------------------------------------------------------
# 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:
- # Modern Python 3 packages
- {{ packages_prefixes.python3 }}beautifulsoup
-
- # Legacy packages
- - {{ packages_prefixes.python2 }}nltk
- - {{ packages_prefixes.python2 }}numpy
- - {{ packages_prefixes.python2 }}virtualenv
+ - {{ 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
# -------------------------------------------------------------
# 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.
# 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
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ dirs.bin }}/create-vault-approle:
file.managed:
- source: salt://roles/devserver/userland-software/files/create-vault-approle.py
- mode: 755
devserver_software_dev_python_vault:
pkg.installed:
- pkgs:
- {{ packages_prefixes.python3 }}pyhcl
- {{ packages_prefixes.python3 }}hvac
# -------------------------------------------------------------
# MediaWiki development
#
# Include tools for some extensions like ProofreadPage
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
devserver_software_dev_mediawiki:
pkg.installed:
- pkgs:
- netpbm
- {{ packages['djvulibre'] }}
diff --git a/roles/devserver/userland-software/files/make.conf b/roles/devserver/userland-software/files/make.conf
index 887d89e..79088c1 100644
--- a/roles/devserver/userland-software/files/make.conf
+++ b/roles/devserver/userland-software/files/make.conf
@@ -1,20 +1,20 @@
# -------------------------------------------------------------
# System build information
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# Source file: roles/devserver/userland-software/files/make.conf
# -------------------------------------------------------------
#
# <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>
DEVELOPER=yes
WITH_CCACHE_BUILD=yes
CCACHE_DIR=/var/cache/ccache
-DEFAULT_VERSIONS+= php=8.3 mysql=11.4m apache=2.4 python=3.11 python3=3.11 python2=2.7 tcl=8.6
+DEFAULT_VERSIONS+= php=8.3 mysql=11.4m apache=2.4 python=3.11 python3=3.11 tcl=8.6
diff --git a/roles/paas-docker/containers/files/mastodon/clear-video-queue.py b/roles/paas-docker/containers/files/mastodon/clear-video-queue.py
index 34ff461..2e65ff2 100755
--- a/roles/paas-docker/containers/files/mastodon/clear-video-queue.py
+++ b/roles/paas-docker/containers/files/mastodon/clear-video-queue.py
@@ -1,87 +1,86 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -------------------------------------------------------------
# Mastodon - clear stuck video tasks from queue
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2018-12-08
# License: Trivial work, not eligible to copyright
# Source file: roles/paas-docker/containers/files/mastodon/clear-video-queue.py
# -------------------------------------------------------------
#
# <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>
-from __future__ import print_function
import subprocess
PS_COLUMN_PID = 0
PS_COLUMN_TIME = 3
PS_COLUMN_COMMAND = 4
SUSPECT_COMMANDS = ["ffmpeg"]
MAX_TIME = 30
def parse_time(time):
time_parts = [int(token) for token in time.split(":")]
return time_parts[0] * 60 + time_parts[1]
def process_time_is_up(time):
return parse_time(time) > MAX_TIME
def process_is_suspect(command):
for suspect_command in SUSPECT_COMMANDS:
if command.startswith(suspect_command):
return True
return False
def extract_pid(ps_output_line):
if not ps_output_line[0].isdigit():
return None
tokens = ps_output_line.split(None, 4)
extracted_pid = int(tokens[PS_COLUMN_PID])
time = tokens[PS_COLUMN_TIME]
command = tokens[PS_COLUMN_COMMAND]
if process_time_is_up(time) and process_is_suspect(command):
return extracted_pid
return None
def extract_pids(output):
extracted_pids = [extract_pid(line) for line in output]
return [
extracted_pid for extracted_pid in extracted_pids if extracted_pid is not None
]
def get_kill_command(pids_to_kill):
command = ["kill", "-9 "]
command.extend([str(pid_to_kill) for pid_to_kill in pids_to_kill])
return command
if __name__ == "__main__":
ps_output = subprocess.check_output(["ps", "x"])
ps_data = [line.strip() for line in ps_output.strip().split("\n")]
pids = extract_pids(ps_data)
kill_command = get_kill_command(pids)
subprocess.call(kill_command)
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Nov 24, 18:35 (4 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258673
Default Alt Text
(18 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment