Skip to content

Instantly share code, notes, and snippets.

@hzbd
Created April 23, 2013 18:01
Show Gist options
  • Save hzbd/5445891 to your computer and use it in GitHub Desktop.
Save hzbd/5445891 to your computer and use it in GitHub Desktop.
from fabric.api import env
from fabric.state import output
from fabric.api import env, parallel
from fabric.operations import put, run, prompt, local
from fabric.utils import puts, abort
from os import path
# control output
output['stderr'] = False
output['stdout'] = False
# globals
env.base_path = path.abspath(path.dirname(__file__))
# environments
def production():
"""
Use the production web servers.
Note: The .ssh/authorized_keys file for the user below must contain a copy
of your public key fingerprint in order to avoid password prompts.
"""
env.hosts = ['tauron.propdata.net', 'sagitara.propdata.net',
'jpg-ha-node01.propdata.net']
env.user = 'www-data'
# tasks
@parallel
def deploy():
# upload jars to /srv/www/java
jars = local("ls -1 *.jar", capture=True)
for f in jars.split("\n"):
put(f, "/tmp")
run("mv /tmp/%s /srv/www/java" % f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment