JSPM

  • Created
  • Published
  • Downloads 67
  • Score
    100M100P100Q73271F
  • License MIT

A deployment tool for web applications

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (shipfe) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Shipfe

    A powerful deployment tool for web applications with support for multiple environments and sub-environments.

    Installation

    npm install -g shipfe

    Usage

    Initialize project

    shipfe init

    Deploy to environment

    # Deploy to default environment
    shipfe deploy
    
    # Deploy to specific environment
    shipfe deploy --profile dev
    
    # Deploy to sub-environment
    shipfe deploy --profile dev-admin

    Configuration

    Edit shipfe.config.json to configure your deployment settings:

    {
      "environments": {
        "dev": {
          "build_command": "npm run build",
          "local_dist_path": "./dist",
          "servers": [
            {
              "host": "dev.example.com",
              "port": 22,
              "username": "deploy",
              "remote_deploy_path": "/var/www/dev",
              "delete_old": false
            }
          ],
          "remote_tmp": "/tmp"
        }
      }
    }

    Authentication Options

    Each server can have its own authentication method. Shipfe tries authentication methods in this order:

    1. Password (if password is set in server config)
    2. SSH Private Key from environment (if SSH_PRIVATE_KEY env var is set)
    3. SSH Key file (if key_path is set in server config)

    Example with multiple servers using different auth methods:

    {
      "environments": {
        "prod": {
          "build_command": "npm run build",
          "local_dist_path": "./dist",
          "servers": [
            {
              "host": "web1.prod.com",
              "port": 22,
              "username": "deploy",
              "password": "web1_password",
              "remote_deploy_path": "/var/www/prod",
              "delete_old": false
            },
            {
              "host": "web2.prod.com",
              "port": 22,
              "username": "deploy",
              "key_path": "/home/user/.ssh/web2_key",
              "remote_deploy_path": "/var/www/prod",
              "delete_old": false
            },
            {
              "host": "web3.prod.com",
              "port": 22,
              "username": "deploy",
              "key_path": "/home/user/.ssh/web3_key",
              "remote_deploy_path": "/var/www/prod",
              "delete_old": false
            }
          ],
          "remote_tmp": "/tmp"
        }
      }
    }

    In this example:

    • web1.prod.com uses password authentication
    • web2.prod.com uses SSH key file /home/user/.ssh/web2_key
    • web3.prod.com uses SSH key file /home/user/.ssh/web3_key

    Or use environment variable for all servers:

    export SSH_PRIVATE_KEY="$(cat ~/.ssh/prod_key)"
    shipfe deploy --profile prod

    Authentication

    Shipfe supports multiple SSH authentication methods for each server individually. For each server, authentication methods are tried in this order:

    1. Password authentication: If password is set in that server's config
    2. SSH Private Key from environment: If SSH_PRIVATE_KEY environment variable is set (applies to all servers)
    3. SSH Key file: If key_path is set in that server's config

    Usage Examples:

    # Each server can use different authentication
    shipfe deploy --profile prod
    
    # Or override with environment variable for all servers
    export SSH_PRIVATE_KEY="$(cat ~/.ssh/prod_key)"
    shipfe deploy --profile prod

    SSH Key Setup for Individual Servers:

    1. Generate SSH key pairs for each server:

      # For server 1
      ssh-keygen -t rsa -b 4096 -f ~/.ssh/server1_key -C "server1"
      
      # For server 2
      ssh-keygen -t rsa -b 4096 -f ~/.ssh/server2_key -C "server2"
    2. Copy public keys to respective servers:

      ssh-copy-id -i ~/.ssh/server1_key.pub user@server1.com
      ssh-copy-id -i ~/.ssh/server2_key.pub user@server2.com
    3. Configure shipfe with server-specific keys:

      {
        "servers": [
          {
            "host": "server1.com",
            "key_path": "~/.ssh/server1_key"
          },
          {
            "host": "server2.com",
            "key_path": "~/.ssh/server2_key"
          }
        ]
      }

    Features

    • Multiple environment support
    • Sub-environment configuration
    • Custom build commands
    • SSH-based deployment
    • Automatic backup and rollback
    • Detailed logging

    License

    MIT