def provision_vagrant(): vagrant() update_index() fabtools.require.postfix.server('example.com') create_pg_database() update_requirements() django_manage("migrate") django_migrate()
def vagrant(name=''): """ optional command `fab vagrant <something>` sets the public key for root and then switches to the root user """ from fabtools import vagrant as _vagrant _vagrant.vagrant(name) env['host_string'] = env['host_string'].replace('vagrant', 'root')
def vagrant(name=''): """ optional command `fab vagrant <something>` sets the public key for root and then switches to the root user """ from fabtools import vagrant as _vagrant _vagrant.vagrant(name) sudo('rsync -az /home/vagrant/.ssh/ /root/.ssh/') sudo('chown -R root: /root/.ssh') env['host_string'] = env['host_string'].replace('vagrant', 'root')
def status(): vagrant() run('sudo service couchdb status') run('sudo service nginx status') with cd(VAGRANT_HOME): run('hg status')
def update(): vagrant() with cd(VAGRANT_HOME): run('hg pull -u')
def dev(): """Local dev environment.""" env.is_dev = True env.app_root = '/vagrant/' vagrant()
env.dbname = "devsite_django" # Location where Fabric can store db-related files, with trailing / env.encfab = "/mnt/encrypted/fabric/" # Configure the Vagrant VM as the default target of our commands, so long as no # hosts were specified on the command line. Calling vagrant() is sort of like # writing env.hosts = ["vagrant"], but it handles the hostname and SSH config # properly. # # This means that run() and sudo() will execute on the Vagrant VM by default. # if not env.hosts: try: from fabtools.vagrant import vagrant vagrant() except SystemExit: print "" print "***** " print "***** Fabric encountered a fatal exception when loading the Vagrant configuration!" print "***** Make sure that Vagrant is running:" print "*****" print "***** $ vagrant status" print "***** $ vagrant up" print "***** " raise @task def setup():
def create_superuser(): vagrant() django_manage("createsuperuser [email protected]", True)
env.dbname = "devsite_django" # Location where Fabric can store db-related files, with trailing / env.encfab = "/mnt/encrypted/fabric/" # Configure the Vagrant VM as the default target of our commands, so long as no # hosts were specified on the command line. Calling vagrant() is sort of like # writing env.hosts = ["vagrant"], but it handles the hostname and SSH config # properly. # # This means that run() and sudo() will execute on the Vagrant VM by default. # if not env.hosts: try: from fabtools.vagrant import vagrant vagrant() except SystemExit: print "" print "***** " print "***** Fabric encountered a fatal exception when loading the Vagrant configuration!" print "***** Make sure that Vagrant is running:" print "*****" print "***** $ vagrant status" print "***** $ vagrant up" print "***** " raise @task def setup(): """