diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000..3dbdf5fcad --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,90 @@ +pipeline { + agent any + stages { + stage('syncing files') { + steps { + script { + node + { + docker.withRegistry('https://dtrlb-adockersb.westus.cloudapp.azure.com/','dtr-login'){ + // dtr-login is a login ID in credentials + git 'https://github.com/Imransysg/example-voting-app.git/' + + } + + } + } + + } + } + stage('Vote Image') { + parallel { + stage('Vote Image') { + steps { + script { + node + { + docker.withRegistry('https://dtrlb-adockersb.westus.cloudapp.azure.com/','dtr-login') + { + git 'https://github.com/Imransysg/example-voting-app.git/' + def vote_img = docker.build('ddcadmin/voting-app-vote','./vote').push('latest') + } + + } + } + + } + } + stage('stg') { + steps { + script { + node + { + docker.withRegistry('https://dtrlb-adockersb.westus.cloudapp.azure.com/','dtr-login'){ + // dtr-login is a login ID in credentials + + git 'https://github.com/Imransysg/example-voting-app.git/' + def vote_img = docker.build('ddcadmin/voting-app-vote','./vote').push('latest') + + } + } + } + + } + } + } + } + stage('Worker Image') { + steps { + script { + node + { + docker.withRegistry('https://dtrlb-adockersb.westus.cloudapp.azure.com/','dtr-login'){ + git 'https://github.com/Imransysg/example-voting-app.git/' + def worker_img = docker.build('ddcadmin/voting-app-worker','./worker').push('latest') + + } + + } + } + + } + } + stage('Result Image') { + steps { + script { + node + { + docker.withRegistry('https://dtrlb-adockersb.westus.cloudapp.azure.com/','dtr-login'){ + // dtr-login is a login ID in credentials + git 'https://github.com/Imransysg/example-voting-app.git/' + def result_img = docker.build('ddcadmin/voting-app-result','./result').push('latest') + + } + } + } + + } + } + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 91c3aba05f..7b17e38d8c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,42 +1,81 @@ -version: "2" - -services: - voting-app: - image: dtrnodednstpal2zkqvglmc.westus.cloudapp.azure.com/admin/vote:latest - ports: - - "80" - networks: - - voteapp - labels: - - "interlock.hostname=vote" - - "interlock.domain=myenterprise.com" - result-app: - image: dtrnodednstpal2zkqvglmc.westus.cloudapp.azure.com/admin/result:latest - ports: - - "80" - networks: - - voteapp - labels: - - "interlock.hostname=results" - - "interlock.domain=myenterprise.com" - worker: - image: dtrnodednstpal2zkqvglmc.westus.cloudapp.azure.com/admin/worker:latest - networks: - - voteapp - redis: - image: redis - ports: - - "6379" - networks: - - voteapp - db: - image: postgres:9.4 - volumes: - - "db-data:/var/lib/postgresql/data" - networks: - - voteapp -volumes: - db-data: - -networks: - voteapp: +version: "3" +services: + + redis: + image: redis:alpine + ports: + - "6379" + networks: + - frontend + deploy: + replicas: 2 + update_config: + parallelism: 2 + delay: 10s + restart_policy: + condition: on-failure + db: + image: postgres:9.4 + volumes: + - db-data:/var/lib/postgresql/data + networks: + - backend + deploy: + placement: + constraints: [node.role == manager] + vote: + image: dtrlb-oe3ko7eumonjw.eastus.cloudapp.azure.com/ddcadmin/voting-app-vote:latest + ports: + - 5000:80 + networks: + - frontend + depends_on: + - redis + deploy: + replicas: 6 + update_config: + parallelism: 2 + restart_policy: + condition: on-failure + result: + image: dtrlb-oe3ko7eumonjw.eastus.cloudapp.azure.com/ddcadmin/voting-app-result:latest + ports: + - 5001:80 + networks: + - backend + deploy: + replicas: 2 + update_config: + parallelism: 2 + delay: 10s + restart_policy: + condition: on-failure + + worker: + image: dtrlb-oe3ko7eumonjw.eastus.cloudapp.azure.com/ddcadmin/voting-app-worker:latest + networks: + - frontend + - backend + deploy: + mode: replicated + replicas: 2 + labels: [APP=VOTING] + restart_policy: + condition: on-failure + delay: 10s + max_attempts: 3 + window: 120s + placement: + constraints: [node.role == worker] + ports: + - "8080:8080" + stop_grace_period: 1m30s + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + +networks: + frontend: + backend: + +volumes: + db-data: diff --git a/job.groovy b/job.groovy deleted file mode 100644 index acf9bbc371..0000000000 --- a/job.groovy +++ /dev/null @@ -1,12 +0,0 @@ -node{ - - docker.withRegistry('https://dtrnodednsitqp7hrth6jf2.westus.cloudapp.azure.com/', 'ddc-dtr-login') { - git 'https://github.com/SattaRavi/example-voting-app.git' - - build 'Job-Result' - build 'Job-Vote' - build 'Job-Worker' - - } - -} diff --git a/vote/testfile b/vote/testfile new file mode 100644 index 0000000000..01f53679a3 --- /dev/null +++ b/vote/testfile @@ -0,0 +1 @@ +hi this is test for blue ocean plugin