Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into master
  • Loading branch information
jbabb committed Apr 19, 2019
2 parents b762dba + 72136cc commit c7afa84
Showing 259 changed files with 22,691 additions and 181 deletions.
8 changes: 8 additions & 0 deletions Sources/HR/README
@@ -0,0 +1,8 @@
# A preconfigured Sentrifugo container set
#
# After building with docker-compose up
# Sentrifugo should be available at localhost:8080
# You can login with banderson/password or
# empp0001/59887e9a7cb85 to be a super
# user in Sentrifugo

30 changes: 30 additions & 0 deletions Sources/HR/docker-compose.yml
@@ -0,0 +1,30 @@
version: "3.3"

services:
sentrifugo_server:
build: ./sentrifugo_server/
container_name: sentrifugo_server
networks:
- net
depends_on:
- sentrifugo_data
ports:
- "8080:80"
devices:
- "/dev/tty:/dev/tty"
links:
- "sentrifugo_data:sentrifugo_data"

sentrifugo_data:
build: ./sentrifugo_data/
container_name: sentrifugo_data
networks:
- net
volumes:
- sentrifugo_data:/var/lib/mysql
networks:
net:
driver: bridge

volumes:
sentrifugo_data:
14 changes: 14 additions & 0 deletions Sources/HR/sentrifugo_data/Dockerfile
@@ -0,0 +1,14 @@
from mariadb:latest
RUN apt-get update
RUN apt-get install wget gcc libmysql++-dev librabbitmq-dev pkg-config libbsd-dev -y
#ENV MYSQL_RANDOM_ROOT_PASSWORD=true
ENV MYSQL_ROOT_PASSWORD=54y6RxN7GfC7aes3
ENV MYSQL_DATABASE=sentrifugo
ENV MYSQL_USER=sentrifugo
ENV MYSQL_PASSWORD=54y6RxN7GfC7aes3
WORKDIR /tmp
RUN wget https://github.com/ssimicro/lib_mysqludf_amqp/releases/download/v2.0.0/lib_mysqludf_amqp-2.0.0.tar.gz
RUN tar zxf lib_mysqludf_amqp-2.0.0.tar.gz
WORKDIR /tmp/lib_mysqludf_amqp-2.0.0
RUN ./configure && make && make install #mysql -u root --password=54y6RxN7GfC7aes3 < installdb.sql
EXPOSE 3306
41 changes: 41 additions & 0 deletions Sources/HR/sentrifugo_server/000-default.conf
@@ -0,0 +1,41 @@
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost

DocumentRoot "/var/www/html/sentrifugo"
DirectoryIndex index.php index.html
# php_value include_path "/var/www/html/include"
<Directory "/var/www/html/sentrifugo">
Options All +MultiViews -ExecCGI -Indexes
<IfModule mod_dav.c>
DAV Off
</IfModule>
AllowOverride All
</Directory>
LogLevel warn
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
79 changes: 79 additions & 0 deletions Sources/HR/sentrifugo_server/Dockerfile
@@ -0,0 +1,79 @@
FROM ubuntu:16.04
MAINTAINER Sreekanth G S <mail@sreekanth.in>
#ENV http_proxy=http://sysfp0t.its.unc.edu:80
#ENV https_proxy=http://sysfp0t.its.unc.edu:80
#RUN DEBIAN_FRONTEND=noninteractive \
# apt-get -o Acquire::http::Proxy="http://sysfp0t.its.unc.edu:80" update && \
# apt-get -o Acquire::http::Proxy="http://sysfp0t.its.unc.edu:80" install -y language-pack-en-base &&\
# export LC_ALL=en_US.UTF-8 && \
#` export LANG=en_US.UTF-8


RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y software-properties-common
#RUN cat /etc/locale.gen
#RUN cat /etc/environment
#RUN LANG=en_US.UTF-8 locale-gen --purge en_US.UTF-8 && echo -e 'LANG="en_US.UTF-8"\nLANGUAGE="en_US:en"\n' > /etc/default/locale && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && echo "LC_ALL=en_US.UTF-8" > /etc/environment && echo "LANG=en_US.UTF-8" >> /etc/environment && locale-gen "en_US.UTF-8" && export LC_ALL=en_US.UTF-8 && export LANG=en_US.UTF-8 && add-apt-repository ppa:ondrej/php

#RUN apt-get -o Acquire::http::Proxy="http://sysfp0t.its.unc.edu:80" update && apt-get -o Acquire::http::Proxy="http://sysfp0t.its.unc.edu:80" install -y software-properties-common language-pack-en-base && \
#LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php && apt-get -o Acquire::http::Proxy="http://sysfp0t.its.unc.edu:80" update && apt-get -o Acquire::http::Proxy="http://sysfp0t.its.unc.edu:80" install -y \
RUN echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu xenial main" >> /etc/apt/sources.list && echo "deb-src http://ppa.launchpad.net/ondrej/php/ubuntu xenial main" >> /etc/apt/sourceis.list && apt-get update --allow-unauthenticated
RUN cat /etc/apt/sources.list && ls -l /etc/apt/
RUN apt-get install -y --allow-unauthenticated apache2-bin libapache2-mod-php php-curl php-ldap php-mysql php-mcrypt \
php-gd php-xml patch curl vim git mysql-client wget unzip lynx

