Giuseppe Lavagetto has submitted this change and it was merged.

Change subject: Parsoid: clean up the manifests and files
......................................................................


Parsoid: clean up the manifests and files

There are a lot of unused Parsoid roles and files after the transition
to service::node. This patch cleans them up.

Note that the transition_cleanup role is being removed too, since the
transition is complete and the role has been applied to all of the wtp*
hosts.

Bug: T90668
Bug: T86633
Change-Id: I7b3c4167d6e447e40b931c69b14eea9b1a80bbe6
---
M manifests/site.pp
M modules/beta/files/shinken.cfg
D modules/parsoid/files/parsoid
D modules/parsoid/files/parsoid.upstart
D modules/parsoid/files/parsoid_testing.systemd.service
D modules/parsoid/templates/parsoid.default.erb
D modules/parsoid/templates/parsoid.logrotate.erb
D modules/role/manifests/parsoid/beta.pp
D modules/role/manifests/parsoid/common.pp
D modules/role/manifests/parsoid/production.pp
D modules/role/manifests/parsoid/transition_cleanup.pp
11 files changed, 1 insertion(+), 395 deletions(-)

Approvals:
  Giuseppe Lavagetto: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/manifests/site.pp b/manifests/site.pp
index dbdc7ae..94175d2 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -2920,13 +2920,11 @@
 node /^wtp10(0[1-9]|1[0-9]|2[0-4])\.eqiad\.wmnet$/ {
     role parsoid
     include standard
-    include role::parsoid::transition_cleanup
 }
 
 node /^wtp20(0[1-9]|1[0-9]|2[0-4])\.codfw\.wmnet$/ {
     role parsoid
     include standard
-    include role::parsoid::transition_cleanup
 }
 
 # T138650 - tools for the security team
diff --git a/modules/beta/files/shinken.cfg b/modules/beta/files/shinken.cfg
index f95537b..8a060c5 100644
--- a/modules/beta/files/shinken.cfg
+++ b/modules/beta/files/shinken.cfg
@@ -29,7 +29,7 @@
 
 define service {
     service_description         Parsoid
-    hostgroup_name              role::parsoid::beta
+    hostgroup_name              role::parsoid
     use                         generic-service
     check_command               check_http_on_port!8000
 }
