Skip to content

Latest commit

 

History

History

simm

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@techbasejs/simm

npm version npm downloads

Một tool giúp triển khai các hệ thống lên môi trường production một cách đơn giản và nhanh chống.

Main Features

  • Triển khai ứng dụng thông qua SSH và Git

  • Kết nối máy chủ từ xa thông qua proxy hoặc bastion với proxyJump

  • Truyền các tệp, file thông qua giao thức SFTP (Secure File Transfer Protocol)

Install

# npm
npm install -g @techbasejs/simm@latest

# yarn
yarn add -g @techbasejs/simm@latest

# pnpm
pnpm install -g @techbasejs/simm@latest

Usage CLI

npx @techbasejs/simm deploy [environment]

Quick Usage

import fs from "node:fs";
import { defineConfig } from "@techbasejs/simm";

export default defineConfig({
  servers: {
    production: {
      user: "__USER__",
      host: "__HOST__",
      privateKey: "__PRIVATE_KEY__",
      passsword: "__PASSWORD__",
      deploy: {
        branch: "main",
        repo: `https://github.com/example/example.git`,
        path: "/home/_works/",
        postDeploy: "pnpm install && pnpm build",
      },
    },
  },
});

Start deploy

npx simm deploy production

Usage with proxyJump server

import fs from "node:fs";
import { defineConfig } from "@techbasejs/simm";

export default defineConfig({
  servers: {
    bastion: {
      user: "__USER__",
      host: "__HOST__",
      privateKey: "__PRIVATE_KEY__",
      passsword: "__PASSWORD__",
    },
    production: {
      user: "__USER__",
      host: "__HOST__",
      privateKey: "__PRIVATE_KEY__",
      passsword: "__PASSWORD__",
      proxyJump: "bastion",
      deploy: {
        branch: "main",
        repo: `https://github.com/example/example.git`,
        path: "/home/_works/",
        postDeploy: "pnpm install && pnpm build",
      },
    },
  },
});

Sftp (beta)

import { defineConfig } from "@techbasejs/simm";

export default defineConfig({
  servers: {
    production: {
      user: "__USER__",
      host: "__HOST__",
      privateKey: "__PRIVATE_KEY__",
      passsword: "__PASSWORD__",
      sftp: {
        preSftp: "pnpm build",
        source: "/home/local/source",
        dest: "/home/remote/source",
        postSftp: "systemctl restart nginx",
      },
      // proxyJump: 'bastion', when use proxyJump to a bastion server
    },
  },
});