Skip to content
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
11 changes: 9 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ machine:

dependencies:
override:
- docker build -t kostyaurysov/sample-node .
- docker build -t zytfo/cont_image .

test:
override:
- docker run kostyaurysov/sample-node npm test
- docker run zytfo/cont_image npm test

deployment:
production:
branch: master
commands:
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- chmod +x deploy.sh
- sh ./deploy.sh
14 changes: 7 additions & 7 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
docker build -t kostyaurysov/sample-node .
docker push kostyaurysov/sample-node
docker build -t zytfo/cont_image .
docker push zytfo/cont_image

ssh deploy@35.187.30.81 << EOF
docker pull kostyaurysov/sample-node:latest
ssh innostepanova@35.198.81.139 << EOF
docker pull zytfo/cont_image:latest
docker stop web || true
docker rm web || true
docker rmi kostyaurysov/sample-node:current || true
docker tag kostyaurysov/sample-node:latest kostyaurysov/sample-node:current
docker run -d --net app --restart always --name web -p 80:80 kostyaurysov/sample-node:current
docker rmi zytfo/cont_image:current || true
docker tag zytfo/cont_image:latest zytfo/cont_image:current
docker run -d --restart always --name web -p 80:80 zytfo/cont_image:current
EOF
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"express": "^4.13.4",
"knex": "^0.10.0",
"mysql": "^2.10.2",
"nodemon": "^1.9.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 0"
},
"keywords": [],
"author": "",
"license": "ISC"
}
"name": "app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"express": "^4.13.4",
"knex": "^0.10.0",
"mysql": "^2.10.2",
"nodemon": "^1.9.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 0"
},
"keywords": [],
"author": "",
"license": "ISC"
}
23 changes: 10 additions & 13 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ var db = require("knex")(config);
var express = require("express");

express()
.get("*", function(req, res) {
db("users").then(function(data) {
res.send(data);
});
})
.listen(80, function(err) {
if (err) {
console.error(err);
return;
}
.get("*", function(req, res) {
res.send("Continuous integration and deployment lab finished");
})
.listen(80, function(err) {
if (err) {
console.error(err);
return;
}

console.log("Express Server listening on port 80");
})
;
console.log("Express Server listening on port 80");
});