https://github.com/zauberware/ssh-deploy
https://github.com/zauberware/ssh-deploy
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/zauberware/ssh-deploy
- Owner: zauberware
- Created: 2021-07-13T15:37:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-27T14:18:09.000Z (over 3 years ago)
- Last Synced: 2025-02-21T18:46:45.924Z (over 1 year ago)
- Language: JavaScript
- Size: 136 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ssh-deploy
### Table of Contents
- [Install](#install)
- [Create vhosts](#create-vhosts)
- [Env](#.env)
- [Sample](#sample)
- [Options](#env-options)
- [package.json scripts](#package.json-scripts)
## Install
```
npm i @zauberware/ssh-deploy --save
```
## Create vhosts
nginx minimum config for default .env
**storybook**
```
server {
listen 80;
server_name storybook.example.com;
# Tell Nginx your app's 'public' directory is
root /home/exampleuser/storybook/current;
}
```
**staging**
```
server {
listen 80;
server_name staging.example.com;
# Tell Nginx your app's 'public' directory is
root /home/exampleuser/staging/current;
}
```
**production**
```
server {
listen 80;
server_name production.example.com;
# Tell Nginx your app's 'public' directory is
root /home/exampleuser/production/current;
}
```
## .env
Configure and put these env variables to your .env file.
Or use the gui for the basic configuration
```
ENV_MODE=init npm explore @zauberware/ssh-deploy -- npm run sshDeploy --env=$PWD
```
### Sample
```
DEFAULT_USERNAME=exampleuser
DEFAULT_PASSWORD=supersecretpassword
DEFAULT_HOST=example.com
DEFAULT_PORT=22
DEFAULT_HOST_BASEPATH=~/
DEFAULT_HOST_LOGFOLDER=releases/
LOCAL_STORYBOOK_FOLDER=storybook-static/
LOCAL_APPFOLDER=build/
```
### Options
Overview of possible .env key=value options
#### local folders
| Key | Defaultvalue | Description |
| :--------------------- | :---------------: | ------------------------------------------------------ |
| LOCAL_STORYBOOK_FOLDER | storybook-static/ | folder where the storybook build on your machine lives |
| LOCAL_APPFOLDER | build/ | folder where the build on your machine lives |
#### connection
| Key | Defaultvalue | Description |
| ---------------------- | :----------: | ------------------------------------------------------------------------------------------------------ |
| DEFAULT_USERNAME | --- | user for ssh connection |
| DEFAULT_PASSWORD | --- | password for ssh connection |
| DEFAULT_HOST | --- | hostaddress or name for ssh connection |
| DEFAULT_PORT | --- | port for ssh connection |
| DEFAULT_HOST_BASEPATH | ~/ | basepath where the subfolders for deployment live (default subfolders: production, staging, storybook) |
| DEFAULT_HOST_LOGFOLDER | releases/ | relative path to logfile savelocation |
#### optional options for storybook
| Key | Defaultvalue | Description |
| :------------------------ | :----------: | ---------------------------------------------------------- |
| STORYBOOK_USERNAME | --- | |
| STORYBOOK_PASSWORD | --- | |
| STORYBOOK_HOST | --- | |
| STORYBOOK_PORT | --- | |
| STORYBOOK_HOST_BASEPATH | ~/ | |
| STORYBOOK_HOST_DEPLOYPATH | storybook/ | |
| STORYBOOK_HOST_LOGFOLDER | releases/ | relative path to logfile savelocation for storybook deploy |
#### optional options for staging
| Key | Defaultvalue | Description |
| :---------------------- | :----------: | ----------- |
| STAGING_USERNAME | --- | |
| STAGING_PASSWORD | --- | |
| STAGING_HOST | --- | |
| STAGING_PORT | --- | |
| STAGING_HOST_BASEPATH | ~/ | |
| STAGING_HOST_DEPLOYPATH | staging/ | |
| STAGING_HOST_LOGFOLDER | releases/ | |
#### optional options for production
| Key | Defaultvalue | Description |
| :------------------------- | :----------: | ----------- |
| PRODUCTION_USERNAME | --- | |
| PRODUCTION_PASSWORD | --- | |
| PRODUCTION_HOST | --- | |
| PRODUCTION_PORT | --- | |
| PRODUCTION_HOST_BASEPATH | ~/ | |
| PRODUCTION_HOST_DEPLOYPATH | production | |
| PRODUCTION_HOST_LOGFOLDER | releases/ | |
## package.json scripts
Put these scripts into your root package.json
```
"deploy": "ENV_MODE=deploy npm explore @zauberware/ssh-deploy -- npm run sshDeploy --env=$PWD",
"rollback": "ENV_MODE=rollback npm explore @zauberware/ssh-deploy -- npm run sshDeploy --env=$PWD",
"sshDeploy": "npm explore @zauberware/ssh-deploy -- npm run sshDeploy --env=$PWD",
```