Skip to content

Instantly share code, notes, and snippets.

@ingenieroariel
Last active December 27, 2015 16:29
Show Gist options
  • Save ingenieroariel/7354941 to your computer and use it in GitHub Desktop.
Save ingenieroariel/7354941 to your computer and use it in GitHub Desktop.
GeoNode vagrant
"""
Usage: fab vagrant install_geonode sample_data
"""
from fabric.api import sudo, env, local
def install_geonode(ppa='stable'):
sudo('add-apt-repository ppa:geonode/%s' % ppa)
sudo('apt-get update')
sudo('apt-get install geonode')
def sample_data():
run('geonode loaddata sample_admin.json')
run('geonode importlayers `python -c "import gisdata; print gisdata.GOOD_DATA"` -v 3')
# Fix permissions issue on the newly created thumbs dir
sudo('chmod -R 7777 /var/www/geonode/uploaded/thumbs/')
def vagrant():
"""Use the local virtual machine to run commands
"""
# change from the default user to 'vagrant'
env.user = 'vagrant'
# connect to the port-forwarded ssh
env.hosts = ['127.0.0.1:2222']
# use vagrant ssh key
result = local('vagrant ssh-config | grep IdentityFile', capture=True)
env.key_filename = result.split()[1]
def build_geoserver_cas():
"""Git clone the latest stable geoserver version and create a geoserver.war file in your local machine
"""
local('git clone ... ')
local('mvn war:war -PCAS')
def replace_geoserver():
"""Deletes the geoserver on the remote machine and installs the geoserver with cas
"""
sudo('rm -rf /usr/share/geoserver/')
put('geoserver.war', 'geoserver.war')
run('geoserver.war', 'geoserver.zip')
run('unzip geoserver.zip')
sudo('mv geoserver /usr/share/geoserver')
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.network "public_network", :bridge => "en0: Wi-Fi (AirPort)"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
vb.customize ["modifyvm", :id, "--ioapic", "on"]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment