diff --git a/circle.yml b/circle.yml index 0d8516e..be00278 100644 --- a/circle.yml +++ b/circle.yml @@ -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 \ No newline at end of file diff --git a/deploy.sh b/deploy.sh index dccd8a3..9dca63c 100644 --- a/deploy.sh +++ b/deploy.sh @@ -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 diff --git a/package.json b/package.json index 747eb46..040f57f 100644 --- a/package.json +++ b/package.json @@ -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" +} \ No newline at end of file diff --git a/server.js b/server.js index e4f6911..68714d0 100644 --- a/server.js +++ b/server.js @@ -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"); + }); \ No newline at end of file