Dzahn has submitted this change and it was merged.

Change subject: Program Dashboard configuration for initial labs rollout
......................................................................


Program Dashboard configuration for initial labs rollout

Defined role::programdashboard::app and programdashboard::app which
provision Rails application dependencies, Passenger setup, and the
deployment directory. This setup assumes that deployments will be
executed using Capistrano and the existing configuration within the
application repo.

A labs specific database setup will be included in a follow-up patch.

Bug: T105967
Change-Id: If6d8deed74dd6def372dee6df786c7594bddbe0c
---
A hieradata/role/common/programdashboard/app.yaml
A manifests/role/programdashboard.pp
A modules/programdashboard/manifests/app.pp
A modules/programdashboard/manifests/init.pp
A modules/programdashboard/templates/apache.conf.erb
5 files changed, 141 insertions(+), 0 deletions(-)

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



diff --git a/hieradata/role/common/programdashboard/app.yaml 
b/hieradata/role/common/programdashboard/app.yaml
new file mode 100644
index 0000000..a2a4909
--- /dev/null
+++ b/hieradata/role/common/programdashboard/app.yaml
@@ -0,0 +1,24 @@
+programdashboard::server_name: program-dashboard.wmflabs.org
+programdashboard::server_admin: [email protected]
+
+programdashboard::app::directory: /srv/programdashboard
+programdashboard::app::environment: production
+programdashboard::app::owner: programdashboard
+programdashboard::app::group: programdashboard
+programdashboard::app::dependencies:
+  - git-core
+  - ruby2.1
+  - ruby2.1-dev
+  - rubygems-integration
+  - bundler
+  - nodejs
+  - nodejs-legacy
+  - npm
+  - libmysqlclient-dev
+  - libpq-dev
+  - libqtwebkit-dev
+  - libsqlite3-dev
+  - pandoc
+  - apache2
+  - libapache2-mod-passenger
+  - ruby-passenger
diff --git a/manifests/role/programdashboard.pp 
b/manifests/role/programdashboard.pp
new file mode 100644
index 0000000..e5bc0c0
--- /dev/null
+++ b/manifests/role/programdashboard.pp
@@ -0,0 +1,12 @@
+# = Class: role::programdashboard::app
+#
+# This role sets up Program Dashboard dependencies and an Apache/Passenger
+# configuration for running the Rails application.
+#
+class role::programdashboard::app {
+    include programdashboard::app
+
+    system::role { 'role::programdashboard::app':
+        description => 'Program Dashboard application server',
+    }
+}
diff --git a/modules/programdashboard/manifests/app.pp 
b/modules/programdashboard/manifests/app.pp
new file mode 100644
index 0000000..9d7e82f
--- /dev/null
+++ b/modules/programdashboard/manifests/app.pp
@@ -0,0 +1,60 @@
+# = Class: programdashboard::app
+#
+# The Program Dashboard Rails application.
+#
+# === Parameters
+#
+# [*dependencies*]
+#   Array of packaged dependencies to be installed.
+#
+# [*directory*]
+#   Target deployment directory.
+#
+# [*environment*]
+#   Rails/Rack environment to specify when running the application.
+#
+# [*owner*]
+#   Owner of the target deployment directory.
+#
+# [*group*]
+#   Group owner of the deployment directory.
+#
+class programdashboard::app(
+    $dependencies,
+    $directory,
+    $environment,
+    $owner,
+    $group,
+) {
+    require programdashboard
+
+    include apt
+    include apache
+    include apache::mod::passenger
+
+    require_package($dependencies)
+
+    group { $group:
+        ensure => present,
+    }
+
+    user { $owner:
+        ensure => present,
+        gid    => $group,
+    }
+
+    file { $directory:
+        ensure  => directory,
+        owner   => $owner,
+        group   => $group,
+        mode    => '0750',
+    }
+
+    $server_name = $::programdashboard::server_name
+    $server_admin = $::programdashboard::server_admin
+
+    apache::site { 'program-dashboard':
+        content => template('programdashboard/apache.conf.erb'),
+        require => File[$directory],
+    }
+}
diff --git a/modules/programdashboard/manifests/init.pp 
b/modules/programdashboard/manifests/init.pp
new file mode 100644
index 0000000..f03276e
--- /dev/null
+++ b/modules/programdashboard/manifests/init.pp
@@ -0,0 +1,22 @@
+# = Class: programdashboard
+#
+# The Program Dashboard is a web application, originally written by the Wiki
+# Education Foundation, that supports Wikipedia education assignments,
+# provides data and course management features for groups of Wikipedia users
+# who are working on a common Wikipedia project. It has since be adopted by
+# WMF for use with other programs.
+#
+# === Parameters
+#
+# [*server_name*]
+#   Host name entrypoint for the dashboard.
+#
+# [*server_admin*]
+#   Email address of the application administrator.
+#
+class programdashboard(
+    $server_name,
+    $server_admin,
+) {
+
+}
diff --git a/modules/programdashboard/templates/apache.conf.erb 
b/modules/programdashboard/templates/apache.conf.erb
new file mode 100644
index 0000000..1ba9af7
--- /dev/null
+++ b/modules/programdashboard/templates/apache.conf.erb
@@ -0,0 +1,23 @@
+<VirtualHost *:80>
+  ServerName <%= @server_name %>
+  ServerAdmin <%= @server_admin %>
+
+  RackEnv <%= @environment %>
+  DocumentRoot <%= @directory %>/current/public
+
+  PassengerRuby /usr/bin/ruby2.1
+
+  <Directory <%= @directory %>/current/public>
+    Options -MultiViews
+    <IfVersion >= 2.4>
+      Require all granted
+    </IfVersion>
+    <IfVersion < 2.4>
+      Order Allow,Deny
+      Allow from all
+    </IfVersion>
+  </Directory>
+
+  ErrorLog /var/log/apache2/<%= @server_name %>.error.log
+  CustomLog /var/log/apache2/<%= @server_name %>.access.log common
+</VirtualHost>

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If6d8deed74dd6def372dee6df786c7594bddbe0c
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dduvall <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to