Add erc to native docker config in deployment playbooks

This commit is contained in:
Gerardo Nardelli 2019-11-29 09:28:50 -03:00
parent ed2de112a2
commit b6588ff3c5
7 changed files with 186 additions and 108 deletions

@ -0,0 +1,26 @@
---
- name: Slurp docker compose file
slurp:
src: "/home/poadocker/bridge/oracle/{{ item }}.yml"
register: docker_compose_slurp
- name: Parse docker compose file
set_fact:
docker_compose_parsed: "{{ docker_compose_slurp['content'] | b64decode | from_yaml }}"
- name: Add the external network used to connect to Parity nodes
set_fact:
docker_compose_parsed: "{{ docker_compose_parsed |combine({'networks': {'ultimate': {'external': 'true'}}}, recursive=True) }}"
- name: Add all Oracle containers to the network
set_fact:
docker_compose_parsed: "{{ docker_compose_parsed | combine({'services': {item: {'networks': docker_compose_parsed.services[item].networks | union(['ultimate'])}}}, recursive=True) }}"
with_items: "{{ docker_compose_parsed.services }}"
- name: Expose Redis port to allow connecting from redis-cli
set_fact:
docker_compose_parsed: "{{ docker_compose_parsed | combine({'services': {'redis': {'ports': ['6379:6379']}}}, recursive=True) }}"
- name: Write updated docker file
copy:
content: "{{ docker_compose_parsed | to_yaml }}"
dest: "/home/poadocker/bridge/oracle/{{ item }}.yml"

@ -5,58 +5,12 @@
tasks:
- name: stop the service
shell: service poabridge stop
- name: Slurp docker compose file
slurp:
src: "/home/poadocker/bridge/oracle/docker-compose.yml"
register: docker_compose_slurp
- name: Parse docker compose file
set_fact:
docker_compose_parsed: "{{ docker_compose_slurp['content'] | b64decode | from_yaml }}"
- name: Add the external network used to connect to Parity nodes
set_fact:
docker_compose_parsed: "{{ docker_compose_parsed |combine({'networks': {'ultimate': {'external': 'true'}}}, recursive=True) }}"
- name: Add all Oracle containers to the network
set_fact:
docker_compose_parsed: "{{ docker_compose_parsed | combine({'services': {item: {'networks': docker_compose_parsed.services[item].networks | union(['ultimate'])}}}, recursive=True) }}"
with_items: "{{ docker_compose_parsed.services }}"
- name: Expose Redis port to allow connecting from redis-cli
set_fact:
docker_compose_parsed: "{{ docker_compose_parsed | combine({'services': {'redis': {'ports': ['6379:6379']}}}, recursive=True) }}"
- name: Write new docker-compose file
copy:
content: "{{ docker_compose_parsed | to_yaml }}"
dest: "/home/poadocker/bridge/oracle/docker-compose.yml"
- name: Slurp docker compose extended file
slurp:
src: "/home/poadocker/bridge/oracle/docker-compose-transfer.yml"
register: docker_compose_extended_slurp
- name: Parse docker compose file
set_fact:
docker_compose_extended_parsed: "{{ docker_compose_extended_slurp['content'] | b64decode | from_yaml }}"
- name: Add the external network used to connect to Parity nodes in compose extended file
set_fact:
docker_compose_extended_parsed: "{{ docker_compose_extended_parsed |combine({'networks': {'ultimate': {'external': 'true'}}}, recursive=True) }}"
- name: Add all Oracle containers to the network in compose extended file
set_fact:
docker_compose_extended_parsed: "{{ docker_compose_extended_parsed | combine({'services': {item: {'networks': docker_compose_extended_parsed.services[item].networks | union(['ultimate'])}}}, recursive=True) }}"
with_items: "{{ docker_compose_extended_parsed.services }}"
- name: Expose Redis port to allow connecting from redis-cli in compose extended file
set_fact:
docker_compose_extended_parsed: "{{ docker_compose_extended_parsed | combine({'services': {'redis': {'ports': ['6379:6379']}}}, recursive=True) }}"
- name: Write new docker-compose extended file
copy:
content: "{{ docker_compose_extended_parsed | to_yaml }}"
dest: "/home/poadocker/bridge/oracle/docker-compose-transfer.yml"
- include_tasks: oracle-add-docker-external-network.yml
with_items:
- docker-compose
- docker-compose-transfer
- docker-compose-erc-native
- name: start the service
shell: service poabridge start

