MaxSem has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/368101 )
Change subject: WIP: [labs] Puppetize XTools ...................................................................... WIP: [labs] Puppetize XTools Bug: T170514 Change-Id: Ia5320d52dd6934232a51ea5ad1d65288b8666b79 --- A modules/xtools/files/update-xtools A modules/xtools/manifests/code.pp A modules/xtools/manifests/init.pp A modules/xtools/manifests/packages.pp A modules/xtools/manifests/web.pp A modules/xtools/templates/xtools.conf.erb 6 files changed, 110 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/01/368101/1 diff --git a/modules/xtools/files/update-xtools b/modules/xtools/files/update-xtools new file mode 100644 index 0000000..a1d51bf --- /dev/null +++ b/modules/xtools/files/update-xtools @@ -0,0 +1,18 @@ +#!/bin/bash + +export SYMFONY_ENV=prod +cd /var/www + +## See if there's any update. +GITFETCH=$(git fetch 2>&1) +if [ -z "$GITFETCH" ]; then + exit 0 +fi + +## If there's an update, pull and install it. +git checkout master +git pull origin master +/usr/local/bin/composer install --no-dev --optimize-autoloader +./bin/console cache:clear --env prod +./bin/console doctrine:migrations:migrate --env prod --no-interaction +./bin/console assetic:dump --env prod diff --git a/modules/xtools/manifests/code.pp b/modules/xtools/manifests/code.pp new file mode 100644 index 0000000..9cca0a0 --- /dev/null +++ b/modules/xtools/manifests/code.pp @@ -0,0 +1,40 @@ +class xtools::code { + group { 'xtools': + ensure => present, + } + + user { 'xtools-update': + ensure => present, + group => 'xtools', + system => true, + require => Group['xtools'], + } + + file { '/srv/xtools': + ensure => directory, + owner => 'xtools-update', + mode => '0775', + } + + ::git::clone { 'xtools': + directory => '/srv/xtools', + owner => 'xtools-update', + origin => 'https://github.com/x-tools/xtools-rebirth.git', + require => [ User['xtools-update'], File['/srv/xtools'] ] + } + # todo: composer install. Requires user input so far + + file { '/usr/local/update-xtools': + source => 'xtools/update-xtools', + owner => 'root', + mode => '0555', + } + + cron { 'update-xtools': + ensure => present, + command => '/usr/local/update-xtools', + user => 'xtools-update', + hour => '*', + require => [ File['/usr/local/update-xtools'], Git::Clone['xtools'] ], + } +} diff --git a/modules/xtools/manifests/init.pp b/modules/xtools/manifests/init.pp new file mode 100644 index 0000000..deb54d8 --- /dev/null +++ b/modules/xtools/manifests/init.pp @@ -0,0 +1,11 @@ +class xtools( + $host = 'xtools.wmflabs.org', +) { + requires_realm('labs') + + require ::xtools::packages + require ::xtools::code + class { 'xtools::web': + host => $host, + } +} diff --git a/modules/xtools/manifests/packages.pp b/modules/xtools/manifests/packages.pp new file mode 100644 index 0000000..9def3b9 --- /dev/null +++ b/modules/xtools/manifests/packages.pp @@ -0,0 +1,7 @@ +class xtools::packages { + require_package( + 'percona-toolkit', + 'mysql-client', + 'git' + ) +} diff --git a/modules/xtools/manifests/web.pp b/modules/xtools/manifests/web.pp new file mode 100644 index 0000000..3f7e9ad --- /dev/null +++ b/modules/xtools/manifests/web.pp @@ -0,0 +1,10 @@ +class xtools::web( + $host +) { + ::apache::site { "xtools-$host": + ensure => present, + content => template('xtools/xtools.conf.erb'), + } + + require apache::mod::php7 +} diff --git a/modules/xtools/templates/xtools.conf.erb b/modules/xtools/templates/xtools.conf.erb new file mode 100644 index 0000000..afce181 --- /dev/null +++ b/modules/xtools/templates/xtools.conf.erb @@ -0,0 +1,24 @@ +<VirtualHost *:80> + DocumentRoot /srv/xtools/web + ServerName <%= @host %> + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + <Directory /srv/xtools/web/> + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + </Directory> + + Alias /awstatsclasses "/usr/share/awstats/lib/" + Alias /awstats-icon/ "/usr/share/awstats/icon/" + Alias /awstatscss "/usr/share/doc/awstats/examples/css" + ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ + ScriptAlias /awstats/ /usr/lib/cgi-bin/ + <Directory /usr/lib/cgi-bin/> + Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch + Require all granted + </Directory> + +</VirtualHost> -- To view, visit https://gerrit.wikimedia.org/r/368101 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia5320d52dd6934232a51ea5ad1d65288b8666b79 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: MaxSem <maxsem.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits