Skip to content

Commit 1451c63

Browse files
authored
Merge pull request #172 from devinmatte/openshift
Moving Schedulemaker to Openshift
2 parents 35134a5 + ed68a49 commit 1451c63

File tree

11 files changed

+155
-14
lines changed

11 files changed

+155
-14
lines changed

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM php:7.1-apache
2+
MAINTAINER Devin Matte <[email protected]>
3+
4+
ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf
5+
6+
RUN a2enmod rewrite && a2enmod headers && a2enmod expires && \
7+
sed -i '/Listen/{s/\([0-9]\+\)/8080/; :a;n; ba}' /etc/apache2/ports.conf && \
8+
chmod og+rwx /var/lock/apache2 && chmod -R og+rwx /var/run/apache2
9+
10+
RUN apt-get -yq update && \
11+
apt-get -yq install gnupg libmagickwand-dev --no-install-recommends && \
12+
apt-get -yq clean all
13+
14+
RUN docker-php-ext-install mysqli && \
15+
pecl install imagick && docker-php-ext-enable imagick
16+
17+
COPY . /var/www/html
18+
19+
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
20+
apt-get -yq update && \
21+
apt-get -yq install nodejs && \
22+
npm install && \
23+
npm run-script build && \
24+
rm -rf node_modules && \
25+
apt-get -yq remove nodejs && \
26+
apt-get -yq clean all
27+
28+
EXPOSE 8080
29+
EXPOSE 8443

apache-config.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<VirtualHost *:8080>
2+
ServerAdmin [email protected]
3+
DocumentRoot /var/www/html
4+
5+
<Directory /var/www/html/>
6+
Options Indexes FollowSymLinks MultiViews
7+
AllowOverride All
8+
Order deny,allow
9+
Allow from all
10+
</Directory>
11+
12+
ErrorLog ${APACHE_LOG_DIR}/error.log
13+
CustomLog ${APACHE_LOG_DIR}/access.log combined
14+
15+
</VirtualHost>

api/entity.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
////////////////////////////////////////////////////////////////////////////
1111

1212
// REQUIRED FILES //////////////////////////////////////////////////////////
13-
require_once "../inc/config.php";
13+
if (file_exists('../inc/config.php')) {
14+
require_once "../inc/config.php";
15+
} else {
16+
require_once "../inc/config.env.php";
17+
}
1418
require_once "../inc/databaseConn.php";
1519
require_once "../inc/timeFunctions.php";
1620
require_once "../inc/ajaxError.php";

api/generate.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
////////////////////////////////////////////////////////////////////////////
1111

1212
// REQUIRED FILES
13-
require_once "../inc/config.php";
13+
if (file_exists('../inc/config.php')) {
14+
require_once "../inc/config.php";
15+
} else {
16+
require_once "../inc/config.env.php";
17+
}
1418
require_once "../inc/databaseConn.php";
1519
require_once "../inc/timeFunctions.php";
1620
require_once "../inc/ajaxError.php";

api/schedule.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
////////////////////////////////////////////////////////////////////////////
1010

1111
// REQUIRED FILES //////////////////////////////////////////////////////////
12-
require_once('../inc/config.php');
12+
if (file_exists('../inc/config.php')) {
13+
require_once "../inc/config.php";
14+
} else {
15+
require_once "../inc/config.env.php";
16+
}
1317
require_once('../inc/databaseConn.php');
1418
require_once('../inc/timeFunctions.php');
1519

api/search.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ function assertNumeric($var, $name) {
2525
}
2626

2727
// REQUIRED FILES //////////////////////////////////////////////////////////
28-
require_once "../inc/config.php";
28+
if (file_exists('../inc/config.php')) {
29+
require_once "../inc/config.php";
30+
} else {
31+
require_once "../inc/config.env.php";
32+
}
2933
require_once "../inc/databaseConn.php";
3034
require_once "../inc/timeFunctions.php";
3135
require_once "../inc/ajaxError.php";

assets/src/modules/sm/Schedule/directives/scheduleActionsDirective.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,4 @@ angular.module('sm').directive('scheduleActions', function($http, $q, shareServi
169169
pre: scheduleActions
170170
}
171171
};
172-
});
172+
});

img/schedules/readme.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