@ -1,41 +1,9 @@
---
- name: Slurp docker compose file
slurp:
src: "{{ bridge_path }}/oracle/docker-compose.yml"
register: docker_compose_slurp
- name: Parse docker compose file
set_fact:
docker_compose_parsed: "{{ docker_compose_slurp['content'] | b64decode | from_yaml }}"
- name: Set logger to remote server
set_fact:
docker_compose_parsed: "{{ docker_compose_parsed |combine({'services': {item: {'logging': {'driver': 'syslog','options': {'tag': '{{.Name}}/{{.ID}}'}}}}}, recursive=True) }}"
with_items: "{{ docker_compose_parsed.services }}"
- name: Write new docker-compose file
copy:
content: "{{ docker_compose_parsed | to_yaml }}"
dest: "{{ bridge_path }}/oracle/docker-compose.yml"
- name: Slurp docker compose extended file
slurp:
src: "{{ bridge_path }}/oracle/docker-compose-transfer.yml"
register: docker_compose_extended_slurp
- name: Parse docker compose extended file
set_fact:
docker_compose_extended_parsed: "{{ docker_compose_extended_slurp['content'] | b64decode | from_yaml }}"
- name: Set logger to remote server for extended file
set_fact:
docker_compose_extended_parsed: "{{ docker_compose_extended_parsed |combine({'services': {item: {'logging': {'driver': 'syslog','options': {'tag': '{{.Name}}/{{.ID}}'}}}}}, recursive=True) }}"
with_items: "{{ docker_compose_extended_parsed.services }}"
- name: Write new docker-compose-extended file
copy:
content: "{{ docker_compose_extended_parsed | to_yaml }}"
dest: "{{ bridge_path }}/oracle/docker-compose-transfer.yml"
- include_tasks: logging_remote.yml
with_items:
- docker-compose
- docker-compose-transfer
- docker-compose-erc-native
- name: Set the local container logs configuration file
template:

@ -0,0 +1,19 @@
---
- name: Slurp docker compose file
slurp:
src: "{{ bridge_path }}/oracle/{{ item }}.yml"
register: docker_compose_slurp
- name: Parse docker compose file
set_fact:
docker_compose_parsed: "{{ docker_compose_slurp['content'] | b64decode | from_yaml }}"
- name: Set logger to remote server
set_fact:
docker_compose_parsed: "{{ docker_compose_parsed |combine({'services': {item: {'logging': {'driver': 'syslog','options': {'tag': '{{.Name}}/{{.ID}}'}}}}}, recursive=True) }}"
with_items: "{{ docker_compose_parsed.services }}"
- name: Write updated docker file
copy:
content: "{{ docker_compose_parsed | to_yaml }}"
dest: "{{ bridge_path }}/oracle/{{ item }}.yml"

@ -40,7 +40,11 @@
- name: Extend docker compose file
set_fact: composefileoverride="-f docker-compose-transfer.yml"
when: ORACLE_BRIDGE_MODE == "ERC_TO_NATIVE" or ( ORACLE_BRIDGE_MODE == "ERC_TO_ERC" and FOREIGN_ERC_TYPE != "ERC677")
when: ORACLE_BRIDGE_MODE == "ERC_TO_ERC" and FOREIGN_ERC_TYPE != "ERC677"
- name: Extend docker compose file for erc to native
set_fact: composefileoverride="-f docker-compose-erc-native.yml"
when: ORACLE_BRIDGE_MODE == "ERC_TO_NATIVE"
- name: Install .key config
template:

