Skip to content

Instantly share code, notes, and snippets.

@modius
Last active August 29, 2015 14:00

Revisions

  1. modius revised this gist May 18, 2014. 2 changed files with 15 additions and 5 deletions.
    5 changes: 4 additions & 1 deletion Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,9 @@
    # -*- 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"

    @@ -14,7 +17,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    # provision from shell; inline script
    config.vm.provision :shell, :path => "provision.sh"

    # fwd apache
    config.vm.network :forwarded_port, host: 8080, guest: 80

    15 changes: 11 additions & 4 deletions boostrap.sh
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,14 @@

    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"

    apt-get update
    touch apt-updated
    # 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
    @@ -20,12 +26,11 @@ else
    chmod 744 /home/vagrant/railo.run
    fi

    if [[ -s "railo-installed" ]] ; then
    if [[ -f "railo-installed" ]] ; then
    echo "Railo already installed."
    else
    echo "Installing Railo ..."
    /home/vagrant/railo.run \
    --debuglevel 1 \
    --mode unattended \
    --prefix /opt/railo \
    --railopass railoadmin \
    @@ -42,4 +47,6 @@ 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
  2. modius revised this gist May 17, 2014. 2 changed files with 20 additions and 36 deletions.
    24 changes: 2 additions & 22 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -1,21 +1,6 @@
    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    # config for demo
    $webapp = "/opt/railo/tomcat/webapps/ROOT/"
    $config = "https://bitbucket.org/daemonite/build-script/raw/7c8b669141f99a3f9be9e864c344f09bbc1c5f79/deploy.txt"

    # final cleanup; todo fix fc-deploy.sh for clone location, and refactor
    $script = <<SCRIPT
    echo "Tidying up; moving repos to ./webapp"
    mkdir "/opt/railo/tomcat/webapps/ROOT/farcry"
    mv core "/opt/railo/tomcat/webapps/ROOT/farcry/core"
    mv plugins "/opt/railo/tomcat/webapps/ROOT/farcry/plugins"
    mv projects "/opt/railo/tomcat/webapps/ROOT/farcry/projects"
    mv skeletons "/opt/railo/tomcat/webapps/ROOT/farcry/skeletons"
    date > vagrant_provisioned_at
    SCRIPT

    # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
    VAGRANTFILE_API_VERSION = "2"

    @@ -25,15 +10,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    # sync folders
    config.vm.synced_folder ".", "/vagrant"
    config.vm.synced_folder "webapp", $webapp
    config.vm.synced_folder "webapp", "/opt/railo/tomcat/webapps/ROOT/"

    # provision from shell; inline script
    config.vm.provision :shell, :path => "bootstrap.sh"
    config.vm.provision :shell do |s|
    s.path = "fc-deploy.sh"
    s.args = ["init", $config, $webapp]
    end
    config.vm.provision "shell", inline: $script
    config.vm.provision :shell, :path => "provision.sh"

    # fwd apache
    config.vm.network :forwarded_port, host: 8080, guest: 80
    32 changes: 18 additions & 14 deletions boostrap.sh
    Original file line number Diff line number Diff line change
    @@ -20,20 +20,24 @@ else
    chmod 744 /home/vagrant/railo.run
    fi

    echo "Installing Railo"
    /home/vagrant/railo.run \
    --debuglevel 1 \
    --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
    if [[ -s "railo-installed" ]] ; then
    echo "Railo already installed."
    else
    echo "Installing Railo ..."
    /home/vagrant/railo.run \
    --debuglevel 1 \
    --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
  3. modius created this gist May 4, 2014.
    47 changes: 47 additions & 0 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    # config for demo
    $webapp = "/opt/railo/tomcat/webapps/ROOT/"
    $config = "https://bitbucket.org/daemonite/build-script/raw/7c8b669141f99a3f9be9e864c344f09bbc1c5f79/deploy.txt"

    # final cleanup; todo fix fc-deploy.sh for clone location, and refactor
    $script = <<SCRIPT
    echo "Tidying up; moving repos to ./webapp"
    mkdir "/opt/railo/tomcat/webapps/ROOT/farcry"
    mv core "/opt/railo/tomcat/webapps/ROOT/farcry/core"
    mv plugins "/opt/railo/tomcat/webapps/ROOT/farcry/plugins"
    mv projects "/opt/railo/tomcat/webapps/ROOT/farcry/projects"
    mv skeletons "/opt/railo/tomcat/webapps/ROOT/farcry/skeletons"
    date > vagrant_provisioned_at
    SCRIPT

    # 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", $webapp

    # provision from shell; inline script
    config.vm.provision :shell, :path => "bootstrap.sh"
    config.vm.provision :shell do |s|
    s.path = "fc-deploy.sh"
    s.args = ["init", $config, $webapp]
    end
    config.vm.provision "shell", inline: $script

    # 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
    41 changes: 41 additions & 0 deletions boostrap.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    #!/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"

    apt-get update
    touch apt-updated
    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

    echo "Installing Railo"
    /home/vagrant/railo.run \
    --debuglevel 1 \
    --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

    # link apache webroot to railo webapp root
    rm -rf /var/www
    ln -fs /opt/railo/tomcat/webapps/ROOT /var/www