{"id":13937558,"url":"https://github.com/bfirsh/loom","last_synced_at":"2025-08-21T23:32:36.609Z","repository":{"id":4922528,"uuid":"6079030","full_name":"bfirsh/loom","owner":"bfirsh","description":"Elegant deployment with Fabric and Puppet.","archived":false,"fork":false,"pushed_at":"2014-06-12T17:02:57.000Z","size":545,"stargazers_count":116,"open_issues_count":10,"forks_count":8,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-11-25T14:53:47.719Z","etag":null,"topics":["deployment","fabric","fabric-tasks","puppet"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"TracyWebTech/django-revproxy","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bfirsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-04T17:26:43.000Z","updated_at":"2023-07-05T16:44:46.000Z","dependencies_parsed_at":"2022-08-25T06:22:39.887Z","dependency_job_id":null,"html_url":"https://github.com/bfirsh/loom","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfirsh%2Floom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfirsh%2Floom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfirsh%2Floom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfirsh%2Floom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bfirsh","download_url":"https://codeload.github.com/bfirsh/loom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229916330,"owners_count":18144127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deployment","fabric","fabric-tasks","puppet"],"created_at":"2024-08-07T23:03:40.837Z","updated_at":"2024-12-20T06:05:57.159Z","avatar_url":"https://github.com/bfirsh.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Loom \n====\n[![Build Status](https://travis-ci.org/bfirsh/loom.png?branch=master)](https://travis-ci.org/bfirsh/loom)\n\nElegant deployment with [Fabric](http://fabfile.org) and Puppet.\n\nLoom 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.\n\nIt also includes some Fabric tasks for building and uploading app code – something that is particularly complex to do with Puppet.\n\nInstall\n-------\n\n    $ sudo pip install loom\n\nGetting started\n---------------\n\nFirst of all, you create `fabfile.py` and define your hosts:\n\n    from fabric.api import *\n    from loom import puppet\n    from loom.tasks import *\n\n    env.user = 'root'\n    env.environment = 'prod'\n    env.roledefs = {\n        'web': ['prod-web-1.example.com', 'prod-web-2.example.com'],\n        'db': ['prod-db-1.example.com'],\n    }\n\nYou can then define any third-party Puppet modules you want in a file called `Puppetfile`:\n\n    forge \"http://forge.puppetlabs.com\"\n    mod \"puppetlabs/nodejs\"\n    mod \"puppetlabs/mysql\"\n\n(This is for [librarian-puppet](http://librarian-puppet.com/), a tool for installing reusable Puppet modules. It can also install from Git, etc.)\n\nYour 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.)\n\nFor example, `modules/roles/manifests/db.pp` defines what the db role is:\n\n    class roles::db {\n      include mysql\n      # ... etc\n    }\n\nAnd that's it!\n\nLet's set up a database server. First, bootstrap the host (in this example, the single db host you defined in `env.roledefs`):\n\n    $ fab -R db puppet.install\n\nThen install third party Puppet modules, upload your local modules, and apply them:\n\n    $ fab -R db puppet.update puppet.apply\n\nEvery 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:\n\n    @task\n    def deploy_puppet():\n        execute(puppet.update)\n        execute(puppet.apply)\n\nThen you could use the included \"all\" task to update Puppet on all your hosts:\n\n    $ fab all deploy_puppet\n\nApps\n----\n\nLoom 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.\n\nApps 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:\n\n  - **repo** (required): A Git URL of the repo that contains your app.\n  - **role** (required): The role that the app will be uploaded to.\n  - **build**: A script to run locally before uploading (e.g. to build static assets or install local dependencies).\n  - **post-upload**: A script to run on each server after uploading.\n  - **init**: The name of the Upstart script to start/restart after uploading.\n\nYou must also define a directory for your apps to live in with `env.app_root`.\n\nFor example, suppose this was your `fabfile.py`:\n\n    from fabric.api import *\n    from loom import app, puppet\n    from loom.tasks import *\n\n    env.user = 'root'\n    env.environment = 'prod'\n    env.roledefs = {\n        'web': ['prod-web-1.example.com', 'prod-web-2.example.com'],\n        'db': ['prod-db-1.example.com'],\n    }\n    env.app_root = '/home/ubuntu'\n    env.apps['web'] = {\n        \"repo\": \"https://user:pass@github.com/mycompany/mycompany-web.git\",\n        \"role\": \"web\",\n        \"build\": \"script/build\",\n        \"init\": \"web\",\n    }\n\nYou then need a `modules/roles/manifests/web.pp` that sets up `/etc/init/web.conf` to run your app in `/home/ubuntu/web`.\n\nTo deploy your app, run:\n\n    $ fab app.deploy:web\n\nThis will: \n\n  1. Pull your GitHub repository locally.\n  2. Run `script/build`.\n  3. Upload your code to `/home/ubuntu/web` on both `prod-app-1.example.com` and `prod-app-2.example.com`.\n  4. Run `sudo restart web`.\n\n\nOS support\n----------\n\nIt's only been tested on Ubuntu 12.04. I would like to support more things. Send patches!\n\nAPI\n---\n\nLook at the source for now. It's all Fabric tasks, and they're pretty easy to read. (Sorry.)\n\nRunning the tests\n-----------------\n\n    $ pip install -r dev-requirements.txt\n    $ script/test\n\nContributors\n------------\n * [Ben Firshman](https://fir.sh)\n * [Andreas Jansson](http://andreas.jansson.me.uk/)\n * [Steffen L. Norgren](http://github.com/xironix)\n * [Spencer Herzberg](https://github.com/sherzberg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfirsh%2Floom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbfirsh%2Floom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfirsh%2Floom/lists"}