LogoLogo
HomeAPIBlog
3.0.0-SNAPSHOT
3.0.0-SNAPSHOT
  • INTRODUCTION
    • Getting Started
      • Running Local Development Servers
      • Beginner Tutorial: Hello World
      • Beginner Tutorial: Hello Database
      • Tutorial: Wheels, AJAX, and You
    • Frameworks and Wheels
    • Requirements
    • Manual Installation
    • Upgrading
    • Screencasts
  • Command Line Tools
    • CLI Overview
    • Quick Start Guide
    • Command Reference
      • Core Commands
        • wheels init
        • wheels info
        • wheels reload
        • wheels deps
        • wheels destroy
        • wheels watch
      • Code Generation
        • wheels generate app
        • wheels generate app-wizard
        • wheels generate controller
        • wheels generate model
        • wheels generate view
        • wheels generate property
        • wheels generate route
        • wheels generate resource
        • wheels generate api-resource
        • wheels generate frontend
        • wheels generate test
        • wheels generate snippets
        • wheels scaffold
      • Database Commands
        • wheels dbmigrate info
        • wheels dbmigrate latest
        • wheels dbmigrate up
        • wheels dbmigrate down
        • wheels dbmigrate reset
        • wheels dbmigrate exec
        • wheels dbmigrate create blank
        • wheels dbmigrate create table
        • wheels dbmigrate create column
        • wheels dbmigrate remove table
        • wheels db schema
        • wheels db seed
      • Testing Commands
        • wheels test
        • wheels test run
        • wheels test coverage
        • wheels test debug
      • Configuration Commands
        • wheels config list
        • wheels config set
        • wheels config env
      • Environment Management
        • wheels env
        • wheels env setup
        • wheels env list
        • wheels env switch
      • Plugin Management
        • wheels plugins
        • wheels plugins list
        • wheels plugins install
        • wheels plugins remove
      • Code Analysis
        • wheels analyze
        • wheels analyze code
        • wheels analyze performance
        • wheels analyze security
      • Security Commands
        • wheels security
        • wheels security scan
      • Performance Commands
        • wheels optimize
        • wheels optimize performance
      • Documentation Commands
        • wheels docs
        • wheels docs generate
        • wheels docs serve
      • CI/CD Commands
        • wheels ci init
      • Docker Commands
        • wheels docker init
        • wheels docker deploy
      • Deployment Commands
        • wheels deploy
        • wheels deploy audit
        • wheels deploy exec
        • wheels deploy hooks
        • wheels deploy init
        • wheels deploy lock
        • wheels deploy logs
        • wheels deploy proxy
        • wheels deploy push
        • wheels deploy rollback
        • wheels deploy secrets
        • wheels deploy setup
        • wheels deploy status
        • wheels deploy stop
    • CLI Development Guides
      • Creating Commands
      • Service Architecture
      • Migrations Guide
      • Testing Guide
  • Working with Wheels
    • Conventions
    • Configuration and Defaults
    • Directory Structure
    • Switching Environments
    • Testing Your Application
    • Using the Test Environment
    • Contributing to Wheels
    • Submitting Pull Requests
    • Documenting your Code
  • Handling Requests with Controllers
    • Request Handling
    • Rendering Content
    • Redirecting Users
    • Sending Files
    • Sending Email
    • Responding with Multiple Formats
    • Using the Flash
    • Using Filters
    • Verification
    • Event Handlers
    • Routing
    • URL Rewriting
      • Apache
      • IIS
      • Tomcat
      • Nginx
    • Obfuscating URLs
    • Caching
    • Nesting Controllers
    • CORS Requests
  • Displaying Views to Users
    • Pages
    • Partials
    • Linking Pages
    • Layouts
    • Form Helpers and Showing Errors
    • Displaying Links for Pagination
    • Date, Media, and Text Helpers
    • Creating Custom View Helpers
    • Localization
  • Database Interaction Through Models
    • Object Relational Mapping
    • Creating Records
    • Reading Records
    • Updating Records
    • Deleting Records
    • Column Statistics
    • Dynamic Finders
    • Getting Paginated Data
    • Associations
    • Nested Properties
    • Object Validation
    • Object Callbacks
    • Calculated Properties
    • Transactions
    • Dirty Records
    • Soft Delete
    • Automatic Time Stamps
    • Database Migrations
      • Migrations in Production
    • Using Multiple Data Sources
  • Plugins
    • Installing and Using Plugins
    • Developing Plugins
    • Publishing Plugins
  • Project Documentation
    • Overview
  • External Links
    • Source Code
    • Issue Tracker
    • Sponsor Us
    • Community
Powered by GitBook
LogoLogo
On this page
  • Synopsis
  • Description
  • Arguments
  • Options
  • Examples
  • Interactive initialization
  • Initialize production target
  • Initialize with Git deployment
  • Initialize Docker deployment
  • Initialize with specific strategy
  • What It Does
  • Configuration Structure
  • Deployment Types
  • SSH Deployment
  • FTP Deployment
  • Git Deployment
  • Docker Deployment
  • Shared Resources
  • Deployment Hooks
  • Pre-deployment
  • Post-deployment
  • Rollback
  • Interactive Mode
  • Security Considerations
  • Use Cases
  • Notes
  • See Also

