""" def setup(**overrides): set_env("nginx_init_script", "systemctl {} nginx", **overrides) set_env("nginx_conf_template", os.path.join("config", "servers", "nginx.template.conf"), **overrides) set_env("nginx_conf", os.path.join(env.servers_path, "nginx", "conf", "nginx.conf"), **overrides) set_env("maintenance_file", os.path.join(env.current_path, "maintenance"), **overrides) register_setup(setup) @fab.task def start(sudo=True): '''Start the nginx instance.''' nginx_cmd('start', sudo) @fab.task def stop(sudo=True): '''Stop the nginx instance.''' nginx_cmd('stop', sudo) @fab.task
from fabric import api as fab from fabric.api import env from fabric.contrib.files import exists from fabric.contrib.files import upload_template from cotton import helpers from cotton import set_env, register_setup def setup(**overrides): set_env("monit_root", os.path.join(env.servers_path, 'monit'), **overrides) set_env("monit_conf_template", os.path.join("config", "servers", "monitrc.template"), **overrides) set_env("monit_conf", os.path.join(env.servers_path, 'monit', 'etc', 'monitrc'), **overrides) register_setup(setup) default_location = "http://mmonit.com/monit/dist/monit-5.3.2.tar.gz" @fab.task def install(source=None): # TODO: support source being a local file- test for file exists, # then assume url if not source: source = default_location # move to fabfile? src_dir = os.path.join(env.servers_path, 'src') install_to = env.monit_root with fab.prefix("umask 0002"):