Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #18

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pipeline {
agent any
stages {
stage('gitclone') {
steps {
git 'https://github.com/barathtech/hello-world.git'
sh 'rm -rf .git'
}
}
stage('Deploy') {
steps{
sshagent(['ssh-key']) {
sh """
scp -o StrictHostKeyChecking=no -r ${env.WORKSPACE}/* [email protected]:/var/www/html/${env.JOB_BASE_NAME}
[ -f ".env" ] && scp .env [email protected]/var/www/html/${env.JOB_BASE_NAME}
ssh -o StrictHostKeyChecking=no [email protected] pm2 restart ${env.JOB_BASE_NAME}
"""

}
}
}
}
}
21 changes: 21 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Node.js with React
# Build a Node.js project that uses React.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

pool:
vmImage: ubuntu-latest

steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'

- script: |
npm install
npm run build
displayName: 'npm install and build'
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const port = process.env.PORT || 3000;

const server = http.createServer((req, res) => {
res.statusCode = 200;
const msg = 'Hello Node!\n'
const msg = 'Hello new Node!\n'
res.end(msg);
});

Expand Down
7 changes: 7 additions & 0 deletions install_dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
sudo apt-get update
sudo apt-get -y install nginx
sudo apt-get -y nodejs
sudo apt-get -y npm
sudo npm i -g pm2
sudo pm2 start app.js