diff --git a/modules/parsoid/files/parsoid b/modules/parsoid/files/parsoid
deleted file mode 100644
index 0e0b2e3..0000000
--- a/modules/parsoid/files/parsoid
+++ /dev/null
@@ -1,18 +0,0 @@
-#! /bin/bash
-
-#####################################################################
-### THIS FILE IS MANAGED BY PUPPET
-### puppet:///files/misc/parsoid
-#####################################################################
-
-# Script to start Parsoid
-
-(
-       cd /var/lib/parsoid/Parsoid/js/lib
-       export NODE_PATH=/var/lib/parsoid/Parsoid/js/lib/node_modules
-       sudo -E -u parsoid nohup node /var/lib/parsoid/Parsoid/js/api/server.js 
> /var/lib/parsoid/nohup.out 2>&1 &
-       PARSOIDPID=$!
-       echo $PARSOIDPID > /var/run/parsoid.pid
-       wait $PARSOIDPID
-       rm /var/run/parsoid.pid
-) &
diff --git a/modules/parsoid/files/parsoid.upstart 
b/modules/parsoid/files/parsoid.upstart
deleted file mode 100644
index 24f1bca..0000000
--- a/modules/parsoid/files/parsoid.upstart
+++ /dev/null
@@ -1,41 +0,0 @@
-# vim: set ft=upstart:
-
-#####################################################################
-### THIS FILE IS MANAGED BY PUPPET
-### puppet:///files/misc/parsoid.upstart
-#####################################################################
-
-description "Parsoid HTTP service"
-
-start on (local-filesystem and net-device-up IFACE!=lo)
-stop on runlevel [!2345]
-
-# up ulimit -n a bit
-limit nofile 10000 10000
-
-setuid "parsoid"
-setgid "parsoid"
-
-env DEFAULTFILE=/etc/default/parsoid
-
-# Basic built-in defaults. Overridden by whatever
-# is defined in the DEFAULTFILE defined above.
-env VCAP_APP_PORT="8000"
-env NODE_PATH="/var/lib/parsoid/deploy/node_modules"
-env PARSOID_BASE_PATH="/var/lib/parsoid/deploy/src"
-env PARSOID_LOG_FILE="/dev/null"
-env PARSOID_SETTINGS_FILE="../conf/wmf/localsettings.js"
-
-respawn
-
-# wait 60 seconds for a graceful restart before killing the master
-kill timeout 60
-
-script
-    if [ -f "$DEFAULTFILE" ] ; then
-        . "$DEFAULTFILE"
-    fi
-    DAEMON_ARGS="-c $PARSOID_SETTINGS_FILE"
-    chdir "$PARSOID_BASE_PATH"
-    exec /usr/bin/nodejs bin/server.js $DAEMON_ARGS < /dev/null >> 
"$PARSOID_LOG_FILE" 2>&1
-end script
diff --git a/modules/parsoid/files/parsoid_testing.systemd.service 
b/modules/parsoid/files/parsoid_testing.systemd.service
deleted file mode 100644
index a53c613..0000000
--- a/modules/parsoid/files/parsoid_testing.systemd.service
+++ /dev/null
@@ -1,18 +0,0 @@
-[Unit]
-Description=Parsoid service used by the parsoid::testing role
-After=network.target
-
-[Service]
-User=parsoid
-Group=parsoid
-LimitNOFILE=10000
-
-# Start up 8 workers bound to port 8142
-# This parsoid instance is going to be used by testreduce clients
-Environment=PORT=8142 NODE_PATH=/srv/parsoid/node_modules
-WorkingDirectory=/srv/parsoid/src
-ExecStart=/usr/bin/nodejs bin/server.js -n 8 -c 
/srv/parsoid/src/localsettings.js
-StandardInput=null
-StandardOutput=journal
-StandardError=journal
-RestartSec=2
diff --git a/modules/parsoid/templates/parsoid.default.erb 
b/modules/parsoid/templates/parsoid.default.erb
deleted file mode 100644
index fc62a45..0000000
--- a/modules/parsoid/templates/parsoid.default.erb
+++ /dev/null
@@ -1,31 +0,0 @@
-#####################################################################
-### THIS FILE IS MANAGED BY PUPPET
-### puppet:///templates/misc/parsoid.default
-#####################################################################
-
-# File where the parsoid daemon will write stdin and stdout to
-PARSOID_LOG_FILE=<%= @parsoid_log_file %>
-
-# Checkout of mediawiki/services/parsoid
-<% if @parsoid_base_path then %>
-PARSOID_BASE_PATH=<%= @parsoid_base_path %>
-<% else %>
-# Override in puppet using parsoid_base_path
-#PARSOID_BASE_PATH
-<% end %>
-
-# Checkout of mediawiki/services/parsoid/deploy
-<% if @parsoid_node_path then %>
-NODE_PATH=<%= @parsoid_node_path %>
-<% else %>
-# Override in puppet using parsoid_node_path
-#NODE_PATH=
-<% end %>
-
-# Checkout of mediawiki/services/parsoid/deploy
-<% if @parsoid_settings_file then %>
-PARSOID_SETTINGS_FILE=<%= @parsoid_settings_file %>
-<% else %>
-# Override in puppet using parsoid_settings_file
-#PARSOID_SETTINGS_FILE=/etc/parsoid/settings.js
-<% end %>
diff --git a/modules/parsoid/templates/parsoid.logrotate.erb 
b/modules/parsoid/templates/parsoid.logrotate.erb
deleted file mode 100644
index c8238a6..0000000
--- a/modules/parsoid/templates/parsoid.logrotate.erb
+++ /dev/null
@@ -1,15 +0,0 @@
-#####################################################################
-### THIS FILE IS MANAGED BY PUPPET
-### puppet:///files/logrotate/parsoid
-#####################################################################
-
-<%= @parsoid_log_file %> {
-    daily
-    copytruncate
-    missingok
-    compress
-    notifempty
-    rotate 15
-    size 256M
-    su parsoid parsoid
-}
diff --git a/modules/role/manifests/parsoid/beta.pp 
b/modules/role/manifests/parsoid/beta.pp
deleted file mode 100644
index 8209e59..0000000
--- a/modules/role/manifests/parsoid/beta.pp
+++ /dev/null
@@ -1,111 +0,0 @@
-class role::parsoid::beta {
-    system::role { 'role::parsoid::beta':
-        description => 'Parsoid server (on beta)'
-    }
-
-    include role::parsoid::common
-
-    sudo::user { 'jenkins-deploy': privileges => [
-        # Need to allow jenkins-deploy to reload parsoid
-        # Since the "root" user is local, we cant add the sudo policy in
-        # OpenStack manager interface at wikitech
-        # TODO: adjust for upstart!
-        'ALL = (root) NOPASSWD:/etc/init.d/parsoid',
-    ] }
-
-    file { '/var/lib/parsoid/Parsoid':
-        ensure => link,
-        target => '/srv/mediawiki/php-master/extensions/Parsoid',
-        owner  => parsoid,
-        group  => wikidev,
-        mode   => '2775',
-    }
-
-    # Jenkins copy repositories and config under /srv/deployment
-    file { '/srv/deployment':
-        ensure => directory,
-        owner  => root,
-        group  => root,
-        mode   => '0755',
-    }
-    file { '/srv/deployment/parsoid':
-        ensure => directory,
-        owner  => jenkins-deploy,
-        group  => wikidev,
-        mode   => '0755',
-    }
-
-    # Delete the puppet copy of this file
-    file { '/srv/deployment/parsoid/localsettings.js':
-        ensure => absent,
-    }
-
-    # beta uses upstart:
-    # FIXME: move users to upstart
-    file { '/etc/init.d/parsoid':
-        ensure => 'link',
-        target => '/lib/init/upstart-job',
-    }
-    file { '/etc/init/parsoid.conf':
-        ensure => present,
-        owner  => root,
-        group  => root,
-        mode   => '0444',
-        source => 'puppet:///modules/parsoid/parsoid.upstart',
-    }
-
-    $parsoid_log_file = '/var/log/parsoid/parsoid.log'
-    # Make sure the directory exists on beta
-    file { '/var/log/parsoid':
-        ensure => directory,
-        owner  => parsoid,
-        group  => parsoid,
-        mode   => '0775',
-    }
-
-    # For beta, override NODE_PATH
-    # The packages are installed by Jenkins via npm install using pinned
-    # versions in npm-shrinkwrap.json
-    $parsoid_node_path = '/srv/deployment/parsoid/parsoid/node_modules'
-
-    # Override PARSOID_SETTINGS_FILE
-    # The setting file is in parsoid/deploy.git
-    $parsoid_settings_file = 
'/srv/deployment/parsoid/deploy/conf/wmf/betalabs.localsettings.js'
-
-    # Checkout of mediawiki/services/parsoid
-    $parsoid_base_path = '/srv/deployment/parsoid/parsoid'
-
-    file { '/etc/default/parsoid':
-        ensure  => present,
-        owner   => root,
-        group   => root,
-        mode    => '0444',
-        content => template('parsoid/parsoid.default.erb'),
-        require => File['/var/log/parsoid'],
-    }
-
-    file { '/etc/logrotate.d/parsoid':
-        ensure  => present,
-        owner   => root,
-        group   => root,
-        mode    => '0444',
-        content => template('parsoid/parsoid.logrotate.erb'),
-    }
-
-    service { 'parsoid':
-        ensure     => running,
-        hasstatus  => true,
-        hasrestart => true,
-        provider   => 'upstart',
-        subscribe  => [
-            File['/etc/default/parsoid'],
-            File['/etc/init/parsoid.conf'],
-        ],
-    }
-
-    # Instance got to be a Jenkins slave so we can update Parsoid whenever a
-    # change is made on mediawiki/services/parsoid repository
-    include role::ci::slave::labs::common
-    # Also need the slave scripts for multi-git.sh
-    include contint::slave_scripts
-}
diff --git a/modules/role/manifests/parsoid/common.pp 
b/modules/role/manifests/parsoid/common.pp
deleted file mode 100644
index 591a7d0..0000000
--- a/modules/role/manifests/parsoid/common.pp
+++ /dev/null
@@ -1,30 +0,0 @@
-# vim: set ts=4 et sw=4:
-class role::parsoid::common {
-    package { [
-        'nodejs',
-        'npm',
-        'build-essential',
-        ]: ensure => present,
-    }
-
-    file { '/var/lib/parsoid':
-        ensure => directory,
-        owner  => parsoid,
-        group  => wikidev,
-        mode   => '2775',
-    }
-
-    file { '/usr/bin/parsoid':
-        ensure => present,
-        owner  => root,
-        group  => root,
-        mode   => '0555',
-        source => 'puppet:///modules/parsoid/parsoid',
-    }
-
-    ferm::service { 'parsoid':
-        proto => 'tcp',
-        port  => '8000',
-    }
-}
-
diff --git a/modules/role/manifests/parsoid/production.pp 
b/modules/role/manifests/parsoid/production.pp
deleted file mode 100644
index 4ac954b..0000000
--- a/modules/role/manifests/parsoid/production.pp
+++ /dev/null
@@ -1,110 +0,0 @@
-class role::parsoid::production {
-    system::role { 'role::parsoid::production':
-        description => 'Parsoid server'
-    }
-
-    include role::parsoid::common
-    include standard
-    include lvs::realserver
-    include base::firewall
-
-    package { 'parsoid/deploy':
-        provider => 'trebuchet',
-    }
-
-    group { 'parsoid':
-        ensure => present,
-        name   => 'parsoid',
-        system => true,
-    }
-
-    user { 'parsoid':
-        gid        => 'parsoid',
-        home       => '/var/lib/parsoid',
-        managehome => true,
-        system     => true,
-    }
-
-    file { '/var/lib/parsoid/deploy':
-        ensure => link,
-        target => '/srv/deployment/parsoid/deploy',
-    }
-
-    file { '/etc/init/parsoid.conf':
-        ensure => present,
-        owner  => root,
-        group  => root,
-        mode   => '0444',
-        source => 'puppet:///modules/parsoid/parsoid.upstart',
-    }
-
-    file { '/var/log/parsoid':
-        ensure => directory,
-        owner  => parsoid,
-        group  => parsoid,
-        mode   => '0775',
-    }
-
-    $parsoid_log_file = '/var/log/parsoid/parsoid.log'
-    #TODO: Should we explicitly set this to 
'/srv/deployment/parsoid/deploy/node_modules'
-    #just like beta labs
-    $parsoid_node_path = '/var/lib/parsoid/deploy/node_modules'
-    $parsoid_settings_file = 
'/srv/deployment/parsoid/deploy/conf/wmf/localsettings.js'
-    $parsoid_base_path = '/var/lib/parsoid/deploy/src'
-
-    #TODO: Duplication of code from beta class, deduplicate somehow
-    file { '/etc/default/parsoid':
-        ensure  => present,
-        owner   => root,
-        group   => root,
-        mode    => '0444',
-        content => template('parsoid/parsoid.default.erb'),
-        require => File['/var/log/parsoid'],
-    }
-
-    file { '/etc/logrotate.d/parsoid':
-        ensure  => present,
-        owner   => root,
-        group   => root,
-        mode    => '0444',
-        content => template('parsoid/parsoid.logrotate.erb'),
-    }
-
-    cron { 'parsoid-hourly-logrot':
-        ensure  => present,
-        command => '/usr/sbin/logrotate /etc/logrotate.d/parsoid',
-        user    => 'root',
-        hour    => '*',
-        minute  => '12',
-        require => File['/etc/logrotate.d/parsoid'],
-    }
-
-    service { 'parsoid':
-        ensure     => running,
-        hasstatus  => true,
-        hasrestart => true,
-        provider   => 'upstart',
-        subscribe  => [
-            File['/etc/default/parsoid'],
-            File['/etc/init/parsoid.conf'],
-        ],
-        require    => Package['parsoid/deploy'],
-    }
-
-    monitoring::service { 'parsoid':
-        description   => 'Parsoid',
-        check_command => 'check_http_on_port!8000',
-    }
-    # until logging is handled differently, rt 6851
-    nrpe::monitor_service { 'parsoid_disk_space':
-        description  => 'parsoid disk space',
-        nrpe_command => '/usr/lib/nagios/plugins/check_disk -w 40% -c 3% -l 
-e',
-        critical     => true,
-    }
-
-    # Monitor TCP Connection States
-    diamond::collector { 'TcpConnStates':
-        source => 'puppet:///modules/diamond/collector/tcpconnstates.py',
-    }
-}
-
diff --git a/modules/role/manifests/parsoid/transition_cleanup.pp 
b/modules/role/manifests/parsoid/transition_cleanup.pp
deleted file mode 100644
index e99e440..0000000
--- a/modules/role/manifests/parsoid/transition_cleanup.pp
+++ /dev/null
@@ -1,18 +0,0 @@
-# Housekeeping class used to clean up after the transition
-# role::parsoid::production => role::parsoid
-class role::parsoid::transition_cleanup {
-    file { ['/usr/bin/parsoid', '/etc/default/parsoid']:
-        ensure => absent,
-    }
-
-    cron { 'parsoid-hourly-logrot':
-        ensure => absent,
-    }
-
-    system::role{ 'role::parsoid::production':
-        ensure => absent,
-    }
-
-    # Warning: /var/lib/parsoid will need to be cleaned by hand
-    # Warning: /var/log/parsoid too, once logs are not relevant anymore.
-}

-- 
To view, visit https://gerrit.wikimedia.org/r/300067
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7b3c4167d6e447e40b931c69b14eea9b1a80bbe6
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mobrovac <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Mobrovac <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to