Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3920287
D1122.id2999.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
17 KB
Referenced Files
None
Subscribers
None
D1122.id2999.diff
View Options
diff --git a/UIDs b/UIDs
--- a/UIDs
+++ b/UIDs
@@ -3,3 +3,4 @@
832 chaton
9001 salt
9002 deploy
+8900 zr
diff --git a/_modules/node.py b/_modules/node.py
--- a/_modules/node.py
+++ b/_modules/node.py
@@ -80,3 +80,16 @@
'''
value = _get_property(key, nodename, False)
return bool(value)
+
+
+def has_role(role, nodename=None):
+ '''
+ A function to determine if a node has the specified role.
+
+ Returns a boolean, False if not found.
+
+ CLI Example:
+
+ salt * node.has_role devserver
+ '''
+ return role in list('roles', nodename)
diff --git a/map.jinja b/map.jinja
--- a/map.jinja
+++ b/map.jinja
@@ -132,7 +132,7 @@
'emacs': 'emacs-nox11',
'exiftool': 'p5-Image-ExifTool-devel',
'imagemagick': 'ImageMagick',
- 'mariadb': 'mariadb101-server',
+ 'mariadb': 'mariadb102-server',
'node': 'node',
'pear': 'pear',
'phpcs': 'pear-PHP_CodeSniffer',
diff --git a/pillar/nodes/nodes.sls b/pillar/nodes/nodes.sls
--- a/pillar/nodes/nodes.sls
+++ b/pillar/nodes/nodes.sls
@@ -32,6 +32,8 @@
roles:
- devserver
- saltmaster
+ zfs:
+ pool: arcology
network:
ipv4_interface: igb0
ipv4_address: 163.172.49.16
diff --git a/pillar/webserver-legacy/sites.sls b/pillar/webserver-legacy/sites.sls
--- a/pillar/webserver-legacy/sites.sls
+++ b/pillar/webserver-legacy/sites.sls
@@ -33,6 +33,7 @@
web_static_sites:
nasqueron.org:
- www
+ - assets
- docker
- ftp
- trustspace
diff --git a/roles/webserver-legacy/init.sls b/roles/dbserver-mysql/init.sls
copy from roles/webserver-legacy/init.sls
copy to roles/dbserver-mysql/init.sls
--- a/roles/webserver-legacy/init.sls
+++ b/roles/dbserver-mysql/init.sls
@@ -1,15 +1,10 @@
# -------------------------------------------------------------
-# Salt — Sites to provision on the legacy web server
-#
-# Currently, this is deployed to ysul.nasqueron.org
+# Salt — Database server — MySQL
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
+# Created: 2017-10-27
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
include:
- - .account
- - .directories
- - .static-sites
- - .be/dereckson
- - .org/nasqueron
+ - .mysql-server
diff --git a/roles/dbserver-mysql/mysql-server/cnf.sls b/roles/dbserver-mysql/mysql-server/cnf.sls
new file mode 100644
--- /dev/null
+++ b/roles/dbserver-mysql/mysql-server/cnf.sls
@@ -0,0 +1,30 @@
+# -------------------------------------------------------------
+# Salt — Database server — MySQL
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2017-10-27
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs with context %}
+
+# -------------------------------------------------------------
+# Main my.cnf
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% set use_zfs = salt['node.has']()['zfs:pool'] %}
+{% set tank = salt['pillar.get']("nodes:" + grains['id'] + ":zfs:pool", '') %}
+
+{{ dirs.etc }}/my.cnf:
+ file.managed:
+ - source: salt://roles/dbserver-mysql/mysql-server/files/my.cnf
+ - template: jinja
+ - context:
+ etc: {{ dirs.etc }}
+ use_zfs: {{ use_zfs }}
+ zfs_tank: {{ tank }}
+
+/var/run/mysqld:
+ file.directory:
+ - user: mysql
+ - dir_mode: 755
diff --git a/roles/dbserver-mysql/mysql-server/files/my.cnf b/roles/dbserver-mysql/mysql-server/files/my.cnf
new file mode 100644
--- /dev/null
+++ b/roles/dbserver-mysql/mysql-server/files/my.cnf
@@ -0,0 +1,70 @@
+# -------------------------------------------------------------
+# MySQL configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2015-04-21
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+# -------------------------------------------------------------
+# Client
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+[client]
+port = 3306
+socket = /var/run/mysqld/mysqld.sock
+
+# -------------------------------------------------------------
+# Server wrapper
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+[mysqld_safe]
+pid-file = /var/run/mysqld/mysqld.pid
+socket = /var/run/mysqld/mysqld.sock
+nice = 0
+
+# -------------------------------------------------------------
+# Generic server settings
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+[mysqld]
+user = mysql
+pid-file = /var/run/mysqld/mysqld.pid
+socket = /var/run/mysqld/mysqld.sock
+port = 3306
+basedir = /usr
+datadir = /var/lib/mysql
+tmpdir = /tmp
+lc-messages-dir = /usr/share/mysql
+explicit_defaults_for_timestamp
+
+# -------------------------------------------------------------
+# InnoDB / XtraDB configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+innodb_buffer_pool_size = 410M
+
+{% if use_zfs %}
+innodb_data_home_dir = /{{ tank }}/mysql-innodb-data
+innodb_log_group_home_dir = /{{ tank }}/mysql-innodb-logs
+
+skip-innodb_doublewrite
+{% endif %}
+
+# -------------------------------------------------------------
+# Applications configuration
+#
+# :: Phabricator
+# :: OTRS
+#
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+# Phabricator
+sql_mode = STRICT_ALL_TABLES
+max_allowed_packet = 33554432
+ft_stopword_file = {{ etc }}/mysql/stopwords.txt
+ft_min_word_len = 3
+ft_boolean_syntax = ' |-><()~*:""&^'
+
+# OTRS
+key_buffer_size = 32M
diff --git a/roles/webserver-legacy/init.sls b/roles/dbserver-mysql/mysql-server/init.sls
copy from roles/webserver-legacy/init.sls
copy to roles/dbserver-mysql/mysql-server/init.sls
--- a/roles/webserver-legacy/init.sls
+++ b/roles/dbserver-mysql/mysql-server/init.sls
@@ -1,15 +1,11 @@
# -------------------------------------------------------------
-# Salt — Sites to provision on the legacy web server
-#
-# Currently, this is deployed to ysul.nasqueron.org
+# Salt — Database server — MySQL
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
+# Created: 2017-10-27
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
include:
- - .account
- - .directories
- - .static-sites
- - .be/dereckson
- - .org/nasqueron
+ - .software
+ - .cnf
diff --git a/roles/dbserver-mysql/mysql-server/software.sls b/roles/dbserver-mysql/mysql-server/software.sls
new file mode 100644
--- /dev/null
+++ b/roles/dbserver-mysql/mysql-server/software.sls
@@ -0,0 +1,18 @@
+# -------------------------------------------------------------
+# Salt — Database server — MySQL
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2017-10-27
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import packages with context %}
+
+# -------------------------------------------------------------
+# MySQL server
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+mysql_server_software:
+ pkg.installed:
+ - pkgs:
+ - {{ packages.mariadb }}
diff --git a/roles/devserver/userland-software/files/make.conf b/roles/devserver/userland-software/files/make.conf
new file mode 100644
--- /dev/null
+++ b/roles/devserver/userland-software/files/make.conf
@@ -0,0 +1,3 @@
+DEVELOPER=yes
+
+DEFAULT_VERSIONS+= php=7.1 mysql=10.2m apache=2.4 python=3.6 python3=3.6 python2=2.7 tcl=8.6
diff --git a/roles/devserver/userland-software/init.sls b/roles/devserver/userland-software/init.sls
--- a/roles/devserver/userland-software/init.sls
+++ b/roles/devserver/userland-software/init.sls
@@ -15,3 +15,4 @@
- .dev
- .misc
- .phabricator
+ - .psysh
diff --git a/roles/devserver/userland-software/misc.sls b/roles/devserver/userland-software/misc.sls
--- a/roles/devserver/userland-software/misc.sls
+++ b/roles/devserver/userland-software/misc.sls
@@ -73,8 +73,27 @@
- portshaker
- porttools
- poudriere
+ - portsearch
+
+portsearch_database:
+ cmd.run:
+ - name: portsearch -u
+ - creates: /var/db/portsearch
+ - require:
+ - pkg: devserver_software_misc_ports
+
+/etc/make.conf:
+ file.managed:
+ - source: salt://roles/devserver/userland-software/files/make.conf
{% endif %}
+devserver_software_misc_p2p:
+ pkg:
+ - installed
+ - pkgs:
+ - transmission-daemon
+ - transmission-web
+
devserver_software_misc_gadgets:
pkg:
- installed
diff --git a/roles/devserver/userland-software/psysh.sls b/roles/devserver/userland-software/psysh.sls
new file mode 100644
--- /dev/null
+++ b/roles/devserver/userland-software/psysh.sls
@@ -0,0 +1,52 @@
+# -------------------------------------------------------------
+# Salt — Provision dev software
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2017-11-03
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs with context %}
+
+# -------------------------------------------------------------
+# Prepare for installation
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/usr/local/share/psysh:
+ file.directory:
+ - dir_mode: 755
+
+# -------------------------------------------------------------
+# Fetch software and PHP manual
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+psysh_software:
+ archive.extracted:
+ - name: /opt/psysh
+ - enforce_toplevel: False
+ - source: https://github.com/bobthecow/psysh/releases/download/v0.8.13/psysh-v0.8.13.tar.gz
+ - source_hash: 4436931f4baeac0b6709d89efe5a517dbcdfb3335e90d9bf5deb83207f90e293
+
+/usr/local/share/psysh/php_manual.sqlite:
+ file.managed:
+ - source: http://psysh.org/manual/en/php_manual.sqlite
+ - skip_verify: True
+ - require:
+ - file: /usr/local/share/psysh
+
+# -------------------------------------------------------------
+# Install binary
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+psysh_permissions:
+ file.managed:
+ - name: /opt/psysh/psysh
+ - mode: 755
+ - require:
+ - archive: psysh_software
+
+{{ dirs.bin }}/psysh:
+ file.symlink:
+ - target: /opt/psysh/psysh
+ - require:
+ - file: psysh_permissions
diff --git a/roles/shellserver/userland-software/base.sls b/roles/shellserver/userland-software/base.sls
--- a/roles/shellserver/userland-software/base.sls
+++ b/roles/shellserver/userland-software/base.sls
@@ -55,6 +55,7 @@
- toilet
- tmux
- tree
+ - unrar
- whois
- woof
{% if grains['os_family'] == 'Debian' %}
diff --git a/roles/shellserver/userland-software/files/html-directories.sh b/roles/shellserver/userland-software/files/html-directories.sh
new file mode 100755
--- /dev/null
+++ b/roles/shellserver/userland-software/files/html-directories.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Generates HTML directories listing, similar to nginx autoindex output
+#
+# Usage: html-directories [directory]
+
+DIR=$1
+[ -z "$DIR" ] && DIR="."
+TITLE="Index of $DIR"
+
+echo "<html>"
+echo "<head><title>$TITLE</title></head>"
+echo '<body bgcolor="white">'
+echo "<h1>$TITLE</h1><hr>"
+echo '<pre><a href="../">../</a>'
+find $DIR -type d -depth 1 -exec echo "<a href=\"{}\">$(basename "{}")/</a>" \;
+echo "</pre><hr></body>"
+echo "</html>"
diff --git a/roles/shellserver/userland-software/web.sls b/roles/shellserver/userland-software/web.sls
--- a/roles/shellserver/userland-software/web.sls
+++ b/roles/shellserver/userland-software/web.sls
@@ -6,7 +6,7 @@
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
-{% from "map.jinja" import packages with context %}
+{% from "map.jinja" import dirs, packages with context %}
# -------------------------------------------------------------
# nginx
@@ -34,3 +34,8 @@
pkg.installed:
- pkgs:
- igal2
+
+{{ dirs.bin }}/html-directories:
+ file.managed:
+ - source: salt://roles/shellserver/userland-software/files/html-directories.sh
+ - mode: 755
diff --git a/roles/webserver-legacy/files/dot.arcrc.json b/roles/webserver-legacy/files/dot.arcrc.json
new file mode 100644
--- /dev/null
+++ b/roles/webserver-legacy/files/dot.arcrc.json
@@ -0,0 +1,5 @@
+{
+ "config": {
+ "default": "https://devcentral.nasqueron.org/"
+ }
+}
diff --git a/roles/webserver-legacy/init.sls b/roles/webserver-legacy/init.sls
--- a/roles/webserver-legacy/init.sls
+++ b/roles/webserver-legacy/init.sls
@@ -10,6 +10,7 @@
include:
- .account
- .directories
+ - .zr
- .static-sites
- .be/dereckson
- .org/nasqueron
diff --git a/roles/webserver-legacy/zr.sls b/roles/webserver-legacy/zr.sls
new file mode 100644
--- /dev/null
+++ b/roles/webserver-legacy/zr.sls
@@ -0,0 +1,121 @@
+# -------------------------------------------------------------
+# Salt — Sites to provision on the legacy web serves
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2017-04-28
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs with context %}
+{% set zr_home = "/home/zr" %}
+
+# -------------------------------------------------------------
+# But first, we interrupt your configuration for some ASCI art.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+#
+#
+# ___ ___ ___ ___ ___
+# / /\ / /\ /__/\ /__/| / /\
+# / /::| / /:/_ | |::\ | |:| / /:/_
+# / /:/:| / /:/ /\ | |:|:\ | |:| / /:/ /\
+# / /:/|:|__ / /:/ /:/_ __|__|:|\:\ __| |:| / /:/ /:/_
+# /__/:/ |:| /\ /__/:/ /:/ /\ /__/::::| \:\ /__/\_|:|____ /__/:/ /:/ /\
+# \__\/ |:|/:/ \ \:\/:/ /:/ \ \:\~~\__\/ \ \:\/:::::/ \ \:\/:/ /:/
+# | |:/:/ \ \::/ /:/ \ \:\ \ \::/~~~~ \ \::/ /:/
+# | |::/ \ \:\/:/ \ \:\ \ \:\ \ \:\/:/
+# | |:/ \ \::/ \ \:\ \ \:\ \ \::/
+# |__|/ ___ \__\/ ___ \__\/ \__\/ ___ \__\/ ___
+# / /\ /__/\ ___ /__/\ / /\
+# / /::\ \ \:\ /__/| \ \:\ / /:/_
+# / /:/\:\ \__\:\ | |:| \ \:\ / /:/ /\
+# / /:/~/:/ ___ / /::\ | |:| _____\__\:\ / /:/ /:/_
+# /__/:/ /:/___ /__/\ /:/\:\ __|__|:| /__/::::::::\ /__/:/ /:/ /\
+# \ \:\/:::::/ \ \:\/:/__\/ /__/::::\ \ \:\~~\~~\/ \ \:\/:/ /:/
+# \ \::/~~~~ \ \::/ ~\~~\:\ \ \:\ ~~~ \ \::/ /:/
+# \ \:\ \ \:\ \ \:\ \ \:\ \ \:\/:/
+# \ \:\ \ \:\ \__\/ \ \:\ \ \::/
+# \__\/ \__\/ \__\/ \__\/
+#
+
+# -------------------------------------------------------------
+# Required software
+#
+# :: jq
+# :: arc
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+zr_required_sofware:
+ pkg.installed:
+ - pkgs:
+ - jq
+ # Devserver role provides their own Git clone of Arcanist
+ # For other servers, we need the package.
+ {% if not salt['node.has_role']('devserver') %}
+ - arcanist
+ {% endif %}
+
+# -------------------------------------------------------------
+# Account
+#
+# This account is used by Jenkins jobs to deploy artefacts
+# after a build.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+zr_account:
+ user.present:
+ - name: zr
+ - fullname: Zemke-Rhyne
+ - uid: 8900
+ - gid: 9002
+ - home: {{ zr_home }}
+
+# -------------------------------------------------------------
+# Deploy files and directory
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% for dir in ['data', 'lib'] %}
+{{ zr_home }}/{{ dir }}:
+ file.recurse:
+ - source: salt://software/zemke-rhyne/{{ dir }}
+ - include_empty: True
+ - clean: False
+ - dir_mode: 755
+ - file_mode: 644
+ - user: 8900
+ - group: 9002
+{% endfor %}
+
+{{ zr_home }}/bin:
+ file.recurse:
+ - source: salt://software/zemke-rhyne/bin
+ - dir_mode: 755
+ - file_mode: 755
+ - user: 8900
+ - group: 9002
+
+{% for file in ['README', 'Makefile', '.arcconfig', '.arclint'] %}
+{{ zr_home }}/{{ file }}:
+ file.managed:
+ - source: salt://software/zemke-rhyne/{{ file }}
+ - mode: 644
+ - user: 8900
+ - group: 9002
+{% endfor %}
+
+{{ zr_home }}/.arcrc:
+ file.managed:
+ - source: salt://roles/webserver-legacy/files/dot.arcrc.json
+ - replace: False
+ - mode: 600
+ - user: 8900
+ - group: 9002
+
+zr_make:
+ cmd.run:
+ - name: make
+ - runas: zr
+ - cwd: {{ zr_home }}
+ - creates: {{ zr_home }}/.ssh/authorized_keys
+ - require:
+ - user: zr_account
+ - file: {{ zr_home }}/Makefile
diff --git a/top.sls b/top.sls
--- a/top.sls
+++ b/top.sls
@@ -19,6 +19,7 @@
- roles/saltmaster
'ysul':
- roles/paas-jails
+ - roles/dbserver-mysql
- roles/webserver-core
- roles/webserver-legacy
- roles/webserver-varnish
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 14:14 (18 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2309557
Default Alt Text
D1122.id2999.diff (17 KB)
Attached To
Mode
D1122: Provision MySQL
Attached
Detach File
Event Timeline
Log In to Comment