Burguer - deployment tool
Install
Install with yarn
yarn add -D burguer
Install with npm
npm install -D burguer
Example (cli)
Create deploy.yml
config:local: .remote: /var/wwwhost: hostnameusername: www-dataprivateKey: ~/.ssh/private-keycommands:- connect- push: index.js- push: package.json- remote: yarn install- disconnect
Run with yarn
yarn burguer deploy.yml
Run with npx
npx burguer deploy.yml
Example (library)
Create deploy.js
const Burguer ={const burguer =local: '.'remote: '/var/www'host: 'hostname'username: 'www-data'privateKey: '~/.ssh/private-key'await burguerawait burguerawait burguerawait burguerburguer}
Run with node
node deploy.js
API
// description: create a new Burguer instance: Burguer// description: connect to the ssh server// requires: BuguerConfig.host, BuguerConfig.username, BuguerConfig.privateKeyBurguer: Promise// description: disconnect from the ssh server// requires: Buguer.connect()Burguer// description: push a file from the local cwd to the remote cwd// requires: Buguer.connect(), BurguerConfig.local, BurguerConfig.remote// params:// - local: path relative to the local cwd (current working directory)// - remote: path relative to the remote cwd (current working directory). Same as local, if not setBurguer: Promise// description: pull a file from the remote cwd to the local cwd// requires: Buguer.connect(), BurguerConfig.local, BurguerConfig.remote// params:// - remote: path relative to the remote cwd (current working directory)// - local: path relative to the local cwd (current working directory). Same as remote, if not setBurguer: Promise// description: execute a command in the local shell// requires: BurguerConfig.local// optional: BurguerConfig.localShell, BurguerConfig.localShellArgs// params:// - command: the command path and arguments. e.g. echo hello world// - options:// - cwd: current working directory// - exitCode: the command expected exit code. default: 0// returns: stdout, stderr and exit code from the commandBurguer: Promise<BurguerResult>// description: change the local cwd (current working directory)Burguerlocal// description: execute a command in the remote shell// requires: Buguer.connect(), BurguerConfig.remote// optional: BurguerConfig.remoteShell, BurguerConfig.remoteShellArgs// params:// - command: the command path and arguments. e.g. echo hello world// - options:// - cwd: current working directory// - exitCode: the command expected exit code. default: 0// returns: stdout, stderr and exit code from the commandBurguer: Promise<BurguerResult>// description: change the remote cwd (current working directory)BurguerremoteBuguerConfig =// absolute or relative local project root path. e.g.: c:\project or ~/project or .local: String// absolute or relative remote project root path. e.g.: /var/www/project or ~/project or .remote: String// hostname or ip. e.g.: my-hostname.com or 192.168.0.100host: String// ssh username to access the remote. Must be used with password or privateKey, not bothusername: String// ssh password to access the remotepassword: String// absolute or relative path to the ssh private key. e.g.: c:\privatekey or ~/.ssh/privatekeyprivateKey: String// function called when an output is available. default: console.logstdout: Function// function called when an error is available. default: console.errorstderr: Function// shell for local commands. e.g.: powershell.exe or /bin/bash.localShell: String// arguments for the local shell. e.g.: '-c' or [ '/s', '/k' ]localShellArgs: String | String// shell for remote commands. e.g.: powershell.exe or /bin/bash.remoteShell: String// arguments for the remote shell. e.g.: '-c' or [ '/s', '/k' ]remoteShellArgs: String | StringBurguerResult =code: Numberstdout: Stringstderr: String