RUN phpenmod mcrypt && phpenmod gd
RUN a2enmod xml2enc && a2enmod rewrite

RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.2/cli/php.ini

RUN useradd --uid 1000 --gid 50 docker

RUN echo export APACHE_RUN_USER=docker >> /etc/apache2/envvars
RUN echo export APACHE_RUN_GROUP=staff >> /etc/apache2/envvars

COPY 000-default.conf /etc/apache2/sites-enabled/000-default.conf

RUN chown -R docker /var/www/html

WORKDIR /var/www/html

RUN wget -q "http://www.sentrifugo.com/home/downloadfile?file_name=Sentrifugo.zip" -O Sentrifugo.zip
#COPY Sentrifugo.zip /var/www/html/
RUN unzip Sentrifugo.zip && mv Sentrifugo_3.2 sentrifugo

WORKDIR /var/www/html/sentrifugo
RUN chown -R docker .

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

RUN chmod 777 -R public/downloads public/uploads public/email_constants.php \
public/emptabconfigure.php \
public/site_constants.php \
public/db_constants.php \
public/application_constants.php \
public/mail_settings_constants.php \
logs/application.log \
application/modules/default/plugins/AccessControl.php \
install


VOLUME /var/www/html/sentrifugo/public/uploads

VOLUME /var/www/html/sentrifugo/public/downloads
#VOLUME /var/www/html/sentrifugo
#RUN apachectl start && sleep 2 && curl -d "host=mariadb&username=sentrifugo&password=54y6RxN7GfC7aes3&dbname=sentrifugo" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost:80/install/step2.php && curl -data-raw "app_name=sentrifugo" -data-raw "email=sentrifugo.container@gmail.com" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost:80/install/step3.php
#RUN apachectl stop
COPY application_constants.php /var/www/html/sentrifugo/public
COPY mail_settings_constants.php /var/www/html/sentrifugo/public
COPY step3.sql /tmp
COPY step4.sql /tmp
COPY step5.sql /tmp
COPY trigger.sql /tmp
COPY banderson.sql /tmp

ENTRYPOINT ["/entrypoint.sh"]

EXPOSE 80
23 changes: 23 additions & 0 deletions Sources/HR/sentrifugo_server/README
@@ -0,0 +1,23 @@
# Sentrifugo and Mariadb Docker Containers

This is a set of docker files to create
an instance of sentrifugo for testing
along with a mariadb to support it

You can build and run the needed containers via

docker-compose up -d

If this successful you should be albe to
walk though the configuration wizard via

http://localhost:8080

Substituting your docker host for localhost as required

When the wizard asks for database configuraton, use
mariadb for the hostname, sentrifugo for both the
database name and username, and 54y6RxN7GfC7aes3 for
the password. Username, database name, and password can
be changed to your own values by editing Dockerfile-sentrifugo
before running docker-compose
4 changes: 4 additions & 0 deletions Sources/HR/sentrifugo_server/application_constants.php
@@ -0,0 +1,4 @@
<?php
defined('SUPERADMIN_EMAIL') || define('SUPERADMIN_EMAIL','sentrifugo.container@gmail.com');
defined('APPLICATION_NAME') || define('APPLICATION_NAME','Sentrifugo');
?>
1 change: 1 addition & 0 deletions Sources/HR/sentrifugo_server/banderson.sql
@@ -0,0 +1 @@
insert into main_users (id,emprole,userstatus,firstname,lastname,userfullname,emailaddress,backgroundchk_status,emppassword,isactive,employeeId) values (2,1,'old','Brian','Anderson','Brian Anderson','sentrifugo.container@gmail.com','Not Applicable','5f4dcc3b5aa765d61d8327deb882cf99',1,'banderson');
10 changes: 10 additions & 0 deletions Sources/HR/sentrifugo_server/email.sql
@@ -0,0 +1,10 @@
root@a6cf7d197dd3:/var/www/html/sentrifugo/install.old# grep -i update step3.php
$query = "update main_users set emailaddress = '".$email."' where id = ".SUPERADMIN." and emprole = ".SUPERADMINROLE;
root@a6cf7d197dd3:/var/www/html/sentrifugo/install.old# grep -i insert step4.php
insert_into_db($tls,$smtpserver,$username,$password,$port,$auth);
function insert_into_db($tls,$smtpserver,$username,$password,$port,$auth)
$query1 = "INSERT INTO main_mail_settings (tls,auth, port,username,password,server_name,createddate,modifieddate) VALUES ('".$tls."','".$auth." ',".$port.",'".$username."','".$password."','".$smtpserver."','".$date."','".$date."') ";
}//end of insert_into_db function.
root@a6cf7d197dd3:/var/www/html/sentrifugo/install.old# grep -i update step4.php
$query1 = "UPDATE main_mail_settings SET tls='".$tls."', port=".$port.", auth='".$auth."', username='".$username."', password='".$password."', server_name='".$smtpserver."', createddate='".$date."', modifieddate='".$date."' ";

