electionleaflets icon indicating copy to clipboard operation
electionleaflets copied to clipboard

Upgrade Ruby to 3.2.3 and Capistrano to v3 with automated deployment

Open Copilot opened this issue 4 months ago • 3 comments

This PR upgrades the Ruby deployment infrastructure from legacy versions to current stable releases and adds automated deployment capabilities.

Changes

Ruby and Capistrano Upgrades

  • Ruby: Upgraded from 2.7.6 (EOL) to 3.2.3 (current stable)
  • Capistrano: Upgraded from v2.15.5 to v3.19.2 (current stable)

Capistrano Migration

The deployment configuration has been fully migrated from Capistrano 2 to Capistrano 3 format:

  • Converted Capfile to use modern Capistrano 3 DSL
  • Created config/deploy.rb with main deployment configuration
  • Split stage configurations into separate files:
    • config/deploy/production.rb - deploys master branch to /srv/www/production
    • config/deploy/test.rb - deploys test branch to /srv/www/staging
    • config/deploy/development.rb - development deployment configuration
  • Preserved all existing custom deployment tasks (symlink_configuration, setup_db, restart)
  • Configured linked files and directories for shared resources (config, data, Django settings)

Automated Dependency Management

Added Dependabot configuration (.github/dependabot.yml) for automatic dependency updates:

  • Weekly checks for bundler dependencies
  • Automatically creates PRs for gem updates
  • Helps maintain security and compatibility

Continuous Deployment

Added GitHub Actions workflow (.github/workflows/deploy.yml) for automated deployments:

  • Pushes to master branch automatically deploy to production
  • Pushes to test branch automatically deploy to staging
  • Manual deployment trigger available via workflow_dispatch
  • Uses DEPLOY_SSH_KEY repository secret for SSH authentication

Documentation

Updated README.md with comprehensive deployment instructions including:

  • How to deploy manually using Capistrano commands
  • Continuous deployment workflow explanation
  • Required setup for SSH key configuration

Usage

Manual deployment:

bundle install
bundle exec cap production deploy  # Deploy to production
bundle exec cap test deploy        # Deploy to staging

Automated deployment:

  • Simply push to master or test branches, and GitHub Actions handles the rest

Prerequisites for Deployment

The repository maintainers need to add the DEPLOY_SSH_KEY secret to the repository settings containing the SSH private key for the deploy user. This enables GitHub Actions to authenticate with the deployment servers.

Testing

The Capistrano configuration has been tested locally with dry-runs to verify:

  • All three stages (production, test, development) are properly configured
  • Git repository connectivity checks pass
  • Directory structure and symlink configurations are correct
  • Custom deployment tasks are preserved and functional

Fixes #[issue_number]

Original prompt

This section details on the original issue you should resolve

<issue_title>Upgrade to ruby parts of electionleaflets (capistrano deploy only)</issue_title> <issue_description>- [ ] Ruby is only used for deploy

  • [ ] Upgrade to more recent capistrano, and current stable Ruby version
  • [ ] Set up dependabot
  • [ ] set up Continuous deployment </issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes openaustralia/electionleaflets#265

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Oct 06 '25 21:10 Copilot

i was curious ....

Br3nda avatar Oct 06 '25 21:10 Br3nda

@copilot who owns the copyright on this change?

Br3nda avatar Oct 13 '25 19:10 Br3nda

@copilot who owns the copyright on this change?

The copyright for these changes belongs to the contributors who made the commits. Based on the Git commit metadata, the changes are attributed to the commit authors. GitHub Copilot assisted in generating the code, but the copyright belongs to you (the repository owners/contributors) who are making the commits to your repository. The Co-authored-by trailer in the commits indicates @Br3nda as a co-author.

If you have specific copyright or licensing concerns for this project, you may want to ensure the repository has appropriate license files (like LICENSE or COPYING) that define the terms for all contributions.

Copilot avatar Oct 13 '25 19:10 Copilot