{"id":18103282,"url":"https://github.com/emad-elsaid/capistrano-decompose","last_synced_at":"2025-04-13T19:20:48.977Z","repository":{"id":62554981,"uuid":"59864542","full_name":"emad-elsaid/capistrano-decompose","owner":"emad-elsaid","description":"Capistrano plugin to deploy your application inside docker containers with docker compose","archived":false,"fork":false,"pushed_at":"2023-04-17T09:48:38.000Z","size":20,"stargazers_count":17,"open_issues_count":0,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T16:16:00.761Z","etag":null,"topics":["capistrano","docker","rails"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emad-elsaid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-05-27T21:36:45.000Z","updated_at":"2023-09-27T11:04:31.000Z","dependencies_parsed_at":"2023-07-12T16:28:53.854Z","dependency_job_id":null,"html_url":"https://github.com/emad-elsaid/capistrano-decompose","commit_stats":null,"previous_names":["blazeeboy/capistrano-decompose"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Fcapistrano-decompose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Fcapistrano-decompose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Fcapistrano-decompose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Fcapistrano-decompose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emad-elsaid","download_url":"https://codeload.github.com/emad-elsaid/capistrano-decompose/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248766687,"owners_count":21158302,"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":["capistrano","docker","rails"],"created_at":"2024-10-31T22:11:20.422Z","updated_at":"2025-04-13T19:20:48.948Z","avatar_url":"https://github.com/emad-elsaid.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Capistrano::Decompose\n\n[![Gem Version](https://badge.fury.io/rb/capistrano-decompose.svg)](https://badge.fury.io/rb/capistrano-decompose)\n\nAdd tasks for capistrano to deploy with docker-compose.\n\n## Why?\n\nwhen I was working on my project [Who is popular today](https://www.whoispopulartoday.com) I had that problem that I have a VPS server and I need to isolate each of my apps to a separate environment so the solutions are pretty limited in here, it's Docker or LXC,\nI choose Docker and Docker-Compose as it's easier to get a set of disposable environments up and running in no time and link them to the host data directories which is what I needed, but there where not any kind of integeration with Capistrano to roll out new versions, so here is Capistrano-Decompose a Docker-Compose integeration with capistrano, I hope it solves your problem as it did to mine.\n\n## How it works\n\nAfter capistrano pull your repo and link it to the `current` directory, decompose will invoke `docker-compose build` to build your images and then run some rake tasks that you configured in your deployment with the key `decompose_rake_tasks`, you can add your rails tasks like `db:migration`, `assets:precompile`...etc here, then it will invoke `docker-compose up` or restart only the web service you specified in key `decompose_restart`, also you can use `cap \u003cenv\u003e decompose:run` to run any command inside a service, so anytime you need to invoke `rails console` inside you docker image on your server you can use `cap production decompose:run rails console`.\n\nAt the end decompose will delete the older images from remote server to keep the server clean.\n\n## Installation\n\nAdd this line to your Gemfile\n\n``` ruby\ngem 'capistrano-decompose'\n```\n\nAnd then execute:\n\n``` bash\n$ bundle\n```\n\nOr install it yourself as:\n\n``` bash\n$ gem install capistrano-decompose\n```\n\n## Usage\n\nAdd this line to your `Capfile`:\n\n``` ruby\nrequire 'capistrano/decompose\n```\n\n## Options for deployment\n\nYou can specify the following options in you `deploy.rb` script or the environment specific deploy file:\n\n* **decompose_restart**: An array of services that should be restarted each deployment, if not specified decompose will restart all services\n* **decompose_web_service**: The web service that will be used to execute commands inside like `rake` or any interactive command from `decompose:run`, default value: :web\n* **decompose_rake_tasks**: An array of rake tasks to execute after each deploy on the web_service or a Hash of `service_name =\u003e [task1, task2...]`, default value is `nil`\n\nFor a typical rails application the previous options should be as follows, given that the application container service name is `web`:\n\n```ruby\nset :decompose_restart, [:web]\nset :decompose_web_service, :web\nset :decompose_rake_tasks, ['db:migrate', 'assets:precompile']\nset :compose_file, \"docker-compose file name\"\n```\n\n## Defined Tasks\n\n```\ndecompose:build                # build docker-compose services\ndecompose:clean                # delete docker images that are not related to current build\ndecompose:down                 # shutdown all project services with docker-compose\ndecompose:rake_tasks           # execute a set of rake tasts inside the web container\ndecompose:restart              # restart services of docker-compose and if not services listed restart all services\ndecompose:run                  # run an interactive command inside the web container\ndecompose:up                   # boot up all docker-compose services\n```\n\n## After the first deployment of a rails application\n\nYou would need to setup your database by invoking the `db:setup` task to create and seed your database:\n\n* `cap production decompose:run rake db:setup`\n\n## General note\n\n* This gem doesn't provide a `dockerfile` nor `docker-compose.yml` file, you have to create these files yourself\n* The linked directories and files will not work and you should use docker data volumes anyway\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femad-elsaid%2Fcapistrano-decompose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femad-elsaid%2Fcapistrano-decompose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femad-elsaid%2Fcapistrano-decompose/lists"}