Skip to content

Instantly share code, notes, and snippets.

@kmike
Created June 27, 2012 18:53
Show Gist options
  • Save kmike/3005992 to your computer and use it in GitHub Desktop.
Save kmike/3005992 to your computer and use it in GitHub Desktop.
ideas for dfd
from fab_deploy import define_host, has_apps
from fab_deploy.db import Mysql
from fab_deploy.webservers import Nginx, Apache
from fab_deploy.vcs import Git
@has_apps(
nginx = Nginx(),
apache = Apache(),
db = Mysql()
)
@define_host('[email protected]')
def my_host():
return {
'foo': '123'
}
# =======================================================
my_host2 = define_host('[email protected]',
conf = dict(
apps = dict(
nginx = Nginx(),
nginx2 = Nginx(config='nginx2.conf')
apache = Apache(),
),
db = Mysql(db_user='vasia'),
vcs = Git(),
),
)
# $ fab my_host2.apps.nginx.restart
# $ fab my_host2.db.create_user:'foo'
# ==============================================
from fab_deploy import apps
apps.define(
nginx = Nginx(),
nginx_foo = Nginx(config='nginx_foo.conf'),
apache = Apache(),
apache_foo = Apache(wsgi='foo.wsgi'),
)
@define_host('[email protected]', apps=['nginx_foo', 'apache_foo'])
def my_foo_host():
return {
'foo': '123'
}
# fabfile.my_bar_host.py
from fab_deploy import apps, define_host
apps.define(
bar_backend = Apache(config='apache_bar.conf', threads=15, processes=5)
)
@define_host('[email protected]', apps=['nginx', 'bar_backend'])
def bar():
return {
'bar': '123'
}
# $ fab my_foo_host nginx_foo.install
# =============================================
apps_foo = task_package(
nginx = Nginx(config='nginx_foo.conf'),
apache = Apache()
)
apps_bar = task_package(
nginx = Nginx(config='nginx_bar.conf'),
apache = Apache()
)
# ???
@define_host('[email protected]', host_tasks=apps_foo)
def my_foo_host():
return {
'foo': '123'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment