runship
v1.1.1
Published
Mirror your code across all servers — RunShip ⭐
Maintainers
Readme
Auto-Deploy 🚀
Demo 🎥
Check out the example video: https://youtu.be/Y0v-qoW07jI
Auto-Deploy is a Node.js-based deployment automation tool designed to simplify the process of deploying applications to multiple virtual machines (VMs). It leverages Firebase for VM management and SSH for secure communication.
Features 🌟
- Firebase Integration: Manage VMs securely with Firebase Firestore.
- Encryption: Sensitive data is encrypted using AES-256-CBC.
- Batch Deployment: Deploy to multiple VMs in parallel with configurable batch sizes.
- Customizable Hooks: Run pre-upload and pre-run commands for flexible deployment workflows.
Installation 🛠️
- Install the package:
npm install runship
Configuration ⚙️
Update the config.json file with your Firebase configuration and encryption password:
{
"firebaseConfig": {
"apiKey": "<YOUR_API_KEY>",
"authDomain": "<YOUR_AUTH_DOMAIN>",
"projectId": "<YOUR_PROJECT_ID>",
"storageBucket": "<YOUR_STORAGE_BUCKET>",
"messagingSenderId": "<YOUR_MESSAGING_SENDER_ID>",
"appId": "<YOUR_APP_ID>"
},
"Password": "<YOUR_ENCRYPTION_PASSWORD>"
}Usage 🚀
Deploying Applications
- Update the
index.jsfile with your deployment configuration:const runship = require("runship"); runship.connect(require("./config.json").firebaseConfig); runship.deploy({ uploadFolder: "example-folder", serviceName: "example.service", multiply: 5, verbose: true, beforeUpload: "mv data.json ../data.json", beforeRun: "echo hi > test.txt && mv ../data.json data.json && /usr/bin/npm i", });
Adding a VM
- Update the
addVM.jsfile with your VM details:const runship = require("runship"); runship.connect(require("./config.json").firebaseConfig); runship.addTestVM({ host: "<VM_HOST>", username: "<USERNAME>", password: null, port: 22, path: "/home/user/module", privateKey: fs.readFileSync("path/to/private/key", 'utf8'), });
Creating and Starting Services
- Update the
services.jsfile with your service configuration:const runship = require("runship"); const config = require("./config.json"); async function main() { runship.json("./settings.json"); await runship.createService({ name: "example-service", execStart: "/usr/bin/node index.js", }); await runship.startService({ name: "example-service", }); process.exit(0); } main();
