forked from project-sunbird/sunbird-devops
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request project-sunbird#797 from MasterAlt/release-2.4.0
Notification service build and deployment Ansible scripts and Jenkins pipeline along health checks and revised memory and cpu limits
- Loading branch information
Showing
8 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
- name: Remove user org service | ||
- name: Remove cert service | ||
shell: "docker service rm cert-service" | ||
ignore_errors: yes | ||
|
||
- name: Deploy user org service | ||
shell: "docker service create --with-registry-auth --replicas {{ cert_replicas }} -p 9011:9000 --name cert-service --hostname cert-service --reserve-memory {{ cert_reservation_memory }} --limit-memory {{ cert_limit_memory }} --limit-cpu {{ cert_limit_cpu }} --reserve-cpu {{ cert_reservation_cpu }} --network application_default --env-file /home/deployer/env/sunbird_cert-service.env {{hub_org}}/{{image_name}}:{{image_tag}}" | ||
- name: Deploy cert service | ||
shell: "docker service create --with-registry-auth --replicas {{ cert_replicas }} -p 9011:9000 --name cert-service --hostname cert-service --limit-memory {{ cert_limit_memory }} --limit-cpu {{ cert_limit_cpu }} --health-cmd 'wget -qO- cert-service:9000/service/health || exit 1' --health-timeout 3s --health-retries 3 --network application_default --env-file /home/deployer/env/sunbird_cert-service.env {{hub_org}}/{{image_name}}:{{image_tag}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Remove notification service | ||
shell: "docker service rm notification-service" | ||
ignore_errors: yes | ||
|
||
- name: Deploy notification service | ||
shell: "docker service create --with-registry-auth --replicas {{ notification_replicas }} -p 9012:9000 --name notification-service --hostname notification-service --limit-memory {{ notification_limit_memory }} --limit-cpu {{ notification_limit_cpu }} --network application_default --env-file /home/deployer/env/sunbird_notification-service.env {{hub_org}}/{{image_name}}:{{image_tag}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
ansible/roles/stack-sunbird/templates/sunbird_notification-service.env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sunbird_enc_service_url=http://enc-service:8013 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@Library('deploy-conf') _ | ||
node() { | ||
try { | ||
stage('checkout public repo') { | ||
cleanWs() | ||
checkout scm | ||
} | ||
|
||
stage('deploy') { | ||
values = docker_params() | ||
currentWs = sh(returnStdout: true, script: 'pwd').trim() | ||
ansiblePlaybook = "$currentWs/ansible/deploy.yml" | ||
ansibleExtraArgs = "--tags \"stack-sunbird\" --extra-vars \"hub_org=$hub_org image_name=$values.image_name image_tag=$values.image_tag service_name=notification-service deploy_notification=True\" --vault-password-file /var/lib/jenkins/secrets/vault-pass" | ||
values.put('currentWs', currentWs) | ||
values.put('ansiblePlaybook', ansiblePlaybook) | ||
values.put('ansibleExtraArgs', ansibleExtraArgs) | ||
ansible_playbook_run(values) | ||
archiveArtifacts 'metadata.json' | ||
currentBuild.description = "Image: ${values.image_tag}, Private: ${params.private_branch}, Public: ${params.branch_or_tag}" | ||
} | ||
} | ||
catch (err) { | ||
currentBuild.result = "FAILURE" | ||
throw err | ||
} | ||
finally { | ||
slack_notify(currentBuild.result) | ||
email_notify() | ||
} | ||
} |