This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:
- Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
- Windows 10 on my PC to work.
# Create file | |
echo My_super_secret > secrets.txt | |
# Encrypt with password | |
openssl aes-256-cbc -a -salt -in secrets.txt -out secrets.txt.enc | |
# Decrypt with password input | |
openssl aes-256-cbc -d -a -in secrets.txt.enc -out secrets1.txt | |
# Decrypt with password as option | |
openssl aes-256-cbc -d -a -k qwerty -in secrets.txt.enc -out secrets2.txt | |
# Link: http://tombuntu.com/index.php/2007/12/12/simple-file-encryption-with-openssl/ |
/** | |
* Generate random string | |
* @param {number} len Length of string | |
* @param {string} charSet Allowable characters | |
* @return {string} | |
*/ | |
function randomString(len = 10, charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') { | |
let randomString = ''; | |
for (let i = 0; i < len; i++) { | |
let randomPoz = Math.floor(Math.random() * charSet.length); |
/** | |
* Shorten the string to the specified length. | |
* Example: shortenTo("Lorem ipsum dolor", 10); // "Lorem i..." | |
* @param {string} str | |
* @param {number} len | |
*/ | |
function shortenTo(str, len) { | |
const strLen = str.length; | |
return strLen < len ? str : str.substr(0, len - 3) + '...'; | |
} |
This is tutorial is about simple client-server file updating. This is not blue-green deploy!
Protocol: RSYNC through SSH. Tested on target server: Ubuntu 16.04 x64. (suitable for Ubuntu 14.x).
Got from here
image: node:alpine
before_script:
- npm install
This gist is based on [Kubernetes Dashboard](https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/} deploy docs. I think you have installed the Nginx Iingress Controller.
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml