vizora
v0.1.0
Published
Node.js deployment CLI powered by SSH, Git, npm, and PM2.
Readme
Vizora
Vizora is a simple deployment CLI for Node.js projects.
It deploys your Node.js app to a remote server using SSH, Git, npm, and PM2.
What Vizora Supports
Vizora currently supports Node.js app deployment only.
Your Node.js project should have:
package.json
.env.example
vizora.config.jsonInstall Locally
From the Vizora repo:
npm install
npm link -w cliThen check:
vizora --helpCreate vizora.config.json
Inside your Node.js project, create:
{
"name": "my-node-app",
"repo": "https://github.com/username/my-node-app.git",
"branch": "main",
"server": "user@example-server",
"basePath": "/home/user/apps",
"preStart": "",
"start": "npm start"
}Example with nodemon:
{
"name": "oauth",
"repo": "https://github.com/vizzscript/OAuth_Server.git",
"branch": "master",
"server": "vizzscript@home-server",
"basePath": "/home/vizzscript/api",
"preStart": "npm install nodemon --no-save",
"start": "npm run dev"
}Environment Variables
If your project has .env.example, Vizora reads it during deploy and asks for values.
Example .env.example:
PORT=3000
MONGO_URI=mongodb+srv://<username>:<password>@<cluster>/<database>
CLIENT_ID=<google-client-id>
CLIENT_SECRET=<google-client-secret>
REDIRECT_URI=http://localhost:3000/auth/oauth2callbackValues that are blank or use placeholders like <google-client-id> are treated as required.
Deploy
Run this from inside your Node.js project folder:
vizora deployVizora will:
- Load
vizora.config.json - Read
.env.example - Ask for environment values
- SSH into the server
- Create a new timestamped release
- Run
npm install - Write
.envinto the release - Run
preStartif configured - Point
currentto the new release - Start the app with PM2 from
current - Show PM2 status
Rollback
Every deploy creates a release folder:
<basePath>/<name>/releases/<yyyy-mm-dd-HHMM>The active app is always:
<basePath>/<name>/currentPM2 starts the app from current, so rollback can move current back to the previous release:
vizora rollbackRollback will:
- Find the release before the current one
- Point
currentback to that release - Restart the PM2 process
- Show PM2 status
Commands
Show logs:
vizora logsShow more log lines:
vizora logs --lines 200Show PM2 status:
vizora statusRestart the app:
vizora restartRoll back to the previous release:
vizora rollbackStop the app:
vizora stopRemove the app from PM2:
vizora removeRemove the app from PM2 and delete deployed files:
vizora remove --filesRemote Folder
Vizora deploys to:
<basePath>/<name>/currentFor example:
{
"name": "oauth",
"basePath": "/home/vizzscript/api"
}Deploys to:
/home/vizzscript/api/oauth/currentReleases are stored in:
/home/vizzscript/api/oauth/releasesNotes
- The remote server must have Git, Node.js, npm, and PM2 installed.
- The local machine must be able to SSH into the configured server.
- Vizora preserves the remote
.envduring repository cleanup. vizora remove --filesdeletes only the configured app folder.
