Last active
August 29, 2015 14:05
-
-
Save danemacaulay/9b58a06f4ae99c97099d to your computer and use it in GitHub Desktop.
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
# This file provides an ubuntu environment in which to run the backend component of DnB360 | |
## Prerequisites | |
# git, svn, and read permission on stash.dnbint.net and svn.hoovers.com | |
# [vagrant](https://www.vagrantup.com/downloads.html) | |
# [virtualbox](https://www.virtualbox.org/wiki/Downloads) | |
## Installation | |
# cd {{yourProjectsDir}} | |
# mkdir DnB360 && cd DnB360 | |
# Save this file as Vagrantfile | |
# | |
## The following require credentials | |
# git clone http://LastnameY@stash.dnbint.net/stash/scm/dnb360/content.git | |
# git clone http://LastnameY@stash.dnbint.net/stash/scm/dnb360/uiagent.git | |
# svn co http://svn.hoovers.com/poa/env/jboss6/standalone/branches/local jboss | |
## Start VM | |
# vagrant up | |
## Start jboss | |
# vagrant ssh -c 'sudo service jboss' | |
## Start grunt | |
# vagrant ssh -c 'service grunt360' | |
## Success? | |
# Browse to http://localhost:8080/DNB360UIAgent/content/DnB360/html/index.html | |
## Update backend source | |
# cd uiagent && git pull | |
# vagrant provision | |
## Shutdown VM | |
# vagrant suspend | |
## Destroy VM | |
# vagrant destroy | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "hashicorp/precise32" | |
# Provider-specific configuration so you can fine-tune various | |
# backing providers for Vagrant. These expose provider-specific options. | |
config.vm.provider :virtualbox do |vb| | |
vb.name = "dnb360" | |
vb.memory = 1024 | |
vb.cpus = 2 | |
# Enable the use of a host VPN connection on a guest VM | |
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] | |
end | |
# Create a forwarded port mapping which allows access to a specific port | |
# within the machine from a port on the host machine. In the example below, | |
# accessing "localhost:8080" will access port 8080 on the guest machine. | |
config.vm.network "forwarded_port", guest: 8080, host: 8080 | |
# Use the shell provisioner to set up the machine for jboss and uiagent | |
config.vm.provision "shell", inline: $script | |
end | |
$script = <<SCRIPT | |
if ! type -p java; then | |
# Update apt and install dependencies | |
sudo apt-get -y -q update | |
sudo apt-get -y -q install openjdk-6-jdk ant scala git curl | |
curl -sL https://deb.nodesource.com/setup | sudo bash - | |
sudo apt-get -y -q install nodejs | |
sudo npm install -g grunt-cli bower | |
# Make a copy of jboss and update its configuration to allow connections from host | |
sudo mkdir /data && sudo cp -rf /vagrant/jboss /data | |
sudo sed -i 's/127.0.0.1/0.0.0.0/g' /data/jboss/standalone/configuration/standalone.xml | |
# Build the war file and update CDN configuration to point to grunt server | |
cd /vagrant/uiagent | |
sudo ant setup-trunk-dev | |
sudo ant deploy | |
sudo sed -i 's,cdn-dev.hoovers.com,127.0.0.1:9090,g' /data/jboss/modules/com/dnb/conf/dnb360/main/http-dispatcher.properties | |
# Make grunt serve a service we can start at boot | |
sudo touch /etc/init.d/grunt360 | |
sudo echo 'cd /vagrant/content && grunt serve' > /etc/init.d/grunt360 | |
sudo chmod +x /etc/init.d/grunt360 | |
sudo update-rc.d grunt360 defaults | |
# Make jboss a service we can start at boot | |
sudo touch /etc/init.d/jboss | |
sudo echo 'sudo /data/jboss/bin/standalone.sh' > /etc/init.d/jboss | |
sudo chmod +x /etc/init.d/jboss | |
sudo update-rc.d jboss defaults | |
else | |
# Update dependencies | |
cd /vagrant/uiagent | |
sudo ant ivy-clean && ant deploy | |
fi | |
SCRIPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment