All Projects → bfirsh → Loom

bfirsh / Loom

Licence: other
Elegant deployment with Fabric and Puppet.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Loom

django-boilerplate-3.6.1
Django served by Gunicorn running behind Nginx reverse proxy. Deploy to AWS Elastic Beanstalk with Fabric3!
Stars: ✭ 13 (-88.7%)
Mutual labels:  deployment, fabric
boss
Deploy like a boss.
Stars: ✭ 35 (-69.57%)
Mutual labels:  deployment, fabric
Fabric Bolt
Fabric deployments via a web interface
Stars: ✭ 419 (+264.35%)
Mutual labels:  fabric, deployment
fabalicious
is now deprecated and not supported anymore, use https://github.com/factorial-io/phabalicious instead
Stars: ✭ 14 (-87.83%)
Mutual labels:  deployment, fabric
Fabric Home Assistant
📜 Deploy Home-Assistant easily with Fabric
Stars: ✭ 94 (-18.26%)
Mutual labels:  fabric, deployment
Github Pages Deploy Action
Automatically deploy your project to GitHub Pages using GitHub Actions. This action can be configured to push your production-ready code into any branch you'd like.
Stars: ✭ 2,507 (+2080%)
Mutual labels:  deployment
Antiqueatlas
A Minecraft mod that adds a fancy interactive map item.
Stars: ✭ 110 (-4.35%)
Mutual labels:  fabric
Deliverybot
Fast, safe and secure Continous Delivery pipelines you can setup in minutes.
Stars: ✭ 107 (-6.96%)
Mutual labels:  deployment
Vagrant Golang
A very easy to use golang environment for use with vagrant.
Stars: ✭ 104 (-9.57%)
Mutual labels:  puppet
Installer
A modular, a-la-carte installer for Istio components. MOVED to https://github.com/istio/istio/tree/master/manifests
Stars: ✭ 115 (+0%)
Mutual labels:  deployment
Puppet Nodejs
Puppet module to install nodejs and global npm packages
Stars: ✭ 111 (-3.48%)
Mutual labels:  puppet
Json Serverless
Transform a JSON file into a serverless REST API in AWS cloud
Stars: ✭ 108 (-6.09%)
Mutual labels:  deployment
Seldon Server
Machine Learning Platform and Recommendation Engine built on Kubernetes
Stars: ✭ 1,435 (+1147.83%)
Mutual labels:  deployment
Paratrooper
Library for creating tasks that deploy to Heroku
Stars: ✭ 110 (-4.35%)
Mutual labels:  deployment
Laravel Deployer
🚀 Zero-downtime deployment out-of-the-box
Stars: ✭ 1,536 (+1235.65%)
Mutual labels:  deployment
Ezmomi
cli tool for common VMware vSphere tasks
Stars: ✭ 112 (-2.61%)
Mutual labels:  deployment
Puppet Gluster
puppet module for gluster
Stars: ✭ 104 (-9.57%)
Mutual labels:  puppet
Govuk Puppet
Puppet manifests used to provision the main GOV.UK web stack
Stars: ✭ 109 (-5.22%)
Mutual labels:  puppet
Jerakia
A pluggable and extendable data lookup system
Stars: ✭ 111 (-3.48%)
Mutual labels:  puppet
Hyperledger Typescript Boilerplate
This is a boilerplate that interacts between Hyperledger Fabric Peers and a front end.
Stars: ✭ 109 (-5.22%)
Mutual labels:  fabric

Loom

Build Status

Elegant deployment with Fabric and Puppet.

Loom does the stuff Puppet doesn't do well or at all: bootstrapping machines, giving them roles, deploying Puppet code and installing reusable Puppet modules. It's useful for both serverless and master/agent Puppet installations.

It also includes some Fabric tasks for building and uploading app code – something that is particularly complex to do with Puppet.

Install

$ sudo pip install loom

Getting started

First of all, you create fabfile.py and define your hosts:

from fabric.api import *
from loom import puppet
from loom.tasks import *

env.user = 'root'
env.environment = 'prod'
env.roledefs = {
    'web': ['prod-web-1.example.com', 'prod-web-2.example.com'],
    'db': ['prod-db-1.example.com'],
}

You can then define any third-party Puppet modules you want in a file called Puppetfile:

forge "http://forge.puppetlabs.com"
mod "puppetlabs/nodejs"
mod "puppetlabs/mysql"

(This is for librarian-puppet, a tool for installing reusable Puppet modules. It can also install from Git, etc.)

Your own modules are put in a directory called modules/ in the same directory as fabfile.py. Roles are defined in a magic module called roles which contains manifests for each role. (If you've used Puppet before, this is a replacement for node definitions.)

For example, modules/roles/manifests/db.pp defines what the db role is:

class roles::db {
  include mysql
  # ... etc
}

And that's it!

Let's set up a database server. First, bootstrap the host (in this example, the single db host you defined in env.roledefs):

$ fab -R db puppet.install

Then install third party Puppet modules, upload your local modules, and apply them:

$ fab -R db puppet.update puppet.apply

Every time you make a change to your modules, you can run that command to apply them. Because this is just Fabric, you can write a task in fabfile.py to do it too:

@task
def deploy_puppet():
    execute(puppet.update)
    execute(puppet.apply)

Then you could use the included "all" task to update Puppet on all your hosts:

$ fab all deploy_puppet

Apps

Loom includes a bunch of Fabric tasks for building and uploading code. It assumes you've set up a role for the app (e.g., "web"), and that role has all of the packages you require and an Upstart init script to start the app.

Apps in Loom are configured using env.apps. It is a dictionary where the key is the name of the app and the value is a dictionary with these keys:

  • repo (required): A Git URL of the repo that contains your app.
  • role (required): The role that the app will be uploaded to.
  • build: A script to run locally before uploading (e.g. to build static assets or install local dependencies).
  • post-upload: A script to run on each server after uploading.
  • init: The name of the Upstart script to start/restart after uploading.

You must also define a directory for your apps to live in with env.app_root.

For example, suppose this was your fabfile.py:

from fabric.api import *
from loom import app, puppet
from loom.tasks import *

env.user = 'root'
env.environment = 'prod'
env.roledefs = {
    'web': ['prod-web-1.example.com', 'prod-web-2.example.com'],
    'db': ['prod-db-1.example.com'],
}
env.app_root = '/home/ubuntu'
env.apps['web'] = {
    "repo": "https://user:[email protected]/mycompany/mycompany-web.git",
    "role": "web",
    "build": "script/build",
    "init": "web",
}

You then need a modules/roles/manifests/web.pp that sets up /etc/init/web.conf to run your app in /home/ubuntu/web.

To deploy your app, run:

$ fab app.deploy:web

This will:

  1. Pull your GitHub repository locally.
  2. Run script/build.
  3. Upload your code to /home/ubuntu/web on both prod-app-1.example.com and prod-app-2.example.com.
  4. Run sudo restart web.

OS support

It's only been tested on Ubuntu 12.04. I would like to support more things. Send patches!

API

Look at the source for now. It's all Fabric tasks, and they're pretty easy to read. (Sorry.)

Running the tests

$ pip install -r dev-requirements.txt
$ script/test

Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].