@ -0,0 +1,126 @@
---
version: '2.4'
services:
rabbit:
extends:
file: docker-compose.yml
service: rabbit
networks:
- net_rabbit_bridge_transfer
redis:
extends:
file: docker-compose.yml
service: redis
networks:
- net_db_bridge_transfer
bridge_request:
extends:
file: docker-compose.yml
service: bridge_request
networks:
- net_db_bridge_request
- net_rabbit_bridge_request
bridge_collected:
extends:
file: docker-compose.yml
service: bridge_collected
networks:
- net_db_bridge_request
- net_rabbit_bridge_request
bridge_affirmation:
extends:
file: docker-compose.yml
service: bridge_affirmation
networks:
- net_db_bridge_request
- net_rabbit_bridge_request
bridge_transfer:
cpus: 0.1
mem_limit: 500m
build:
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env
environment:
- NODE_ENV=production
- ORACLE_VALIDATOR_ADDRESS=${ORACLE_VALIDATOR_ADDRESS}
restart: unless-stopped
entrypoint: yarn watcher:transfer
networks:
- net_db_bridge_transfer
- net_rabbit_bridge_transfer
bridge_half_duplex_transfer:
cpus: 0.1
mem_limit: 500m
build:
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env
environment:
- NODE_ENV=production
- ORACLE_VALIDATOR_ADDRESS=${ORACLE_VALIDATOR_ADDRESS}
restart: unless-stopped
entrypoint: yarn watcher:half-duplex-transfer
networks:
- net_db_bridge_half_duplex_transfer
- net_rabbit_bridge_half_duplex_transfer
bridge_swap_tokens_worker:
cpus: 0.1
mem_limit: 500m
build:
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env
environment:
- NODE_ENV=production
- ORACLE_VALIDATOR_ADDRESS=${ORACLE_VALIDATOR_ADDRESS}
restart: unless-stopped
entrypoint: yarn worker:swap-tokens
networks:
- net_rabbit_bridge_swap_tokens_worker
bridge_senderhome:
extends:
file: docker-compose.yml
service: bridge_senderhome
networks:
- net_db_bridge_request
- net_rabbit_bridge_request
bridge_senderforeign:
extends:
file: docker-compose.yml
service: bridge_senderforeign
networks:
- net_db_bridge_request
- net_rabbit_bridge_request
networks:
net_db_bridge_request:
driver: bridge
net_db_bridge_collected:
driver: bridge
net_db_bridge_affirmation:
driver: bridge
net_db_bridge_transfer:
driver: bridge
net_db_bridge_half_duplex_transfer:
driver: bridge
net_db_bridge_senderhome:
driver: bridge
net_db_bridge_senderforeign:
driver: bridge
net_rabbit_bridge_request:
driver: bridge
net_rabbit_bridge_collected:
driver: bridge
net_rabbit_bridge_affirmation:
driver: bridge
net_rabbit_bridge_transfer:
driver: bridge
net_rabbit_bridge_half_duplex_transfer:
driver: bridge
net_rabbit_bridge_swap_tokens_worker:
driver: bridge
net_rabbit_bridge_senderhome:
driver: bridge
net_rabbit_bridge_senderforeign:
driver: bridge

@ -49,21 +49,6 @@ services:
networks:
- net_db_bridge_transfer
- net_rabbit_bridge_transfer
bridge_half_duplex_transfer:
cpus: 0.1
mem_limit: 500m
build:
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env
environment:
- NODE_ENV=production
- ORACLE_VALIDATOR_ADDRESS=${ORACLE_VALIDATOR_ADDRESS}
restart: unless-stopped
entrypoint: yarn watcher:half-duplex-transfer
networks:
- net_db_bridge_half_duplex_transfer
- net_rabbit_bridge_half_duplex_transfer
bridge_senderhome:
extends:
file: docker-compose.yml
@ -88,8 +73,6 @@ networks:
driver: bridge
net_db_bridge_transfer:
driver: bridge
net_db_bridge_half_duplex_transfer:
driver: bridge
net_db_bridge_senderhome:
driver: bridge
net_db_bridge_senderforeign:
@ -102,8 +85,6 @@ networks:
driver: bridge
net_rabbit_bridge_transfer:
driver: bridge
net_rabbit_bridge_half_duplex_transfer:
driver: bridge
net_rabbit_bridge_senderhome:
driver: bridge
net_rabbit_bridge_senderforeign: