Use oracle docker hub image for oracle deployment (#280)

This commit is contained in:
Gerardo Nardelli 2020-02-03 18:48:28 -03:00 committed by GitHub
parent 232f807e9d
commit 52358d477b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 59 additions and 62 deletions

@ -9,7 +9,6 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
def test_repo(host): def test_repo(host):
assert host.file('/home/poadocker/bridge').exists assert host.file('/home/poadocker/bridge').exists
assert host.file('/home/poadocker/bridge').is_directory assert host.file('/home/poadocker/bridge').is_directory
assert host.file('/home/poadocker/bridge/package.json').exists
def test_docker_group(host): def test_docker_group(host):

@ -1,7 +1,7 @@
--- ---
- name: Slurp docker compose file - name: Slurp docker compose file
slurp: slurp:
src: "/home/poadocker/bridge/oracle/{{ item }}.yml" src: "/home/poadocker/bridge/oracle/{{ file }}.yml"
register: docker_compose_slurp register: docker_compose_slurp
- name: Parse docker compose file - name: Parse docker compose file
set_fact: set_fact:
@ -23,4 +23,4 @@
- name: Write updated docker file - name: Write updated docker file
copy: copy:
content: "{{ docker_compose_parsed | to_yaml }}" content: "{{ docker_compose_parsed | to_yaml }}"
dest: "/home/poadocker/bridge/oracle/{{ item }}.yml" dest: "/home/poadocker/bridge/oracle/{{ file }}.yml"

@ -6,11 +6,30 @@
- name: stop the service - name: stop the service
shell: service poabridge stop shell: service poabridge stop
- include_tasks: oracle-add-docker-external-network.yml - name: Build current oracle image
shell: docker build -t oracle:ultimate-testing --file oracle/Dockerfile .
delegate_to: 127.0.0.1
become: false
args:
chdir: "{{ lookup('env', 'PWD') }}/.."
- name: Replace oracle image
replace:
path: "/home/poadocker/bridge/oracle/{{ item }}.yml"
regexp: 'poanetwork/tokenbridge-oracle:latest'
replace: "oracle:ultimate-testing"
with_items: with_items:
- docker-compose - docker-compose
- docker-compose-transfer - docker-compose-transfer
- docker-compose-erc-native - docker-compose-erc-native
- include_tasks: oracle-add-docker-external-network.yml
with_items:
- docker-compose
- docker-compose-transfer
- docker-compose-erc-native
loop_control:
loop_var: file
- name: start the service - name: start the service
shell: service poabridge start shell: service poabridge start

@ -14,7 +14,7 @@
- name: Include repo tasks - name: Include repo tasks
include_tasks: repo.yml include_tasks: repo.yml
when: skip_task != true when: skip_task != true and skip_repo is undefined
- name: Include logging tasks - name: Include logging tasks
include_tasks: logging.yml include_tasks: logging.yml

@ -1,3 +1,3 @@
--- ---
dependencies: dependencies:
- role: common - { role: common, skip_repo: true }

@ -1,5 +1,5 @@
--- ---
- name: Build the containers - name: Pull the containers images
shell: docker-compose build shell: docker-compose pull
args: args:
chdir: "{{ bridge_path }}/oracle" chdir: "{{ bridge_path }}/oracle"

@ -1,7 +1,7 @@
--- ---
- name: Get blocks - name: Get blocks
become_user: "{{ compose_service_user }}" become_user: "{{ compose_service_user }}"
shell: docker-compose run --entrypoint "node scripts/getValidatorStartBlocks.js" bridge_affirmation shell: docker-compose run --rm --entrypoint "node scripts/getValidatorStartBlocks.js" bridge_affirmation
args: args:
chdir: "{{ bridge_path }}/oracle" chdir: "{{ bridge_path }}/oracle"
register: BLOCKS register: BLOCKS
@ -18,7 +18,7 @@
- name: Get validator address - name: Get validator address
become_user: "{{ compose_service_user }}" become_user: "{{ compose_service_user }}"
shell: docker-compose run -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY="{{ ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY }}" --entrypoint "node scripts/privateKeyToAddress.js" bridge_affirmation shell: docker-compose run --rm -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY="{{ ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY }}" --entrypoint "node scripts/privateKeyToAddress.js" bridge_affirmation
args: args:
chdir: "{{ bridge_path }}/oracle" chdir: "{{ bridge_path }}/oracle"
register: VADDRESS register: VADDRESS
@ -29,7 +29,7 @@
- name: Get foreign erc type - name: Get foreign erc type
become_user: "{{ compose_service_user }}" become_user: "{{ compose_service_user }}"
shell: docker-compose run --entrypoint "node scripts/initialChecks.js" bridge_affirmation shell: docker-compose run --rm --entrypoint "node scripts/initialChecks.js" bridge_affirmation
args: args:
chdir: "{{ bridge_path }}/oracle" chdir: "{{ bridge_path }}/oracle"
register: ERCTYPE register: ERCTYPE

@ -1,5 +1,21 @@
--- ---
- name: Create oracle directory
file:
path: "{{ bridge_path }}/oracle"
state: directory
mode: '0755'
- name: Install .env config - name: Install .env config
template: template:
src: .env.j2 src: .env.j2
dest: "{{ bridge_path }}/oracle/.env" dest: "{{ bridge_path }}/oracle/.env"
- name: Copy docker-compose files
copy:
src: ../../../../oracle/{{ item }}
dest: "{{ bridge_path }}/oracle/"
mode: '0755'
with_items:
- docker-compose.yml
- docker-compose-transfer.yml
- docker-compose-erc-native.yml

@ -1,6 +1,5 @@
# This role creates a poabridge service which is designed to manage docker-compose bridge deployment. # This role creates a poabridge service which is designed to manage docker-compose bridge deployment.
# /etc/init.d/poabridge start, status, stop, restart - does what the services usually do in such cases. # /etc/init.d/poabridge start, status, stop, restart - does what the services usually do in such cases.
# /etc/init.d/poabridge rebuild - builds a new bridge deployment from scratch.
--- ---
- name: "Set poabridge service" - name: "Set poabridge service"
template: template:

@ -52,14 +52,6 @@ status(){
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose $composefileoverride ps sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose $composefileoverride ps
} }
rebuild(){
echo "Rebuild bridge.."
cd $WORKDIR
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose $composefileoverride down -v
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose $composefileoverride rm -fv
sudo -u "{{ compose_service_user }}" ORACLE_VALIDATOR_ADDRESS=$vaddr ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=$vkey /usr/local/bin/docker-compose $composefileoverride up --detach --force-recreate --no-deps --build
}
case "$1" in case "$1" in
@ -81,12 +73,8 @@ case "$1" in
start start
;; ;;
rebuild)
rebuild
;;
*) *)
echo $"Usage: $0 {start|stop|restart|rebuild|status}" echo $"Usage: $0 {start|stop|restart|status}"
exit 1 exit 1
;; ;;

