Menu
Docs / Deploying Your App

Deploying Your App

How to deploy your Rails application

Deploying Your App

How Ship It Squirrel deploys your Rails application, and what you need to know.

How deployments work

Ship It Squirrel uses a release-based deployment strategy (similar to Capistrano). Here's what happens when you click "Deploy":

  1. 1. Create release directory

    A new timestamped folder is created at /var/www/your-app/releases/20260121120000

  2. 2. Clone your repository

    Your code is cloned from GitHub into the release directory

  3. 3. Link shared files

    Config files (database.yml, master.key) and directories (logs, storage) are symlinked from the shared folder

  4. 4. Install dependencies

    bundle install and yarn install run to install your gems and packages

  5. 5. Compile assets

    rails assets:precompile builds your CSS and JavaScript

  6. 6. Run migrations

    rails db:migrate updates your database schema

  7. 7. Switch the symlink

    The current symlink is updated to point to the new release

  8. 8. Restart the app

    Puma is restarted via systemd to load your new code

Directory structure

After deployment, your app lives at:

/var/www/your-app/
├── current -> releases/20260121120000  # symlink to current release
├── releases/
│   ├── 20260121110000/                  # previous release
│   └── 20260121120000/                  # current release
└── shared/
    ├── config/
    │   ├── database.yml
    │   └── credentials/
    │       └── production.key
    ├── log/
    ├── storage/
    └── tmp/

Required configuration

Rails Master Key

Your config/credentials/production.key is required to decrypt your production credentials.

To find it:

cat config/credentials/production.key

Don't have one? Create production credentials:

EDITOR="code --wait" rails credentials:edit --environment production

Database configuration

Ship It Squirrel automatically generates a database.yml that uses the DATABASE_URL environment variable. Your database is automatically created with the name yourapp_production.

Environment variables

These environment variables are automatically set:

Variable Value
RAILS_ENV production
RACK_ENV production
DATABASE_URL postgres://localhost/yourapp_production
REDIS_URL redis://localhost:6379/0 (if enabled)
RAILS_LOG_TO_STDOUT true
RAILS_SERVE_STATIC_FILES true

Viewing logs

If you SSH into your server, you can view logs with:

journalctl -u yourapp-puma -f

Or check the log files directly:

tail -f /var/www/yourapp/shared/log/production.log

Rolling back

If something goes wrong, click the "Rollback" button on your app page. This switches the current symlink to the previous release and restarts the app.

Note: Rollback doesn't reverse database migrations. If your migration is not reversible, you may need to manually fix the database.

Zero-downtime deploys

Ship It Squirrel performs near-zero-downtime deploys by:

  1. Building the new release while the old one is still running
  2. Quickly swapping the symlink
  3. Gracefully restarting Puma

The actual downtime is typically less than a second.

Troubleshooting deploys

Check the Troubleshooting guide for common deployment issues.