From 07b0703f0103a1776ba03a451679d35e4ce34b79 Mon Sep 17 00:00:00 2001 From: Khanda Kevin Date: Fri, 20 Oct 2017 19:00:57 +0300 Subject: [PATCH 1/4] 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 2/4] 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 3/4] 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 4/4] 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