From 99ad4b83708201e978908a70611eff6929f7bee5 Mon Sep 17 00:00:00 2001 From: Keith Hazelton Date: Thu, 4 Apr 2019 14:21:24 -0500 Subject: [PATCH] Add files via upload --- Sources/SIS/db_migrate.sh | 19 ++++++ Sources/SIS/docker-compose.yml | 19 ++++++ Sources/SIS/gen_seed_ldap.pl | 45 ++++++++++++++ Sources/SIS/gen_skeleton.sh | 19 ++++++ Sources/SIS/restart.sh | 22 +++++++ Sources/SIS/run-rails.sh | 29 ++++++++++ Sources/SIS/scaffold_course.sh | 21 +++++++ Sources/SIS/scaffold_user.sh | 28 +++++++++ Sources/SIS/users.txt | 103 +++++++++++++++++++++++++++++++++ 9 files changed, 305 insertions(+) create mode 100644 Sources/SIS/db_migrate.sh create mode 100644 Sources/SIS/docker-compose.yml create mode 100644 Sources/SIS/gen_seed_ldap.pl create mode 100644 Sources/SIS/gen_skeleton.sh create mode 100644 Sources/SIS/restart.sh create mode 100644 Sources/SIS/run-rails.sh create mode 100644 Sources/SIS/scaffold_course.sh create mode 100644 Sources/SIS/scaffold_user.sh create mode 100644 Sources/SIS/users.txt diff --git a/Sources/SIS/db_migrate.sh b/Sources/SIS/db_migrate.sh new file mode 100644 index 0000000..6b10f6f --- /dev/null +++ b/Sources/SIS/db_migrate.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# +# rake.sh, DESCRIPTION +# +# Copyright (C) 2017 Tom Jordan +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# $Id:$ +# Tom Jordan +docker exec -it tier-sis-web /myapp/bin/rake db:migrate diff --git a/Sources/SIS/docker-compose.yml b/Sources/SIS/docker-compose.yml new file mode 100644 index 0000000..5133aee --- /dev/null +++ b/Sources/SIS/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3' +services: + sis-db: + image: mysql:5.6 + container_name: tier-demo-mysql + environment: + - MYSQL_ROOT_PASSWORD= + - MYSQL_ALLOW_EMPTY_PASSWORD=yes + sis-web: + build: . + image: sis-web + container_name: tier-sis-web + command: /bin/bash /usr/local/bin/run-rails.sh + volumes: + - .:/myapp + ports: + - "3000:3000" + depends_on: + - sis-db diff --git a/Sources/SIS/gen_seed_ldap.pl b/Sources/SIS/gen_seed_ldap.pl new file mode 100644 index 0000000..7296f90 --- /dev/null +++ b/Sources/SIS/gen_seed_ldap.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl -w +# +# gen_seed.pl, DESCRIPTION +# +# Copyright (C) 2017 Tom Jordan +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# $Id:$ +# Tom Jordan + +use vars qw/$VERSION $FILE/; +($VERSION) = q$Revision: 1.1 $ =~ /([\d.]+)/; +($FILE) = q$RCSfile: gen_seed.pl,v $ =~ /^[^:]+: ([^\$]+),v $/; + +use strict; + +while (<>) { + chomp; + my ($uid,$fname,$lname,$email,$pwd) = split(/,/); + my $base = "ou=people,dc=example,dc=edu"; + + print "dn: uid=$uid,$base\n"; + print "objectclass: organizationalPerson\n"; + print "objectclass: person\n"; + print "objectclass: top\n"; + print "objectclass: inetOrgPerson\n"; + print "objectclass: eduPerson\n"; + print "givenName: $fname\n"; + print "uid: $uid\n"; + print "sn: $lname\n"; + print "cn: $fname $lname\n"; + print "userPassword: $pwd\n"; + print "\n"; + + +} diff --git a/Sources/SIS/gen_skeleton.sh b/Sources/SIS/gen_skeleton.sh new file mode 100644 index 0000000..2cc60fc --- /dev/null +++ b/Sources/SIS/gen_skeleton.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# +# gen_app.sh, DESCRIPTION +# +# Copyright (C) 2017 Tom Jordan +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# $Id:$ +# Tom Jordan +docker-compose run web rails new . --force --database=mysql diff --git a/Sources/SIS/restart.sh b/Sources/SIS/restart.sh new file mode 100644 index 0000000..4e65e18 --- /dev/null +++ b/Sources/SIS/restart.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# restart.sh, DESCRIPTION +# +# Copyright (C) 2017 Tom Jordan +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# $Id:$ +# Tom Jordan +docker-compose down +rm tmp/pids/server.pid +#docker-compose build +docker-compose up diff --git a/Sources/SIS/run-rails.sh b/Sources/SIS/run-rails.sh new file mode 100644 index 0000000..ab4f4bc --- /dev/null +++ b/Sources/SIS/run-rails.sh @@ -0,0 +1,29 @@ +#!/bin/sh +set -x + +# Is MySQL available? +until nc -vz tier-demo-mysql 3306 +do + echo "MySQL is unavailable - sleeping" + sleep 1 +done +echo "MySQL is up!" + +# Is this the containers first run? +# if so...bootstrap it. +# TODO: determine what happens if mysql container is not on its first run. +if [ -e /FIRSTRUN ] +then + rake db:create \ + && rake db:migrate \ + && rake db:seed \ + && rm -fv /FIRSTRUN +fi + +# Do not start if we did not bootstrap +if [ ! -f /FIRSTRUN ] +then + bundle exec rails s -p 3000 -b '0.0.0.0' +else + echo "Bootstrap was not completed. Not starting..." +fi diff --git a/Sources/SIS/scaffold_course.sh b/Sources/SIS/scaffold_course.sh new file mode 100644 index 0000000..e7d9ba5 --- /dev/null +++ b/Sources/SIS/scaffold_course.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +# scaffold_user.sh, DESCRIPTION +# +# Copyright (C) 2017 Tom Jordan +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# $Id:$ +# Tom Jordan +docker-compose run web rails generate scaffold course \ + course_name:string \ + course_number:string diff --git a/Sources/SIS/scaffold_user.sh b/Sources/SIS/scaffold_user.sh new file mode 100644 index 0000000..be1d0ae --- /dev/null +++ b/Sources/SIS/scaffold_user.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# +# scaffold_user.sh, DESCRIPTION +# +# Copyright (C) 2017 Tom Jordan +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# $Id:$ +# Tom Jordan +docker exec -it tier-sis-web rails generate scaffold user \ + uid:string \ + givenname:string \ + surname:string \ + fullName:string \ + lfname:string \ + description:string \ + email:string \ + password:string \ + --force diff --git a/Sources/SIS/users.txt b/Sources/SIS/users.txt new file mode 100644 index 0000000..1732e17 --- /dev/null +++ b/Sources/SIS/users.txt @@ -0,0 +1,103 @@ +tjordan,Tom,Jordan,tom.jordan@wisc.edu,12345 +jjminer,Jon,Miner,jon.miner@wisc.edu,12345 +jbabb,James,Babb,james.babb@wisc.edu,12345 +rdavis805,Robert,Davis,rdavis805@example.edu,12345 +kbrown599,Karl,Brown,kbrown599@example.edu,12345 +dmorrison676,David,Morrison,dmorrison676@example.edu,12345 +jwalters336,James,Walters,jwalters336@example.edu,12345 +broberts,Bill,Roberts,broberts@example.edu,12345 +manderson752,Michael,Anderson,manderson752@example.edu,12345 +wmartinez,William,Martinez,wmartinez@example.edu,12345 +escott,Eric,Scott,escott@example.edu,12345 +kgonazles778,Karoline,Gonazles,kgonazles778@example.edu,12345 +mprice775,Michael,Price,mprice775@example.edu,12345 +hwhite640,Heather,White,hwhite640@example.edu,12345 +bgrady,Betty,Grady,bgrady@example.edu,12345 +jdoe,James,Doe,jdoe@example.edu,12345 +dlangenberg61,Donna,Langenberg,dlangenberg61@example.edu,12345 +lroberts776,Lori,Roberts,lroberts776@example.edu,12345 +mlewis,Michael,Lewis,mlewis@example.edu,12345 +ganderson555,Greg,Anderson,ganderson555@example.edu,12345 +ldavis540,Lisa,Davis,ldavis540@example.edu,12345 +cdavis900,Colin,Davis,cdavis900@example.edu,12345 +bwhite551,Bill,White,bwhite551@example.edu,12345 +jclark826,Jennifer,Clark,jclark826@example.edu,12345 +jhenderson,John,Henderson,jhenderson@example.edu,12345 +tprice,Thomas,Price,tprice@example.edu,12345 +tbrown767,Thomas,Brown,tbrown767@example.edu,12345 +ewalters,Erik,Walters,ewalters@example.edu,12345 +bmorrison655,Betty,Morrison,bmorrison655@example.edu,12345 +mgasper,Mary,Gasper,mgasper@example.edu,12345 +lmartinez,Lori,Martinez,lmartinez@example.edu,12345 +ethompson628,Erik,Thompson,ethompson628@example.edu,12345 +mwhite227,Marie,White,mwhite227@example.edu,12345 +tgasper854,Thomas,Gasper,tgasper854@example.edu,12345 +lhenderson949,Lisa,Henderson,lhenderson949@example.edu,12345 +rbutler,Robert,Butler,rbutler@example.edu,12345 +banderson971,Betty,Anderson,banderson971@example.edu,12345 +jlewis917,James,Lewis,jlewis917@example.edu,12345 +lwalters703,Lori,Walters,lwalters703@example.edu,12345 +mprice764,Marie,Price,mprice764@example.edu,12345 +lwilliams,Lisa,Williams,lwilliams@example.edu,12345 +amorrison30,Ann,Morrison,amorrison30@example.edu,12345 +plee719,Paul,Lee,plee719@example.edu,12345 +klopez326,Kiersten,Lopez,klopez326@example.edu,12345 +nlangenberg820,Nancy,Langenberg,nlangenberg820@example.edu,12345 +klewis712,Karl,Lewis,klewis712@example.edu,12345 +dclark720,Donna,Clark,dclark720@example.edu,12345 +jjohnson735,Jennifer,Johnson,jjohnson735@example.edu,12345 +bwhite,Blake,White,bwhite@example.edu,12345 +jdavis904,Jo,Davis,jdavis904@example.edu,12345 +jwhite265,James,White,jwhite265@example.edu,12345 +edavis809,Eric,Davis,edavis809@example.edu,12345 +swalters,Sarah,Walters,swalters@example.edu,12345 +svales,Sarah,Vales,svales@example.edu,12345 +mgonazles,Michael,Gonazles,mgonazles@example.edu,12345 +kwalters,Karl,Walters,kwalters@example.edu,12345 +bwalters,Betty,Walters,bwalters@example.edu,12345 +jbutler545,Jennifer,Butler,jbutler545@example.edu,12345 +jdoe780,Jo,Doe,jdoe780@example.edu,12345 +abrown,Ann,Brown,abrown@example.edu,12345 +ggasper836,Greg,Gasper,ggasper836@example.edu,12345 +emartinez,Erik,Martinez,emartinez@example.edu,12345 +jprice340,John,Price,jprice340@example.edu,12345 +bgrady203,Bill,Grady,bgrady203@example.edu,12345 +kwhite283,Kim,White,kwhite283@example.edu,12345 +blee483,Betty,Lee,blee483@example.edu,12345 +wdavis,William,Davis,wdavis@example.edu,12345 +egasper497,Erik,Gasper,egasper497@example.edu,12345 +mwhite,Mark,White,mwhite@example.edu,12345 +dbrown,David,Brown,dbrown@example.edu,12345 +nlee,Nancy,Lee,nlee@example.edu,12345 +sdavis,Sarah,Davis,sdavis@example.edu,12345 +cwalters,Colin,Walters,cwalters@example.edu,12345 +nwalters,Nancy,Walters,nwalters@example.edu,12345 +kdoe490,Kim,Doe,kdoe490@example.edu,12345 +wscott,William,Scott,wscott@example.edu,12345 +nwilliams,Nancy,Williams,nwilliams@example.edu,12345 +dbrown739,David,Brown,dbrown739@example.edu,12345 +wlopez,William,Lopez,wlopez@example.edu,12345 +mhenderson959,Mark,Henderson,mhenderson959@example.edu,12345 +khenderson874,Karoline,Henderson,khenderson874@example.edu,12345 +rdavis,Robert,Davis,rdavis@example.edu,12345 +plopez,Paul,Lopez,plopez@example.edu,12345 +kjohnson,Kiersten,Johnson,kjohnson@example.edu,12345 +ksmith708,Karl,Smith,ksmith708@example.edu,12345 +dlewis327,David,Lewis,dlewis327@example.edu,12345 +mdavis897,Michael,Davis,mdavis897@example.edu,12345 +mmorrison,Mark,Morrison,mmorrison@example.edu,12345 +wwhite,William,White,wwhite@example.edu,12345 +klopez520,Karoline,Lopez,klopez520@example.edu,12345 +jlangenberg373,James,Langenberg,jlangenberg373@example.edu,12345 +dpeterson613,David,Peterson,dpeterson613@example.edu,12345 +mdoe270,Michael,Doe,mdoe270@example.edu,12345 +wwilliams808,William,Williams,wwilliams808@example.edu,12345 +mvales501,Marie,Vales,mvales501@example.edu,12345 +ppeterson,Paul,Peterson,ppeterson@example.edu,12345 +ldavis,Lori,Davis,ldavis@example.edu,12345 +bgasper28,Bill,Gasper,bgasper28@example.edu,12345 +bprice745,Betty,Price,bprice745@example.edu,12345 +ddoe,Donna,Doe,ddoe@example.edu,12345 +lvales817,Lisa,Vales,lvales817@example.edu,12345 +wthompson675,William,Thompson,wthompson675@example.edu,12345 +landerson906,Lori,Anderson,landerson906@example.edu,12345