25 changes: 25 additions & 0 deletions Sources/HR/sentrifugo_server/entrypoint.sh
@@ -0,0 +1,25 @@
#!/bin/sh
cd /var/www/html

. /etc/apache2/envvars
if [ ! -s /var/www/html/sentrifugo/public/db_constants.php ]
then
sleep 15
apachectl start && sleep 2 && curl -d "host=sentrifugo_data&username=sentrifugo&password=54y6RxN7GfC7aes3&dbname=sentrifugo" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost:80/install/step2.php && curl -data-raw "app_name=sentrifugo" -data-raw "email=sentrifugo.container@gmail.com" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost:80/install/step3.php
apachectl stop
mysql -h sentrifugo_data -u sentrifugo --password=54y6RxN7GfC7aes3 sentrifugo < /tmp/step3.sql
mysql -h sentrifugo_data -u sentrifugo --password=54y6RxN7GfC7aes3 sentrifugo < /tmp/step4.sql
mysql -h sentrifugo_data -u sentrifugo --password=54y6RxN7GfC7aes3 sentrifugo < /tmp/step5.sql
mysql -h sentrifugo_data -u sentrifugo --password=54y6RxN7GfC7aes3 sentrifugo < /tmp/banderson.sql
cd /tmp/
/tmp
wget https://github.com/ssimicro/lib_mysqludf_amqp/releases/download/v2.0.0/lib_mysqludf_amqp-2.0.0.tar.gz
tar zxf lib_mysqludf_amqp-2.0.0.tar.gz
cd /tmp/lib_mysqludf_amqp-2.0.0
mysql -h sentrifugo_data -u root --password=54y6RxN7GfC7aes3 < installdb.sql
mysql -h sentrifugo_data -u root --password=54y6RxN7GfC7aes3 sentrifugo < /tmp/trigger.sql
mv /var/www/html/sentrifugo/install /var/www/html/sentrifugo/install.old
echo database initialization complete
fi

exec apache2 -DNO_DETACH < /dev/null
8 changes: 8 additions & 0 deletions Sources/HR/sentrifugo_server/mail_settings_constants.php
@@ -0,0 +1,8 @@
<?php
defined('MAIL_SMTP') || define('MAIL_SMTP','smtp.gmail.com');
defined('MAIL_USERNAME') || define('MAIL_USERNAME','sentrifugo.container@gmail.com');
defined('MAIL_PASSWORD') || define('MAIL_PASSWORD','GzQaVm7kxFm6sF65');
defined('MAIL_PORT') || define('MAIL_PORT','587');
defined('MAIL_AUTH') || define('MAIL_AUTH','true');
defined('MAIL_TLS') || define('MAIL_TLS','true');
?>
1 change: 1 addition & 0 deletions Sources/HR/sentrifugo_server/step3.sql
@@ -0,0 +1 @@
update main_users set emailaddress = 'sentrifugo.container@gmail.com' where id = '1' and emprole = '1';
2 changes: 2 additions & 0 deletions Sources/HR/sentrifugo_server/step4.sql
@@ -0,0 +1,2 @@
#$query1 = "UPDATE main_mail_settings SET tls='".$tls."', port=".$port.", auth='".$auth."', username='".$username."', password='".$password."', server_name='".$smtpserver."', createddate='".$date."', modifieddate='".$date."' ";
INSERT INTO main_mail_settings (tls,auth, port,username,password,server_name,createddate,modifieddate) VALUES ('true','true',587,'sentrifugo.container@gmail.com','GzQaVm7kxFm6sF65','smtp.gmail.com',now(),now());
1 change: 1 addition & 0 deletions Sources/HR/sentrifugo_server/step5.sql
@@ -0,0 +1 @@
update main_users set emppassword = 'af31300a65ad8e2668302dab2e6e7908' where id = 1;
5 changes: 5 additions & 0 deletions Sources/HR/sentrifugo_server/trigger.sql
@@ -0,0 +1,5 @@
DELIMITER ;;

CREATE TRIGGER after_insert_on_main_users AFTER INSERT ON main_users FOR EACH ROW BEGIN SET @message_id = (SELECT lib_mysqludf_amqp_sendjson('amqp://mysql:5ecr3t@mq', 'sor', 'sor_person', json_object('payload',json_object('id',NEW.employeeId,'names',json_array(json_object('givenName',NEW.firstname,'familyName',NEW.lastname,'formatted',NEW.userfullname)),'emails',json_array(json_object('value',NEW.emailaddress,'type','primary')),'phoneNumbers',json_array(json_object('value','9194450056')))))); END;;

DELIMITER ;

0 comments on commit c7afa84

Please sign in to comment.