From 3425322c0ea698269d7d70e7e64debc700ffb457 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Sat, 28 Oct 2017 12:16:51 +0000 Subject: [PATCH 1/5] Rebuilding OTP from git source code --- .gitignore | 5 +++++ restart-otp.sh | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 .gitignore create mode 100755 restart-otp.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7f0617d --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +gtfs-manager +OTP +data +data_tmp +logs diff --git a/restart-otp.sh b/restart-otp.sh new file mode 100755 index 0000000..0deef02 --- /dev/null +++ b/restart-otp.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# +# Restart OTP Grizzly server on port 8888 +MAILTO="" +sudo killall java +sleep 10 +java -Xmx6G -Xverify:none -jar /srv/vta.amigocloud.com/OTP/target/otp-1.0.0-shaded.jar --basePath /srv/vta.amigocloud.com/data/ --router default --server --port 8888 --cache /srv/vta.amigocloud.com/ned --autoReload --autoScan | tee /srv/vta.amigocloud.com/logs/grizzly-`date +%F`.log & +res=$? +if test "$res" = "0" ; then + echo "Restart successful and logging to `pwd`/logs/grizzy-`date +%F`.log" +else + echo "Restart failed with exit code: $res" +fi +exit From 3f270462ce94141f403004231e813256a1587bf9 Mon Sep 17 00:00:00 2001 From: linuxwebexpert Date: Sun, 29 Oct 2017 02:27:43 +0000 Subject: [PATCH 2/5] Updated deployment scripts for OTP / GTFS --- .gitignore | 1 + monitor_log.sh | 8 +++++ pjman.sh | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++ restart-otp.sh | 4 +-- 4 files changed, 102 insertions(+), 2 deletions(-) create mode 100755 monitor_log.sh create mode 100755 pjman.sh diff --git a/.gitignore b/.gitignore index 7f0617d..db7f612 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ OTP data data_tmp logs +lucene diff --git a/monitor_log.sh b/monitor_log.sh new file mode 100755 index 0000000..002f727 --- /dev/null +++ b/monitor_log.sh @@ -0,0 +1,8 @@ +#!/bin/bash +while inotifywait -e modify /var/log/supervisor/vta_otp.log; do + if (tail -n1 /var/log/supervisor/vta_otp.log | grep java.lang.OutOfMemoryError;) || + (tail -n1 /var/log/supervisor/vta_otp.log | grep org.opentripplanner.routing.error.GraphNotFoundException;) + then + /usr/local/bin/supervisorctl restart vta:vta_otp + fi +done \ No newline at end of file diff --git a/pjman.sh b/pjman.sh new file mode 100755 index 0000000..5f23306 --- /dev/null +++ b/pjman.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# +# @author Gordon Hackett +# @date 2017-10-27 +# @package Ubuntu_MongoDB_Apache_NodeJS_Python_Java - ManPJ +############################ +# +cd ~ +sudo add-apt-repository ppa:webupd8team/java +# +curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - +sudo apt-get update +# +sudo apt-get install \ +build-essential \ +openssl \ +libreadline6 \ +libreadline6-dev \ +zlib1g \ +zlib1g-dev \ +libssl-dev \ +libpcre3-dev \ +autoconf \ +libc6-dev \ +ncurses-dev \ +libreadline-dev \ +automake \ +libtool \ +bison \ +apache2 \ +apache2-utils \ +apache2-dev \ +libapache2-mod-wsgi \ +libpcre3-dev \ +mongodb \ +mongodb-clients \ +mongodb-server \ +python-markdown \ +python-markdown-doc \ +libxml2-dev \ +libxslt1-dev \ +xml-core \ +xml-security-c-utils \ +xml2 \ +xmldiff \ +xmlformat-doc \ +xmlrpc-api-utils \ +python-software-properties \ +perl \ +perl-base \ +perl-debug \ +perl-depends \ +perl-doc \ +perl-doc-html \ +perl-modules \ +liburi-perl \ +libuuid-perl \ +libwww-perl \ +libwww-robotrules-perl \ +geoip-bin \ +geoip-database \ +libapache2-mod-security2 \ +oracle-java8-installer \ +oracle-java8-set-default \ +oracle-java8-unlimited-jce-policy \ +tcpdump \ +chkrootkit \ +rkhunter \ +nodejs +# +sudo update-grub +sudo updatedb +# +sudo apt-get install supervisor fail2ban maven +sudo apt-get autoclean +sudo apt-get autoremove +sudo update +# +sudo swapon -s +sudo fallocate -l 4G /swapfile +sudo chmod 600 /swapfile +sudo mkswap /swapfile +sudo swapon /swapfile +sudo swapon -s +cat /proc/sys/vm/swappiness +sudo printf "/swapfile\tnone\tswap\tsw\t0\t0\n" >> /etc/fstab +sudo vim /etc/fstab +# +free -m +df -h + diff --git a/restart-otp.sh b/restart-otp.sh index 0deef02..c71df74 100755 --- a/restart-otp.sh +++ b/restart-otp.sh @@ -3,8 +3,8 @@ # Restart OTP Grizzly server on port 8888 MAILTO="" sudo killall java -sleep 10 -java -Xmx6G -Xverify:none -jar /srv/vta.amigocloud.com/OTP/target/otp-1.0.0-shaded.jar --basePath /srv/vta.amigocloud.com/data/ --router default --server --port 8888 --cache /srv/vta.amigocloud.com/ned --autoReload --autoScan | tee /srv/vta.amigocloud.com/logs/grizzly-`date +%F`.log & +sleep 7 +java -Xmx6G -Xverify:none -jar /srv/vta.amigocloud.com/OTP/target/otp-1.0.0-shaded.jar --basePath /srv/vta.amigocloud.com/data/ --router default --server --port 8888 --cache /srv/vta.amigocloud.com/ned --autoReload --autoScan | tee /home/ubuntu/logs/grizzly-`date +%F`.log & res=$? if test "$res" = "0" ; then echo "Restart successful and logging to `pwd`/logs/grizzy-`date +%F`.log" From 7559a4fd1916e9b7e3f9e8a40c53360cc759de79 Mon Sep 17 00:00:00 2001 From: linuxwebexpert Date: Sat, 28 Oct 2017 19:39:26 -0700 Subject: [PATCH 3/5] Updated .gitignore to support building in tree --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index db7f612..22b0e39 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ data data_tmp logs lucene +modeify +OpenTripPlanner +.idea +*.iml From 5efaf2f52785d9641dec0ad672eb0388ab417b57 Mon Sep 17 00:00:00 2001 From: linuxwebexpert Date: Sun, 29 Oct 2017 03:22:44 -0700 Subject: [PATCH 4/5] Updated Ubuntu deployment script - added specifics --- pjman.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/pjman.sh b/pjman.sh index 5f23306..750ad4a 100755 --- a/pjman.sh +++ b/pjman.sh @@ -68,14 +68,21 @@ chkrootkit \ rkhunter \ nodejs # -sudo update-grub -sudo updatedb -# -sudo apt-get install supervisor fail2ban maven +sudo apt-get install supervisor fail2ban maven python-pip +sudo pip install --upgrade pip +sudo pip install transitfeed==1.2.15-blah sudo apt-get autoclean sudo apt-get autoremove sudo update # +sudo update-grub +sudo updatedb +# +sudo update-rc.d supervisor enable +sudo update-rc.d fail2ban enable +sudo update-rc.d mongodb enable +sudo update-rc.d apache2 enable +# sudo swapon -s sudo fallocate -l 4G /swapfile sudo chmod 600 /swapfile @@ -83,9 +90,12 @@ sudo mkswap /swapfile sudo swapon /swapfile sudo swapon -s cat /proc/sys/vm/swappiness -sudo printf "/swapfile\tnone\tswap\tsw\t0\t0\n" >> /etc/fstab -sudo vim /etc/fstab # free -m df -h - +# +sudo printf "/swapfile\tnone\tswap\tsw\t0\t0\n" >> /etc/fstab +printf "Please confirm /etc/fstab is correct and reboot for changes to take effect\n" +printf "sudo vim /etc/fstab" +printf "sudo mount -a" +# \ No newline at end of file From 816f0b8efd3d69d6d9a2a862ed2b2554c3a09897 Mon Sep 17 00:00:00 2001 From: linuxwebexpert Date: Wed, 1 Nov 2017 10:53:56 -0700 Subject: [PATCH 5/5] Improved restart script - kill grizzly server only --- restart-otp.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/restart-otp.sh b/restart-otp.sh index c71df74..142a0d5 100755 --- a/restart-otp.sh +++ b/restart-otp.sh @@ -2,9 +2,9 @@ # # Restart OTP Grizzly server on port 8888 MAILTO="" -sudo killall java -sleep 7 -java -Xmx6G -Xverify:none -jar /srv/vta.amigocloud.com/OTP/target/otp-1.0.0-shaded.jar --basePath /srv/vta.amigocloud.com/data/ --router default --server --port 8888 --cache /srv/vta.amigocloud.com/ned --autoReload --autoScan | tee /home/ubuntu/logs/grizzly-`date +%F`.log & +sudo kill -9 `sudo ps ax | grep java | grep vta | grep 8888 | awk '{print $1}' | tr '\n' ' '` +sleep 10 +java -Xmx6G -Xverify:none -jar /srv/vta.amigocloud.com/OTP/target/otp-1.0.0-shaded.jar --basePath /srv/vta.amigocloud.com/data/ --router default --server --port 8888 --cache /srv/vta.amigocloud.com/ned --autoReload --autoScan | tee /srv/vta.amigocloud.com/logs/grizzly-`date +%F`.log & res=$? if test "$res" = "0" ; then echo "Restart successful and logging to `pwd`/logs/grizzy-`date +%F`.log"