@ -30,8 +30,7 @@ services:
build: build:
context: .. context: ..
dockerfile: oracle/Dockerfile dockerfile: oracle/Dockerfile
args: env_file: ../e2e-commons/components-envs/oracle.env
DOT_ENV_PATH: e2e-commons/components-envs/oracle.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
command: "true" command: "true"
@ -41,8 +40,7 @@ services:
build: build:
context: .. context: ..
dockerfile: oracle/Dockerfile dockerfile: oracle/Dockerfile
args: env_file: ../e2e-commons/components-envs/oracle-erc20.env
DOT_ENV_PATH: e2e-commons/components-envs/oracle-erc20.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
command: "true" command: "true"
@ -52,8 +50,7 @@ services:
build: build:
context: .. context: ..
dockerfile: oracle/Dockerfile dockerfile: oracle/Dockerfile
args: env_file: ../e2e-commons/components-envs/oracle-erc20-native.env
DOT_ENV_PATH: e2e-commons/components-envs/oracle-erc20-native.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
command: "true" command: "true"
@ -63,8 +60,7 @@ services:
build: build:
context: .. context: ..
dockerfile: oracle/Dockerfile dockerfile: oracle/Dockerfile
args: env_file: ../e2e-commons/components-envs/oracle-amb.env
DOT_ENV_PATH: e2e-commons/components-envs/oracle-amb.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
command: "true" command: "true"

@ -22,8 +22,6 @@ RUN mv ./contracts/build ./ && rm -rf ./contracts/* ./contracts/.[!.]* && mv ./b
COPY ./commons ./commons COPY ./commons ./commons
COPY ./oracle ./oracle COPY ./oracle ./oracle
ARG DOT_ENV_PATH=./oracle/.env
COPY ${DOT_ENV_PATH} ./oracle/.env
WORKDIR /mono/oracle WORKDIR /mono/oracle
CMD echo "To start a bridge process run:" \ CMD echo "To start a bridge process run:" \

@ -40,9 +40,7 @@ services:
bridge_transfer: bridge_transfer:
cpus: 0.1 cpus: 0.1
mem_limit: 500m mem_limit: 500m
build: image: poanetwork/tokenbridge-oracle:latest
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
@ -55,9 +53,7 @@ services:
bridge_half_duplex_transfer: bridge_half_duplex_transfer:
cpus: 0.1 cpus: 0.1
mem_limit: 500m mem_limit: 500m
build: image: poanetwork/tokenbridge-oracle:latest
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
@ -70,9 +66,7 @@ services:
bridge_swap_tokens_worker: bridge_swap_tokens_worker:
cpus: 0.1 cpus: 0.1
mem_limit: 500m mem_limit: 500m
build: image: poanetwork/tokenbridge-oracle:latest
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production

@ -37,9 +37,7 @@ services:
bridge_transfer: bridge_transfer:
cpus: 0.1 cpus: 0.1
mem_limit: 500m mem_limit: 500m
build: image: poanetwork/tokenbridge-oracle:latest
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production

@ -32,9 +32,7 @@ services:
bridge_request: bridge_request:
cpus: 0.1 cpus: 0.1
mem_limit: 500m mem_limit: 500m
build: image: poanetwork/tokenbridge-oracle:latest
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
@ -47,9 +45,7 @@ services:
bridge_collected: bridge_collected:
cpus: 0.1 cpus: 0.1
mem_limit: 500m mem_limit: 500m
build: image: poanetwork/tokenbridge-oracle:latest
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
@ -62,9 +58,7 @@ services:
bridge_affirmation: bridge_affirmation:
cpus: 0.1 cpus: 0.1
mem_limit: 500m mem_limit: 500m
build: image: poanetwork/tokenbridge-oracle:latest
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
@ -77,9 +71,7 @@ services:
bridge_senderhome: bridge_senderhome:
cpus: 0.1 cpus: 0.1
mem_limit: 500m mem_limit: 500m
build: image: poanetwork/tokenbridge-oracle:latest
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
@ -92,9 +84,7 @@ services:
bridge_senderforeign: bridge_senderforeign:
cpus: 0.1 cpus: 0.1
mem_limit: 500m mem_limit: 500m
build: image: poanetwork/tokenbridge-oracle:latest
context: ..
dockerfile: oracle/Dockerfile
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production