Was this helpful?

Edit on GitHub
Export as PDF
  1. Command Line Tools
  2. Command Reference
  3. Deployment Commands

wheels deploy init

Initialize deployment configuration for your Wheels application.

Synopsis

wheels deploy init [target] [options]

Description

The wheels deploy init command creates and configures deployment settings for your Wheels application. It generates deployment configuration files and sets up target environments.

Arguments

Argument
Description
Default

target

Deployment target name (production, staging, dev)

Interactive prompt

Options

Option
Description
Default

--type

Deployment type (ssh, ftp, rsync, git, docker)

ssh

--host

Target host or server

Interactive prompt

--port

Connection port

22 (SSH), 21 (FTP)

--path

Remote deployment path

/var/www/html

--user

Remote user

Current user

--branch

Git branch to deploy

main

--strategy

Deployment strategy (rolling, blue-green, canary)

rolling

--keep-releases

Number of releases to keep

5

--force

Overwrite existing configuration

false

--help

Show help information

Examples

Interactive initialization

wheels deploy init

Initialize production target

wheels deploy init production --host=prod.example.com --path=/var/www/app

Initialize with Git deployment

wheels deploy init staging --type=git --branch=develop

Initialize Docker deployment

wheels deploy init production --type=docker --host=swarm.example.com

Initialize with specific strategy

wheels deploy init production --strategy=blue-green --keep-releases=3

What It Does

  1. Creates deployment configuration:

    • .wheels-deploy.json in project root

    • Target-specific settings

    • Deployment credentials (encrypted)

  2. Sets up deployment structure:

    • Release directories

    • Shared directories (uploads, logs)

    • Symbolic links

  3. Configures deployment hooks:

    • Pre-deployment tasks

    • Post-deployment tasks

    • Rollback procedures

  4. Validates configuration:

    • Tests connection to target

    • Verifies permissions

    • Checks dependencies

Configuration Structure

Generated .wheels-deploy.json:

{
  "version": "1.0",
  "targets": {
    "production": {
      "type": "ssh",
      "host": "prod.example.com",
      "port": 22,
      "user": "deploy",
      "path": "/var/www/app",
      "branch": "main",
      "strategy": "rolling",
      "keepReleases": 5,
      "shared": {
        "dirs": ["logs", "uploads", "temp"],
        "files": [".env", "config/production.json"]
      },
      "hooks": {
        "pre-deploy": [
          "npm run build",
          "box install --production"
        ],
        "post-deploy": [
          "wheels dbmigrate latest",
          "wheels reload production",
          "npm run cache:clear"
        ],
        "rollback": [
          "wheels reload production"
        ]
      },
      "exclude": [
        ".git",
        ".gitignore",
        "node_modules",
        "tests",
        "*.log"
      ]
    }
  },
  "defaults": {
    "timeout": 300,
    "retries": 3,
    "notifications": {
      "slack": {
        "webhook": "https://hooks.slack.com/..."
      }
    }
  }
}

Deployment Types

SSH Deployment

  • Secure shell access

  • Rsync for file transfer

  • Full control over deployment

FTP Deployment

  • Legacy support

  • Simple file transfer

  • Limited automation

Git Deployment

  • Git-based workflows

  • Post-receive hooks

  • Version control integration

Docker Deployment

  • Container orchestration

  • Image-based deployment

  • Scalable infrastructure

Shared Resources

Shared directories and files persist across deployments:

  • Directories: User uploads, logs, cache

  • Files: Environment configs, secrets

Deployment Hooks

Pre-deployment

  • Build assets

  • Run tests

  • Backup database

Post-deployment

  • Run migrations

  • Clear caches

  • Restart services

  • Send notifications

Rollback

  • Restore previous release

  • Revert database

  • Clear caches

Interactive Mode

When run without arguments, the command enters interactive mode:

? Select deployment target: (Use arrow keys)
❯ production
  staging
  development
  + Add new target

? Deployment type: (Use arrow keys)
❯ SSH (Recommended)
  Git
  Docker
  FTP

? Target host: prod.example.com
? Remote path: /var/www/app
? Remote user: deploy

Security Considerations

  1. Credentials: Stored encrypted in config

  2. SSH Keys: Recommended over passwords

  3. Permissions: Least privilege principle

  4. Secrets: Use environment variables

Use Cases

  1. New Project: Set up deployment pipeline

  2. Migration: Move from manual to automated deployment

  3. Multi-Environment: Configure staging and production

  4. Team Setup: Share deployment configuration

Notes

  • Run from project root directory

  • Requires appropriate server access

  • Test with staging environment first

  • Back up existing configuration before overwriting

See Also

Previouswheels deploy hooksNextwheels deploy lock

Last updated 2 days ago

Was this helpful?

- Deployment overview

- Setup deployment environment

- Execute deployment

- Manage secrets

wheels deploy
wheels deploy setup
wheels deploy exec
wheels deploy secrets