inc/config.env.php

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
3+
$get_env = function (&$var, $default = null) {
4+
return !empty($var) ? $var : $default;
5+
};
6+
7+
////////////////////////////////////////////////////////////////////////////
8+
// DATABASE CONFIG
9+
10+
$COOKIE_STORE = $get_env(getenv("COOKIE_STORE"), '/tmp/siscookies.txt');
11+
$DATABASE_SERVER = $get_env(getenv("DATABASE_SERVER"), 'mysql.csh.rit.edu');
12+
$DATABASE_USER = $get_env(getenv("DATABASE_USER"), '');
13+
$DATABASE_PASS = $get_env(getenv("DATABASE_PASS"), '');
14+
$DATABASE_DB = $get_env(getenv("DATABASE_DB"), '');
15+
$DUMPCLASSES = $get_env(getenv("DUMPCLASSES"), '/mnt/share/cshclass.dat');
16+
$DUMPCLASSATTR = $get_env(getenv("DUMPCLASSATTR"), '/mnt/share/cshattrib.dat');
17+
$DUMPINSTRUCT = $get_env(getenv("DUMPINSTRUCT"), '/mnt/share/cshinstr.dat');
18+
$DUMPMEETING = $get_env(getenv("DUMPMEETING"), '/mnt/share/cshmtgpat.dat');
19+
$DUMPNOTES = $get_env(getenv("DUMPNOTES"), '/mnt/share/cshnotes.dat');
20+
21+
$HTTPROOTADDRESS = $get_env(getenv("HTTPROOTADDRESS"), 'http://schedule.csh.rit.edu/');
22+
$SERVER_TYPE = $get_env(getenv("SERVER_TYPE"), 'development');
23+
24+
////////////////////////////////////////////////////////////////////////////
25+
//// APP VERSIONS
26+
$APP_CONFIG = json_decode(file_get_contents((empty($APP_ROOT)?"../":$APP_ROOT)."package.json"), true);
27+
$APP_VERSION = $APP_CONFIG['version'];
28+
$JSSTATE_VERSION = $APP_CONFIG['config']['stateVersion'];
29+
30+
31+
////////////////////////////////////////////////////////////////////////////
32+
////// GOOGLE ANALYTICS
33+
////
34+
$GOOGLEANALYTICS = ($SERVER_TYPE == 'production')?
35+
$get_env(getenv("GOOGLEANALYTICS1"), ''):
36+
$get_env(getenv("GOOGLEANALYTICS2"), '');
37+
//
38+
39+
////////////////////////////////////////////////////////////////////////////
40+
// WORK AROUNDS
41+
if (get_magic_quotes_gpc()) {
42+
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
43+
while (list($key, $val) = each($process)) {
44+
foreach ($val as $k => $v) {
45+
unset($process[$key][$k]);
46+
if (is_array($v)) {
47+
$process[$key][stripslashes($k)] = $v;
48+
$process[] = &$process[$key][stripslashes($k)];
49+
} else {
50+
$process[$key][stripslashes($k)] = stripslashes($v);
51+
}
52+
}
53+
}
54+
unset($process);
55+
}
56+
////////////////////////////////////////////////////////////////////////////
57+
// CALCULATIONS
58+
59+
// Calculate the current quarter
60+
switch(date('n')) {
61+
case 2:
62+
case 3:
63+
$CURRENT_QUARTER = date("Y")-1 . '3'; // Point them to the spring
64+
break;
65+
case 4:
66+
case 5:
67+
case 6:
68+
case 7:
69+
case 8:
70+
case 9:
71+
$CURRENT_QUARTER = date("Y") . '1'; // Point them to the fall
72+
break;
73+
case 10:
74+
case 11:
75+
case 12:
76+
case 1:
77+
$CURRENT_QUARTER = date("Y") . '2'; // Point them to the summer
78+
break;
79+
}
80+

inc/databaseConn.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
////////////////////////////////////////////////////////////////////////////
1010

1111
// Bring in the config data
12-
require_once dirname(__FILE__) . "/config.php";
12+
if (file_exists(dirname(__FILE__) . "/config.php")) {
13+
require_once dirname(__FILE__) . "/config.php";
14+
} else {
15+
require_once dirname(__FILE__) . "/config.env.php";
16+
}
1317

1418

1519
// There is no better place to put this, as all pages require this file.

0 commit comments

Comments
 (0)