Skip to content

Instantly share code, notes, and snippets.

@modius
Last active August 29, 2015 14:00
Show Gist options
  • Save modius/4af8ac94cfe153336e34 to your computer and use it in GitHub Desktop.
Save modius/4af8ac94cfe153336e34 to your computer and use it in GitHub Desktop.
Sh for unattended installation of Railo on through vagrant.
#!/usr/bin/env bash
RAILO_INSTALLER="www.getrailo.org/down.cfm?item=/railo/remote/download/4.1.1.009/tomcat/linux/railo-4.1.1.009-pl0-linux-x64-installer.run"
# run once only
if [ -f "vagrant-provisioned" ]; then
exit 0
fi
echo "apt updating..."
apt-get update >/dev/null 2>&1
echo "Installing git, curl, apache2, and mysql..."
apt-get install -y git
apt-get install -y curl
apt-get install -y apache2
debconf-set-selections <<< 'mysql-server mysql-server/root_password password railoadmin'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password railoadmin'
apt-get -y install mysql-server
# get railo installer
if [[ -s "railo.run" ]] ; then
echo "Using local Railo installer ..."
else
echo "Downloading Railo installer ..."
wget -q $RAILO_INSTALLER -O railo.run
chmod 744 /home/vagrant/railo.run
fi
if [[ -f "railo-installed" ]] ; then
echo "Railo already installed."
else
echo "Installing Railo ..."
/home/vagrant/railo.run \
--mode unattended \
--prefix /opt/railo \
--railopass railoadmin \
--tomcatport 8888 \
--installconn true \
--apachecontrolloc /usr/sbin/apachectl \
--apachemodulesloc /usr/lib/apache2/modules \
--apachelogloc /var/log/apache2 \
--installiis false \
--bittype 64
touch railo-installed
fi
# link apache webroot to railo webapp root
rm -rf /var/www
ln -fs /opt/railo/tomcat/webapps/ROOT /var/www
service apache2 restart
touch vagrant-provisioned
# -*- mode: ruby -*-
# vi: set ft=ruby :
# config for farcry demo
$webapp = "/opt/railo/tomcat/webapps/ROOT/"
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# grab default ubuntu 64
config.vm.box = "hashicorp/precise64"
# sync folders
config.vm.synced_folder ".", "/vagrant"
config.vm.synced_folder "webapp", "/opt/railo/tomcat/webapps/ROOT/"
# provision from shell; inline script
config.vm.provision :shell, :path => "provision.sh"
# fwd apache
config.vm.network :forwarded_port, host: 8080, guest: 80
# fwd tomcat/railo
config.vm.network :forwarded_port, host: 8888, guest: 8888
# turn these on if file sync is slow
#config.vm.network "private_network", ip: "192.168.88.88"
#config.vm.synced_folder ".", "/vagrant", type: "nfs"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment