-
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.
hotfix: add deploy and destroy in CI/CD, make all refactoring accordi…
…ng to merge comments
- Loading branch information
Showing
17 changed files
with
363 additions
and
357 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
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,55 @@ | ||
- hosts: demo_host | ||
tasks: | ||
- name: create workdir | ||
file: | ||
path: '{{ playbook_dest }}' | ||
state: directory | ||
owner: '{{ ansible_user }}' | ||
tags: [ 'prepare' ] | ||
|
||
- name: create pull script | ||
template: | ||
dest: '{{ playbook_dest }}/pull.sh' | ||
src: 'templates/pull.sh' | ||
mode: 0755 | ||
tags: [ 'prepare' ] | ||
|
||
- name: create run script | ||
template: | ||
dest: '{{ playbook_dest }}/run.sh' | ||
src: 'templates/run.sh' | ||
mode: 0755 | ||
tags: ['prepare'] | ||
|
||
- name: create destroy script | ||
template: | ||
dest: '{{ playbook_dest }}/destroy.sh' | ||
src: 'templates/destroy.sh' | ||
mode: 0755 | ||
tags: [ 'prepare' ] | ||
|
||
- name: create clean script | ||
template: | ||
dest: '{{ playbook_dest }}/clean.sh' | ||
src: 'templates/clean.sh' | ||
mode: 0755 | ||
tags: [ 'prepare' ] | ||
|
||
- name: pull docker image | ||
command: '{{ playbook_dest }}/pull.sh' | ||
tags: [ 'pull' ] | ||
|
||
- name: stop and remove existing container | ||
command: "{{ playbook_dest }}/destroy.sh" | ||
ignore_errors: true | ||
tags: [ 'deploy' ] | ||
|
||
- name: run docker | ||
command: "{{ playbook_dest }}/run.sh" | ||
tags: [ 'deploy' ] | ||
|
||
# - name: clean docker images and containers | ||
# command: "{{ playbook_dest }}/clean.sh" | ||
# ignore_errors: true | ||
# tags: [ 'deploy' ] | ||
|
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,32 @@ | ||
- hosts: '{{ host }}' | ||
tasks: | ||
- name: create workdir | ||
file: | ||
path: '{{ playbook_dest }}' | ||
state: directory | ||
owner: '{{ ansible_user }}' | ||
tags: [ 'prepare' ] | ||
|
||
- name: create destroy script | ||
template: | ||
dest: '{{ playbook_dest }}/destroy.sh' | ||
src: 'templates/destroy.sh' | ||
mode: 0755 | ||
tags: [ 'prepare' ] | ||
|
||
- name: create clean script | ||
template: | ||
dest: '{{ playbook_dest }}/clean.sh' | ||
src: 'templates/clean.sh' | ||
mode: 0755 | ||
tags: [ 'prepare' ] | ||
|
||
- name: stop and remove existing container | ||
command: "{{ playbook_dest }}/destroy.sh" | ||
ignore_errors: true | ||
tags: [ 'deploy' ] | ||
|
||
- name: clean docker images and containers | ||
command: "{{ playbook_dest }}/clean.sh" | ||
ignore_errors: true | ||
tags: [ 'deploy' ] |
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,12 @@ | ||
[demo_host] | ||
91.206.15.25 | ||
|
||
[all:vars] | ||
container_name=diunovidov_ocr_service | ||
|
||
[demo_host:vars] | ||
playbook_dest=/home/d.iunovidov/ocr_service | ||
ansible_user=d.iunovidov | ||
service_port=5039 | ||
ansible_ssh_private_key_file=~/.ssh/id_rsa | ||
|
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,6 @@ | ||
#!/bin/bash | ||
|
||
set -ue | ||
|
||
docker image prune -af | ||
docker container prune -af |
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,9 @@ | ||
#!/bin/bash | ||
|
||
set -ue | ||
|
||
CONTAINER_NAME={{ container_name }} | ||
|
||
docker stop ${CONTAINER_NAME} || true | ||
|
||
docker rm -f ${CONTAINER_NAME} || true |
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 @@ | ||
#!/bin/bash | ||
|
||
set -ue | ||
|
||
docker login -u {{ docker_registry_user }} -p {{ docker_registry_password }} {{ docker_registry }} | ||
|
||
docker pull {{ docker_image }}:{{ docker_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
set -ue | ||
|
||
IMAGE={{ docker_image }}:{{ docker_tag }} | ||
|
||
docker run \ | ||
-d \ | ||
-p {{ service_port }}:5000 \ | ||
--name={{ container_name }} \ | ||
--restart always \ | ||
${IMAGE} |
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
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
Oops, something went wrong.