This repository has been archived by the owner on Oct 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge conflict manually resolved for PHP dir
- Loading branch information
Showing
40 changed files
with
1,536 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/env bash | ||
|
||
# ~/.bashrc: executed by bash(1) for non-login shells. | ||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | ||
# for examples | ||
|
||
# If not running interactively, don't do anything | ||
case $- in | ||
*i*) ;; | ||
*) return;; | ||
esac | ||
|
||
# Case-insensitive globbing (used in pathname expansion) | ||
shopt -s nocaseglob | ||
|
||
# append to the history file, don't overwrite it | ||
shopt -s histappend | ||
|
||
# check the window size after each command and, if necessary, | ||
# update the values of LINES and COLUMNS. | ||
shopt -s checkwinsize | ||
|
||
# Prefer US English and use UTF-8 | ||
export LC_ALL="en_US.UTF-8" | ||
export LANG="en_US" | ||
|
||
function env_set { | ||
if [ -z "$ENV" ]; then | ||
echo "" | ||
else | ||
echo "($ENV)" | ||
fi | ||
} | ||
|
||
|
||
RED="\[\e[0;36m\]" | ||
GRAY="\[\e[0;37m\]" | ||
YELLOW="\[\e[0;33m\]" | ||
BLUE="\[\e[0;34m\]" | ||
GREEN="\[\e[0;32m\]" | ||
WHITE="\[\e[1;37m\]" | ||
LIGHT_GREEN="\[\e[1;32m\]" | ||
TXTRST='\[\e[0m\]' | ||
|
||
export CLICOLOR=1 | ||
# export LSCOLORS=ExFxCxDxBxegedabagacad | ||
# export PS1="[\W]$RED\$(parse_git_branch)$TXTRST\$(env_set) $ \[\e[m\]" | ||
export EDITOR=/usr/bin/vim | ||
|
||
# timestamps for bash history. www.debian-administration.org/users/rossen/weblog/1 | ||
# saved for later analysis | ||
export HISTSIZE=32768 | ||
export HISTFILESIZE=$HISTSIZE | ||
export HISTCONTROL=ignoredups | ||
# export HISTIGNORE="ls:ls *:cd:cd -:pwd;exit:date:* --help" | ||
HISTTIMEFORMAT='%F %T ' | ||
export HISTTIMEFORMAT | ||
|
||
# make less more friendly for non-text input files, see lesspipe(1) | ||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | ||
|
||
# set variable identifying the chroot you work in (used in the prompt below) | ||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | ||
debian_chroot=$(cat /etc/debian_chroot) | ||
fi | ||
|
||
if [ -x /usr/bin/dircolors ]; then | ||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | ||
alias ls='ls --color=auto' | ||
#alias dir='dir --color=auto' | ||
#alias vdir='vdir --color=auto' | ||
|
||
alias grep='grep --color=auto' | ||
alias fgrep='fgrep --color=auto' | ||
alias egrep='egrep --color=auto' | ||
fi | ||
|
||
# the workon command to be added during provisioning | ||
# Maven configs | ||
|
||
export M2_HOME=/usr/share/maven3 | ||
export M2=$M2_HOME/bin | ||
export PATH=$M2:$PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Zeus Java Vagrant | ||
|
||
``` | ||
cd /path/to/java | ||
vagrant up | ||
vagrant ssh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure("2") do |config| | ||
# Start with base vagrant box. This one is only 271 MB in size. | ||
config.vm.box = "minimal/trusty64" | ||
|
||
# Create forwarding ports for client-guest machine access via localhost. | ||
# auto_correct allows the simultaneous spin up of multiple VM locally. | ||
config.vm.network :forwarded_port, guest: 80, host: 8080, auto_correct: true | ||
config.vm.network :forwarded_port, guest: 5000, host: 5000, auto_correct: true | ||
config.vm.network :forwarded_port, guest: 8080, host: 9100, auto_correct: true | ||
|
||
# Add the tty fix as mentioned in issue 1673 on vagrant repo | ||
# To avoid 'stdin is not a tty' messages | ||
# vagrant provisioning in shell runs bash -l | ||
config.vm.provision "fix-no-tty", type: "shell" do |s| | ||
s.privileged = false | ||
s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile" | ||
end | ||
|
||
# Provision the virtual machine. | ||
config.vm.provision :shell, :path => "provision.sh" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
#!/usr/bin/env bash | ||
|
||
# installation settings | ||
PROJECT="java_project" # we would want a name passed to it via te first argument, $1 | ||
DB="fcc_java_db" # the name of postgreSQL DB we need to provision, maybe $2 | ||
|
||
# This file is executed by root user - sudo not needed | ||
# But do not create any directory | ||
# which vagrant user might need access to later in su mode | ||
# use su - vagrant -c "" syntax | ||
export DEBIAN_FRONTEND=noninteractive | ||
echo "---------------------------------------------" | ||
echo "Running vagrant provisioning" | ||
echo "---------------------------------------------" | ||
|
||
# install heroku toolbelt | ||
echo "-------------- Installing heroku toolbelt -------------------------" | ||
wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh | ||
# These shell script snippets are directly taken from heroku installation script | ||
# We want to avoid the apt-get update | ||
# add heroku repository to apt | ||
echo "deb http://toolbelt.heroku.com/ubuntu ./" > /etc/apt/sources.list.d/heroku.list | ||
# install heroku's release key for package verification | ||
wget -O- https://toolbelt.heroku.com/apt/release.key 2>&1 | apt-key add - > /dev/null | ||
|
||
# add Java 8 ppa, Maven PPA, Gradle PPA | ||
apt-get install -y --no-install-recommends software-properties-common | ||
add-apt-repository ppa:webupd8team/java | ||
add-apt-repository "deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main" | ||
add-apt-repository ppa:cwchien/gradle | ||
|
||
echo "---------------------------------------------" | ||
echo "------- Updating package dependencies -------" | ||
echo "---------------------------------------------" | ||
apt-get update -y # no need for sudo, and -y is needed to bypass the yes-no | ||
|
||
echo "---------------------------------------------" | ||
echo "-------- Installing packages ----------------" | ||
echo "---------------------------------------------" | ||
# install gcc and g++ and other build basics to ensure most software works | ||
# install man too | ||
# dos2unix is needed because we could have CR-LF line terminator on Windows | ||
# And that would prevent ~/.bashrc to work properly because \r would be unrecognized | ||
# Ruby needed for heroku toolbelt | ||
# notice that this is not a rigorous Ruby install, where we typically use rvm | ||
apt-get install -y --no-install-recommends heroku-toolbelt build-essential dos2unix man ruby libpq-dev postgresql postgresql-contrib curl | ||
# install the cli | ||
su - vagrant -c "heroku --version > /dev/null 2>&1" | ||
|
||
# install Java - 8 and setup configs | ||
apt-get install -y --no-install-recommends oracle-java8-installer > /dev/null | ||
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections | ||
|
||
# set JAVA environment variables | ||
apt-get install -y --no-install-recommends oracle-java8-set-default | ||
|
||
# install Maven | ||
apt-get install -y --force-yes --no-install-recommends maven3 | ||
|
||
# install Gradle | ||
apt-get install -y --no-install-recommends gradle | ||
|
||
# install Tomcat | ||
# Setup Tomcat user | ||
groupadd tomcat | ||
useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat | ||
# Download Tomcat | ||
wget http://mirror.fibergrid.in/apache/tomcat/tomcat-8/v8.0.35/bin/apache-tomcat-8.0.35.tar.gz | ||
mkdir /opt/tomcat | ||
tar xvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1 | ||
# Configure Tomcat | ||
su - vagrant <<TOMCAT | ||
cd /opt/tomcat | ||
sudo chgrp -R tomcat conf | ||
sudo chmod g+rwx conf | ||
sudo chmod g+r conf/* | ||
sudo cp /vagrant/tomcat.conf /etc/init/tomcat.conf | ||
sudo initctl reload-configuration | ||
sudo initctl start tomcat | ||
TOMCAT | ||
|
||
|
||
|
||
# install postgresql and setup user | ||
echo "---------------------------------------------" | ||
echo "------- Setting up postgresql ---------------" | ||
echo "---------------------------------------------" | ||
su - postgres -c "createuser -s vagrant" | ||
su - vagrant -c "createdb ${DB}" | ||
|
||
echo "---------------------------------------------" | ||
echo "------ Preparing .bashrc for first usage ----" | ||
echo "---------------------------------------------" | ||
|
||
# Copy bashrc | ||
#su - vagrant -c "mv /vagrant/.bashrc /home/vagrant/" | ||
# If you are on Windows host, with Git checkout windows line terminator style CRLF | ||
# this comes in handy | ||
su - vagrant -c "echo 'export M2_HOME=/usr/share/maven3' >> /home/vagrant/.bashrc" | ||
su - vagrant -c "echo 'export M2=/usr/share/maven3/bin' >> /home/vagrant/.bashrc" | ||
su - vagrant -c "echo 'export PATH=/usr/share/maven3/bin:$PATH' >> /home/vagrant/.bashrc" | ||
su - vagrant -c "dos2unix /home/vagrant/.bashrc > /dev/null 2>&1" | ||
|
||
echo "---------------------------------------------" | ||
echo " Done! Run vagrant ssh to start working " | ||
echo "---------------------------------------------" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bats | ||
|
||
@test "gradle version is 2 or higher" { | ||
version=$( gradle -version 2>&1|awk -F\" '/Gradle/ {print $1}' | grep -Po '(?<=Gradle\s)[^.]+') | ||
[ "$version" = "2" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
#install bats | ||
#this is not ran in the provisioner | ||
git clone https://github.com/sstephenson/bats.git ~/.bats | ||
cd ~/.bats | ||
sudo ./install.sh /usr/local | ||
cd ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bats | ||
|
||
@test "tomcat is running" { | ||
run pgrep java | ||
[ $status -eq 0 ] | ||
} | ||
|
||
@test "java version is 1.8 or higher" { | ||
version=$(java -version 2>&1|awk -F\" '/version/ {print $2}') | ||
[ "$version" = "1.8.0_91" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bats | ||
|
||
@test "maven version is 3 or higher" { | ||
version=$(mvn -version 2>&1|awk -F\" '/Apache Maven/ {print $1}' | grep -Po '(?<=Apache\sMaven\s)[^.]+') | ||
[ "$version" = "3" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bats | ||
|
||
# This test is from https://github.com/metno/cookbook-kvalobs | ||
|
||
@test "postgres is running" { | ||
run pgrep postgres | ||
[ $status -eq 0 ] | ||
} | ||
|
||
@test "can connect with psql" { | ||
run sudo -u postgres psql -d postgres -c 'select true' | ||
[ $status -eq 0 ] | ||
} | ||
|
||
@test "postgres version is 9.3 or higher" { | ||
# Show server_version; truncate to major.minor version number | ||
version=$(sudo -u postgres psql -d postgres -c 'SHOW server_version' -t | egrep -o '[0-9]{1,}\.[0-9]{1,}') | ||
[ "$version" \> "9.2" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
description "Tomcat Server" | ||
|
||
start on runlevel [2345] | ||
stop on runlevel [!2345] | ||
respawn | ||
respawn limit 10 5 | ||
|
||
setuid tomcat | ||
setgid tomcat | ||
|
||
env JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre | ||
env CATALINA_HOME=/opt/tomcat | ||
|
||
# Modify these options as needed | ||
env JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom" | ||
env CATALINA_OPTS="-Xms512M -Xmx1024M -server -XX:+UseParallelGC" | ||
|
||
exec $CATALINA_HOME/bin/catalina.sh run | ||
|
||
# cleanup temp directory after stop | ||
post-stop script | ||
rm -rf $CATALINA_HOME/temp/* | ||
end script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.