{"id":20199259,"url":"https://github.com/vifreefly/capistrano-procsd","last_synced_at":"2025-04-10T11:08:43.531Z","repository":{"id":49242428,"uuid":"156783421","full_name":"vifreefly/capistrano-procsd","owner":"vifreefly","description":"Capistrano integration for Procsd","archived":false,"fork":false,"pushed_at":"2018-11-28T10:38:57.000Z","size":11,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-26T13:03:41.488Z","etag":null,"topics":["capistrano","deployment","procsd","systemd"],"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/vifreefly.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-08T23:41:29.000Z","updated_at":"2020-07-09T18:21:17.000Z","dependencies_parsed_at":"2022-09-13T11:01:02.599Z","dependency_job_id":null,"html_url":"https://github.com/vifreefly/capistrano-procsd","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vifreefly%2Fcapistrano-procsd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vifreefly%2Fcapistrano-procsd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vifreefly%2Fcapistrano-procsd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vifreefly%2Fcapistrano-procsd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vifreefly","download_url":"https://codeload.github.com/vifreefly/capistrano-procsd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208549,"owners_count":21065202,"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","deployment","procsd","systemd"],"created_at":"2024-11-14T04:36:40.804Z","updated_at":"2025-04-10T11:08:43.514Z","avatar_url":"https://github.com/vifreefly.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Capistrano::Procsd\n\nCapistrano integration for [Procsd](https://github.com/vifreefly/procsd). All available tasks:\n\n```\ncap procsd:create[arguments]       # Create app services\ncap procsd:create_or_restart       # Create or restart (if already created) app services\ncap procsd:destroy                 # Destroy app services\ncap procsd:list                    # List all services\ncap procsd:logs[arguments]         # Check app services logs\ncap procsd:restart                 # Restart app services\ncap procsd:run[cmd]                # Run command on the remote server\ncap procsd:start                   # Start app services\ncap procsd:status[arguments]       # Check status of app services\ncap procsd:stop                    # Stop app services\n```\n\n## Configuration\n\nAdd to your application `Gemfile` somewhere:\n\n```ruby\n# Gemfile\n\ngroup :development do\n  gem 'capistrano-procsd', require: false\nend\n```\n\nRequire procsd tasks inside `Capfile`:\n\n```ruby\n# Capfile\n\nrequire 'capistrano/procsd'\n```\n\nAnd finally add hook to call `procsd:create_or_restart` task each time after [publishing](https://capistranorb.com/documentation/getting-started/flow/):\n\n```ruby\n# config/deploy.rb\n\nafter \"deploy:published\", \"procsd:create_or_restart\"\n```\n\nDone!\n\n### Procsd location on the remote server\n#### System-wide\n\nConfiguration above assumes that you have `$ procsd` executable somewhere in the global system path on your remote server. You can install gem system-wide this way:\n\n```bash\n# Install ruby system-wide from apt repositories:\n$ sudo apt install ruby\n\n# Install procsd gem system-wide:\n$ sudo gem install procsd\n\n# Check the procsd installed path:\n$ sudo which procsd\n/usr/local/bin/procsd\n```\n\u003e Like you see, Procsd installed to the system bin path /usr/local/bin/ and can be accessed from any user and kind of connection (including default Capistrano non-interactive, non-login ssh connection)\n\n#### Local user installation using Rbenv\n\nThere is another way if you don't want to install Ruby system-wide for some reason and use [Rbenv](https://github.com/rbenv/rbenv) instead:\n\nAdd `procsd` gem to your application Gemfile:\n\n```ruby\n# Gemfile\n\ngroup :development do\n  # You're probably already have it\n  gem 'capistrano-rbenv', require: false\n  gem 'capistrano-bundler', require: false\nend\n\n# Add procsd gem\ngem 'procsd', require: false\n```\n\nRequire `capistrano/rbenv` and `capistrano/bundler` inside Capfile (if not required yet):\n\n```ruby\n# Capfile\n\nrequire 'capistrano/rbenv'\nrequire 'capistrano/bundler'\n```\n\nAnd finally add `procsd` to rbenv and bundle bins:\n\n```ruby\n# config/deploy.rb\n\nappend :rbenv_map_bins, \"procsd\"\nappend :bundle_bins, \"procsd\"\n```\n\n## Usage\n\nAt the first deploy `$ bundle exec cap production deploy` app services will be created and started. You will be prompted to fill in remote user password (make sure that your deploy user added to the sudo group `adduser deploy sudo`).\n\n### Start/Stop/Restart services without sudo password\n\nIf you don't want to type password each time while deploying, you can add start/stop/restart commands to the sudoers file:\n\n1. Login to the remote server, `cd` into application folder, and type `$ procsd config sudoers`. Example:\n\n```\ndeploy@server:~/sample_app/current$ procsd config sudoers\n\ndeploy ALL=NOPASSWD: /bin/systemctl start sample_app.target, /bin/systemctl stop sample_app.target, /bin/systemctl restart sample_app.target\n```\n\n2. Copy sudoers rule from above to the sudoers file (just type `$ sudo visudo` and paste line at the bottom then save and exit). Logout from the server.\n\nNow try to call restart task `$ bundle exec cap production procsd:restart`. If all is fine, task will execute without password prompt.\n\n\n**Note: steps above can be done automatically as well:**\n\n```ruby\n# config/deploy.rb\n\n# pass `--add-to-sudoers` option to the `procsd create` command:\nset :procsd_sudoers_at_create_or_restart, true\n```\n\nNow sudoers rule will be added at the first deploy automatically.\n\n## Examples\n\n* `bundle exec cap production procsd:logs[-t]` - Tail application logs\n* `bundle exec cap production procsd:run[bash]` - `ssh` into app server, `cd` into app directory and leave the bash session open\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvifreefly%2Fcapistrano-procsd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvifreefly%2Fcapistrano-procsd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvifreefly%2Fcapistrano-procsd/lists"}