From f33bd8471f283a644f85166cdc96dffea43fb1d1 Mon Sep 17 00:00:00 2001 From: Kostya Date: Tue, 28 Feb 2017 14:25:29 +0300 Subject: [PATCH 01/10] update server output --- circle.yml | 7 +++++++ deploy.sh | 2 +- server.js | 4 +--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/circle.yml b/circle.yml index 3ea77dc..b7e31c5 100644 --- a/circle.yml +++ b/circle.yml @@ -9,3 +9,10 @@ dependencies: test: override: - docker run kostyaurysov/sample-node npm test + +deployment: + production: + branch: master + commands: + - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS + - ./deploy.sh diff --git a/deploy.sh b/deploy.sh index 048ba6c..38526cc 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,5 +1,5 @@ #!/bin/bash -docker build -t kostyaurysov/sample-node . +# docker build -t kostyaurysov/sample-node . docker push kostyaurysov/sample-node ssh -i deploy deploy@35.187.30.81 << EOF diff --git a/server.js b/server.js index e4f6911..77f0207 100644 --- a/server.js +++ b/server.js @@ -4,9 +4,7 @@ var express = require("express"); express() .get("*", function(req, res) { - db("users").then(function(data) { - res.send(data); - }); + res.send("ok"); }) .listen(80, function(err) { if (err) { From 6ebe6a020e2712a4846008817cb4cfca141f0c98 Mon Sep 17 00:00:00 2001 From: Kostya Date: Tue, 28 Feb 2017 14:30:58 +0300 Subject: [PATCH 02/10] bug fixing --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 38526cc..7cd5f62 100644 --- a/deploy.sh +++ b/deploy.sh @@ -2,7 +2,7 @@ # docker build -t kostyaurysov/sample-node . docker push kostyaurysov/sample-node -ssh -i deploy deploy@35.187.30.81 << EOF +ssh deploy@35.187.30.81 << EOF docker pull kostyaurysov/sample-node:latest docker stop web || true docker rm web || true From 97b5f374ebf260afe11671b111aa47105754c795 Mon Sep 17 00:00:00 2001 From: Kostya Date: Tue, 28 Feb 2017 14:37:04 +0300 Subject: [PATCH 03/10] bug fixing --- circle.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index b7e31c5..071272b 100644 --- a/circle.yml +++ b/circle.yml @@ -9,10 +9,11 @@ dependencies: test: override: - docker run kostyaurysov/sample-node npm test - + deployment: production: branch: master commands: - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS - - ./deploy.sh + - chmod +x deploy.sh + - sh ./deploy.sh From e9571d205e60cbec260631dd1e48ce6b30b84996 Mon Sep 17 00:00:00 2001 From: Kostya Date: Tue, 28 Feb 2017 14:48:40 +0300 Subject: [PATCH 04/10] bug fixing --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 7cd5f62..f12e16f 100644 --- a/deploy.sh +++ b/deploy.sh @@ -8,5 +8,5 @@ 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 3000:3000 kostyaurysov/sample-node:current +docker run -d --net app --restart always --name web -p 80:80 kostyaurysov/sample-node:current EOF From 0c5c9f2e2f323397ce09e5633367853b0e19493b Mon Sep 17 00:00:00 2001 From: Kostya Date: Tue, 28 Feb 2017 15:06:06 +0300 Subject: [PATCH 05/10] rolling back --- circle.yml | 7 ------- deploy.sh | 2 +- server.js | 4 +++- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/circle.yml b/circle.yml index 071272b..0d8516e 100644 --- a/circle.yml +++ b/circle.yml @@ -10,10 +10,3 @@ test: override: - docker run kostyaurysov/sample-node 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 diff --git a/deploy.sh b/deploy.sh index f12e16f..dccd8a3 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,5 +1,5 @@ #!/bin/bash -# docker build -t kostyaurysov/sample-node . +docker build -t kostyaurysov/sample-node . docker push kostyaurysov/sample-node ssh deploy@35.187.30.81 << EOF diff --git a/server.js b/server.js index 77f0207..e4f6911 100644 --- a/server.js +++ b/server.js @@ -4,7 +4,9 @@ var express = require("express"); express() .get("*", function(req, res) { - res.send("ok"); + db("users").then(function(data) { + res.send(data); + }); }) .listen(80, function(err) { if (err) { From 07b0703f0103a1776ba03a451679d35e4ce34b79 Mon Sep 17 00:00:00 2001 From: Khanda Kevin Date: Fri, 20 Oct 2017 19:00:57 +0300 Subject: [PATCH 06/10] Add changes into conf files --- circle.yml | 7 +++++++ deploy.sh | 13 ++++++------- package.json | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/circle.yml b/circle.yml index 0d8516e..1a6af42 100644 --- a/circle.yml +++ b/circle.yml @@ -10,3 +10,10 @@ test: override: - docker run kostyaurysov/sample-node 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 diff --git a/deploy.sh b/deploy.sh index dccd8a3..230ca21 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,12 +1,11 @@ #!/bin/bash -docker build -t kostyaurysov/sample-node . -docker push kostyaurysov/sample-node +docker push kkhanda/sample-node -ssh deploy@35.187.30.81 << EOF -docker pull kostyaurysov/sample-node:latest +ssh deploy@35.195.193.222 << EOF +docker pull kkhanda/sample-node: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 kkhanda/sample-node:current || true +docker tag kkhanda/sample-node:latest kkhanda/sample-node:current +docker run -d --net app --restart always --name web -p 80:80 kkhanda/sample-node:current EOF diff --git a/package.json b/package.json index 747eb46..c52dca0 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "nodemon": "^1.9.1" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 0" + "test": "echo \"Continuous integration and deployment lab finished\" && exit 0" }, "keywords": [], "author": "", From 09c5edf5c4885b730ba5b2f2672050f64a1a7c80 Mon Sep 17 00:00:00 2001 From: Khanda Kevin Date: Fri, 20 Oct 2017 19:09:33 +0300 Subject: [PATCH 07/10] Add spaces instead of tabulation --- circle.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/circle.yml b/circle.yml index 1a6af42..b85701c 100644 --- a/circle.yml +++ b/circle.yml @@ -12,8 +12,8 @@ test: deployment: production: - branch:master - commands: - - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS - - chmod +x deploy.sh - - sh ./deploy.sh + branch:master + commands: + - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS + - chmod +x deploy.sh + - sh ./deploy.sh From 95e22c8719203a9670fbf723e3d759e948603cb0 Mon Sep 17 00:00:00 2001 From: Khanda Kevin Date: Fri, 20 Oct 2017 19:14:41 +0300 Subject: [PATCH 08/10] Small fixes --- circle.yml | 4 ++-- deploy.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/circle.yml b/circle.yml index b85701c..ac85339 100644 --- a/circle.yml +++ b/circle.yml @@ -4,11 +4,11 @@ machine: dependencies: override: - - docker build -t kostyaurysov/sample-node . + - docker build -t kkhanda/sample-node . test: override: - - docker run kostyaurysov/sample-node npm test + - docker run kkhanda/sample-node npm test deployment: production: diff --git a/deploy.sh b/deploy.sh index 230ca21..98829a5 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,11 +1,11 @@ #!/bin/bash docker push kkhanda/sample-node -ssh deploy@35.195.193.222 << EOF +ssh kevin_khanda@35.195.193.222 << EOF docker pull kkhanda/sample-node:latest docker stop web || true docker rm web || true docker rmi kkhanda/sample-node:current || true docker tag kkhanda/sample-node:latest kkhanda/sample-node:current -docker run -d --net app --restart always --name web -p 80:80 kkhanda/sample-node:current +docker run -d --restart always --name web -p 80:80 kkhanda/sample-node:current EOF From 01c4b9e57c333e1fa49f24bba5fa4e2b1a7b3d4a Mon Sep 17 00:00:00 2001 From: Khanda Kevin Date: Fri, 20 Oct 2017 19:22:00 +0300 Subject: [PATCH 09/10] Fix --- circle.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/circle.yml b/circle.yml index ac85339..c300803 100644 --- a/circle.yml +++ b/circle.yml @@ -11,9 +11,9 @@ test: - docker run kkhanda/sample-node 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 + production: + branch: master + commands: + - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS + - chmod +x deploy.sh + - sh ./deploy.sh From c70e0f5bac3fa05883f0f85a9ff6fe1852acbe2b Mon Sep 17 00:00:00 2001 From: Khanda Kevin Date: Fri, 20 Oct 2017 19:55:28 +0300 Subject: [PATCH 10/10] Fix --- deploy.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 deploy.sh diff --git a/deploy.sh b/deploy.sh old mode 100644 new mode 100755