{"id":24502769,"url":"https://github.com/sul-dlss/dlss-capistrano-docker","last_synced_at":"2025-07-29T15:10:29.731Z","repository":{"id":60371286,"uuid":"540504394","full_name":"sul-dlss/dlss-capistrano-docker","owner":"sul-dlss","description":"Capistrano extensions for DLSS docker deployments","archived":false,"fork":false,"pushed_at":"2025-07-21T17:38:00.000Z","size":141,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-07-27T14:26:17.188Z","etag":null,"topics":["deployment","gem","infrastructure"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sul-dlss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-23T15:28:18.000Z","updated_at":"2025-07-21T17:38:02.000Z","dependencies_parsed_at":"2023-02-10T05:16:02.493Z","dependency_job_id":"4d6189c0-8c0d-4576-b1d3-13e06ddb5cfd","html_url":"https://github.com/sul-dlss/dlss-capistrano-docker","commit_stats":{"total_commits":30,"total_committers":4,"mean_commits":7.5,"dds":"0.33333333333333337","last_synced_commit":"f55cff2cca16dd6d37782718a90c43e599dbab39"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/sul-dlss/dlss-capistrano-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sul-dlss%2Fdlss-capistrano-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sul-dlss%2Fdlss-capistrano-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sul-dlss%2Fdlss-capistrano-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sul-dlss%2Fdlss-capistrano-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sul-dlss","download_url":"https://codeload.github.com/sul-dlss/dlss-capistrano-docker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sul-dlss%2Fdlss-capistrano-docker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267706260,"owners_count":24131094,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","gem","infrastructure"],"created_at":"2025-01-21T23:13:52.495Z","updated_at":"2025-07-29T15:10:29.678Z","avatar_url":"https://github.com/sul-dlss.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dlss-capistrano-docker\n\n[![Gem Version](https://badge.fury.io/rb/dlss-capistrano-docker.svg)](https://badge.fury.io/rb/dlss-capistrano-docker)\n[![CircleCI](https://circleci.com/gh/sul-dlss/dlss-capistrano-docker.svg?style=svg)](https://circleci.com/gh/sul-dlss/dlss-capistrano-docker)\n\n\nThis gem provides Capistrano Docker deployment tasks used by Stanford Libraries' Digital Library Systems and Services group.\n\nIt requires that the services to be run on a server be specified by a docker compose configuration file.\n\n## Included Tasks\n* `ssh`: establishes an SSH connection to the host running in environment, and changes into the current deployment directory.\n* `ssh_check`: establishes an SSH connection to all app servers running prints environment information to confirm the connection was made. (This is used by sdr-deploy to check SSH connections can be made in bulk before proceeding with a mass deploy.)\n* `honeybadger:notify`: notifies Honeybadger of deploy using curl (thus, ruby is not required on host).\n* `docker:login`: log into Docker Hub. Logging in is required to avoid strict image download limits.\n* `docker:logout`: log out of Docker Hub.\n* `docker:prune`: prune docker artifacts to avoid filling disk space.\n* `docker_compose:migrate`: migrate the database.\n* `docker_compose:seed`: seed the database.\n* `docker_compose:build`: build images for the services.\n* `docker_compose:setup_rabbit`: create channel, queues, etc for RabbitMQ.\n* `docker_compose:restart`: down then up services.\n* `docker_compose:up`: start services.\n* `docker_compose:down`: tear down services.\n* `docker_compose:copy_assets`: copy assets from a container to the server so they can be served by Apache.\n* `docker_compose:dereference_linked_files`: turn linked files into actual files.\n* `docker_compose:dereference_linked_dirs`: turn linked directories into actual directories containing actual files.\n\n## Hooks\nHooks into the Capistrano lifecycle are provided for most of these tasks. These hooks can be controlled with variables, e.g., `docker_hub_use_hooks` to control the hooks for `docker:login` and `docker:logout`.\n\nIn addition to tasks included in this gem, a hook is provided for `shared_configs:update`.\n\n## Usage\nFor an example of any of the following, see https://github.com/sul-dlss/happy-heron\n\n### `Gemfile`\n* Add `gem 'dlss-capistrano-docker', require: false` to the deployment group.\n* Remove any gems that are removed from `Capfile` below.\n* Move puma gem from development/test dependencies to the application dependencies. (Puma will be used as the application server instead of Passenger.)\n\n### `Capfile`\n* Remove any of the following:\n```\nrequire 'capistrano/bundler'\nrequire 'capistrano/rails'\nrequire 'capistrano/honeybadger'\nrequire 'capistrano/passenger'\nrequire 'whenever/capistrano'\nrequire 'dlss/capistrano'\n```\n* Add `require 'dlss/docker/capistrano`\n\n### `config/deploy.rb`\n* For `:linked_files` remove `config/database.yml` and `config/secrets.yml` if present. Both of these will be provided by environment variables.\n* For `:linked_dirs` remove `tmp/pids`, `tmp/cache`, `tmp/sockets` if present. `log`, `config/settings`, and, `public/system` should remain. (`public/system` is necessary for Capistrano::Maintenance.)\n* Remove any sidekiq, sneakers, passenger, whenever, or shared_configs related settings.\n* Add `set :docker_compose_file, 'docker-compose.prod.yml'` to reference the production docker-compose file.\n* Optionally, add `set :docker_compose_seed_use_hooks, true` to perform seeding.\n* Optionally, add `set :docker_compose_rabbitmq_use_hooks, true` to perform Rabbitmq setup.\n* Note that there are other settings supported by this gem for additional configuration.\n\n### `config/deploy/\u003cenvironment\u003e.rb`\n* Each server should have the `app` role and any roles that correspond with profiles in the docker-compose file. This is what controls what services are run on the server.\n\n### `config/puma.rb`\n* Change `RAILS_MAX_THREAD` to `PUMA_MAX_THREAD` and `RAILS_MIN_THREAD` to `PUMA_MIN_THREAD`.\n* Enable workers with `workers ENV.fetch('PUMA_WORKERS', 2)`\n* Enable preload with `preload_app!`.\n\n### `config/schedule.rb`\n* Add `set :job_template, nil` to execute with sh instead of bash.\n\n### `Dockerfile`\n* When possible, base the image on Alpine (e.g., `FROM ruby:3.1-alpine`).\n* Processes should run as the application user (e.g., `h2`) not root, with user id and group id set to match the server.\n* If using Whenever, install Supercronic (which does not have to run as root) and write the crontab file during the build with `RUN sh -c 'bundle exec whenever . | tee -a config/crontab'`.\n* When possible, write to both a log file and stdout.\n* Precompile assets (`RUN bin/rails assets:precompile`) as part of the build. `SECRET_KEY_BASE` will need to be available for precompiling.\n\n### `docker-compose.prod.yml`\n* Duplicate configuration can be shared with fragments (e.g., `\u0026environment` / `*environment`).\n* The command for a container can be overridden with `command:`, e.g., `command: bin/bundle exec rake sneakers:run 2\u003e\u00261 | tee -a log/sneakers.log`.\n* Each service should be assigned to one or more profiles. These correspond to capistrano roles. For example:\n```\nprofiles:\n  - cron\n```\n* Containers should link in the shared logs directory. For example:\n```\nvolumes:\n  - /opt/app/h2/happy-heron/shared/log:/app/log\n```\n* Environment variables provided by the server should be passed through to the container. For example:\n```\nenvironment:\n - HONEYBADGER_API_KEY\n```\n\n### `.dockerignore`\nIgnore `public.assets`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsul-dlss%2Fdlss-capistrano-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsul-dlss%2Fdlss-capistrano-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsul-dlss%2Fdlss-capistrano-docker/lists"}