[frack-deployment]
Installation
To install the stable version:
npm install --save frack-deployment
Integration to project
-
Setup Jenkins CI environment
-
Add these lines to package.json:
"deploy:preview": "frack-deployment request-deploy-allbranch",
"deploy:staging": "frack-deployment request-deploy staging",
"deploy:production": "frack-deployment request-deploy production",
"ci-deploy-preview": "frack-deployment ci-deploy-allbranch",
"ci-deploy-staging": "frack-deployment ci-deploy staging",
"ci-deploy-production": "frack-deployment ci-deploy production",
"ci-rollback": "frack-deployment ci-rollback",
"ci-clean": "frack-deployment ci-clean",
"pm2-startup": "frack-deployment pm2-startup",
"pm2-startup-allbranch": "frack-deployment pm2-startup-allbranch",
"pm2-delete-allbranch": "frack-deployment pm2-delete-allbranch",
- Create in project root file
deploy.config.js
:
module.exports = {
jenkins: {
jobName: 'abc',
token: 'def',
},
ci: {
preview: {
projectName: 'myProject',
config: 'configSection',
domainBase: 'preview.project.com',
reinstallWithProductionDependencies: true,
mattermost: {
endpoint: 'https://mattermost.siteone.cz/hooks/or3pupgictyz5gydrmkdsri5gy',
channel: 'test',
},
},
staging: {
projectName: 'myProject-staging',
config: 'configSection'
},
production: {
projectName: 'myProject',
config: 'configSection'
},
checkAfterDeploy: function (next, { sshDsn, port }) {
return next();
}
},
deploy: {
'configSection': {
sshBaseDir: '/home/deploy',
sshSubDir: '',
sshDsns: [
'user@mysshserver'
],
excludeFile: '.rsyncignore',
releasesBackupCount: 3,
allbranchLeaveDaysCount: 20,
vhostApiUrl: 'http://xyz'
}
}
}
- Add to your .env file these variables (with real values of course):
JENKINS_DEPLOY_ALLBRANCH_JOB=jenkinsJobNameXyz
JENKINS_DEPLOY_PRODUCTION_JOB=jenkinsJobNameXyz
JENKINS_DEPLOY_STAGING_JOB=jenkinsJobNameXyz
JENKINS_DEPLOY_ALLBRANCH_TOKEN=xyz
JENKINS_DEPLOY_PRODUCTION_TOKEN=xyz
JENKINS_DEPLOY_STAGING_TOKEN=xyz
Usage
After integration run in project:
npm run deploy:preview
npm run deploy:production
npm run deploy:staging