Skip to content

seuros/capistrano-example-app

Repository files navigation

Capistrano Example App

A minimal Rails 8.0 application demonstrating deployment with Capistrano, Puma, and Sidekiq using systemd.

Overview

This example application shows best practices for deploying Ruby on Rails applications with:

  • Capistrano 3 for deployment automation
  • Puma 6 as the web server
  • Sidekiq 7 for background job processing
  • Systemd for service management
  • rbenv for Ruby version management

Requirements

  • Ruby 3.4.4
  • Rails 8.0.0
  • Redis 7.0+ (required for Sidekiq 7.0)
  • PostgreSQL 14+

Quick Start

  1. Clone the repository:
git clone https://github.com/seuros/capistrano-example-app.git
cd capistrano-example-app
  1. Install dependencies:
bundle install
  1. Configure deployment servers:
# Create .env file with your server details
cat > .env << EOF
TESTING_SERVER=your.server.ip       # Primary server
TESTING_SERVER2=your.server2.ip     # Optional: second server for workers
EOF
  1. Deploy:
# Check deployment configuration
cap production deploy:check

# Install systemd services (first time only)
cap production puma:install
cap production sidekiq:install

# Deploy application
cap production deploy

Documentation

See DEPLOYMENT_GUIDE.md for comprehensive deployment instructions including:

  • Detailed server setup
  • rbenv and Ruby installation
  • Redis 7+ installation
  • Nginx configuration
  • Troubleshooting guide
  • Performance tuning tips

Testing Infrastructure

This repository includes Terraform configuration for quickly spinning up test servers on Hetzner Cloud:

cd terraform
./deploy_test.sh

Related Projects

This example app demonstrates the usage of:

Notes

  • Currently tested on Ubuntu 22.04 LTS
  • Requires Redis 7.0+ for Sidekiq 7.0 compatibility
  • Uses user-level systemd services for better security
  • Pull requests welcome for other OS support

License

MIT License

About

Example app how to use Capistrano gems.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •