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

    npm version License: MIT GitHub

    A powerful, free, Rust-based deployment tool for web applications that never requests network and enables one-click static frontend deployment to servers. Supports multiple environments and sub-environments with zero-downtime atomic deployments.

    Key Features

    • 🚀 Free and Open Source: No hidden costs, MIT licensed
    • 🦀 Built with Rust: Fast, reliable, and memory-safe
    • 🔒 No Network Requests: Works completely offline, ensuring security and privacy
    • One-Click Deployment: Upload static frontend packages to servers instantly
    • 🔄 Atomic Deployments: Zero-downtime deployments with automatic rollback
    • 🌍 Multi-Environment Support: Configure different environments (dev, staging, prod)
    • 📦 Sub-Environment Support: Deploy multiple apps to the same server
    • 🔑 Flexible Authentication: SSH key, password, or environment variable authentication
    • 📝 Detailed Logging: Comprehensive deployment logs for troubleshooting

    Installation

    npm install -g shipfe

    Quick Start

    1. Initialize your project:
    shipfe init
    1. Configure your deployment in shipfe.config.json

    2. Deploy:

    shipfe deploy --profile prod

    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
    
    # Deploy to all sub-environments
    shipfe deploy --profile dev --all-sub
    
    # Atomic deployment (creates releases/timestamp and updates current symlink)
    shipfe deploy --atomic

    Rollback Deployment

    # Rollback main environment
    shipfe rollback --profile prod --to 20260303_034945
    
    # Rollback sub-environment
    shipfe rollback --profile prod-admin --to 20260303_034945

    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"
        }
      }
    }
    
    ### Sub-environments
    
    For deploying multiple applications or different configurations to the same server, use sub-environments:
    
    ```json
    {
      "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",
          "sub_environments": {
            "admin": {
              "build_command": "npm run build:admin",
              "remote_deploy_path": "/var/www/dev/admin"
            },
            "shop": {
              "build_command": "npm run build:shop",
              "remote_deploy_path": "/var/www/dev/shop"
            },
            "cu": {
              "build_command": "npm run build:cu",
              "remote_deploy_path": "/var/www/dev/cu"
            }
          }
        }
      }
    }

    Deploy to sub-environments:

    shipfe deploy --profile dev-admin
    shipfe deploy --profile dev-shop
    shipfe deploy --profile dev-cu
    
    # Deploy to all sub-environments at once
    shipfe deploy --profile dev --all-sub

    Deploy all sub-environments at once

    shipfe deploy --profile dev --all-sub

    This will deploy to all sub-environments (admin, shop, cu) in sequence.

    Sub-environments inherit settings from the parent environment and can override build_command, local_dist_path, and remote_deploy_path.

    Atomic Deployment

    Shipfe supports atomic deployment to minimize downtime. When using --atomic, the deployment creates a timestamped release directory and updates a current symlink for zero-downtime switching.

    # Atomic deployment to default environment
    shipfe deploy --atomic
    
    # Atomic deployment to specific environment
    shipfe deploy --profile prod --atomic

    Directory Structure:

    remote_deploy_path/
    ├── releases/
    │   ├── 20260303_034945/
    │   ├── 20260303_035012/
    │   └── 20260303_035045/
    └── current -> releases/20260303_035045

    Your web server should serve from remote_deploy_path/current.

    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