New way of deploying repository (#195)

* New repo task

* Removed bridge_repo and bridge_repo_branch configs

* Updated docs

* Update apt-get

* Fix path

* Exclude fix

* Removed CODEBASE_BRANCH

* Initializing submodules for deployment tests

* Synchronizing with ls-tree

* Synchronization without temp files
This commit is contained in:
Przemyslaw Rzad 2019-08-29 09:20:55 +02:00 committed by GitHub
parent dd9add50a0
commit 01186d6aa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 29 additions and 28 deletions

@ -169,16 +169,19 @@ jobs:
executor: tokenbridge-orb/machine-with-docker-caching executor: tokenbridge-orb/machine-with-docker-caching
steps: steps:
- checkout - checkout
- run: git submodule update --init
- run: deployment/molecule/molecule.sh oracle - run: deployment/molecule/molecule.sh oracle
deployment-ui: deployment-ui:
executor: tokenbridge-orb/machine-with-docker-caching executor: tokenbridge-orb/machine-with-docker-caching
steps: steps:
- checkout - checkout
- run: git submodule update --init
- run: deployment/molecule/molecule.sh ui - run: deployment/molecule/molecule.sh ui
deployment-monitor: deployment-monitor:
executor: tokenbridge-orb/machine-with-docker-caching executor: tokenbridge-orb/machine-with-docker-caching
steps: steps:
- checkout - checkout
- run: git submodule update --init
- run: deployment/molecule/molecule.sh monitor - run: deployment/molecule/molecule.sh monitor
ultimate: ultimate:
executor: tokenbridge-orb/machine-with-docker-caching executor: tokenbridge-orb/machine-with-docker-caching

@ -89,10 +89,6 @@ Example config for installing only UI:
2.1 `compose_service_user` - specifies the user created by the playbooks. This user runs the TokenBridge Oracle. 2.1 `compose_service_user` - specifies the user created by the playbooks. This user runs the TokenBridge Oracle.
2.2 `bridge_repo` contains the address of the TokenBridge Oracle repository. The default value is https://github.com/poanetwork/tokenbridge.
2.3 `bridge_repo_branch` points to the specific branch or commit to use with the `bridge_repo`. If `bridge_repo_branch` is not specified, the default (`master`) branch is used.
2.4 `bridge_path` sets the path where the TokenBridge Oracle is installed. By default, it points. to the home folder of `compose_service_user` 2.4 `bridge_path` sets the path where the TokenBridge Oracle is installed. By default, it points. to the home folder of `compose_service_user`
2.5 `docker_compose_version` - specifies a version of docker-compose to be installed. 2.5 `docker_compose_version` - specifies a version of docker-compose to be installed.

@ -1,4 +1,5 @@
FROM python:3.7-stretch FROM python:3.7-stretch
RUN apt-get update && apt-get install -y rsync
RUN curl -fsSL https://get.docker.com | sh RUN curl -fsSL https://get.docker.com | sh
RUN pip3 install docker molecule==2.22rc1 molecule[docker] flake8 RUN pip3 install docker molecule==2.22rc1 molecule[docker] flake8
WORKDIR mono/deployment WORKDIR mono/deployment

@ -2,10 +2,8 @@
cd $(dirname $0) cd $(dirname $0)
set -e # exit when any command fails set -e # exit when any command fails
CODEBASE_BRANCH=${CIRCLE_BRANCH-$(git symbolic-ref --short HEAD)}
while [ "$1" != "" ]; do while [ "$1" != "" ]; do
docker-compose build && docker-compose run -e CODEBASE_BRANCH=$CODEBASE_BRANCH molecule_runner /bin/bash -c "molecule test --scenario-name $1" docker-compose build && docker-compose run molecule_runner /bin/bash -c "molecule test --scenario-name $1"
shift # Shift all the parameters down by one shift # Shift all the parameters down by one
done done

@ -33,7 +33,6 @@ provisioner:
inventory: inventory:
host_vars: host_vars:
monitor-host: monitor-host:
bridge_repo_branch: $CODEBASE_BRANCH
syslog_server_port: "udp://127.0.0.1:514" syslog_server_port: "udp://127.0.0.1:514"
verifier: verifier:
name: testinfra name: testinfra

@ -35,7 +35,6 @@ provisioner:
oracle-host: oracle-host:
VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
syslog_server_port: "udp://127.0.0.1:514" syslog_server_port: "udp://127.0.0.1:514"
bridge_repo_branch: $CODEBASE_BRANCH
verifier: verifier:
name: testinfra name: testinfra
lint: lint:

@ -34,7 +34,6 @@ provisioner:
host_vars: host_vars:
ui-host: ui-host:
syslog_server_port: "udp://127.0.0.1:514" syslog_server_port: "udp://127.0.0.1:514"
bridge_repo_branch: $CODEBASE_BRANCH
verifier: verifier:
name: testinfra name: testinfra
lint: lint:

@ -32,13 +32,11 @@ provisioner:
inventory: inventory:
host_vars: host_vars:
oracle-erc-to-erc-host: oracle-erc-to-erc-host:
bridge_repo_branch: $CODEBASE_BRANCH
HOME_RPC_URL: "http://parity1:8545" HOME_RPC_URL: "http://parity1:8545"
FOREIGN_RPC_URL: "http://parity2:8545" FOREIGN_RPC_URL: "http://parity2:8545"
VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b" VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
ui-erc-to-erc-host: ui-erc-to-erc-host:
bridge_repo_branch: $CODEBASE_BRANCH
HOME_RPC_URL: "http://localhost:8541" HOME_RPC_URL: "http://localhost:8541"
FOREIGN_RPC_URL: "http://localhost:8542" FOREIGN_RPC_URL: "http://localhost:8542"
verifier: verifier:

@ -32,13 +32,11 @@ provisioner:
inventory: inventory:
host_vars: host_vars:
oracle-erc-to-native-host: oracle-erc-to-native-host:
bridge_repo_branch: $CODEBASE_BRANCH
HOME_RPC_URL: "http://parity1:8545" HOME_RPC_URL: "http://parity1:8545"
FOREIGN_RPC_URL: "http://parity2:8545" FOREIGN_RPC_URL: "http://parity2:8545"
VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b" VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
ui-erc-to-native-host: ui-erc-to-native-host:
bridge_repo_branch: $CODEBASE_BRANCH
HOME_RPC_URL: "http://localhost:8541" HOME_RPC_URL: "http://localhost:8541"
FOREIGN_RPC_URL: "http://localhost:8542" FOREIGN_RPC_URL: "http://localhost:8542"
verifier: verifier:

@ -32,13 +32,11 @@ provisioner:
inventory: inventory:
host_vars: host_vars:
oracle-native-to-erc-host: oracle-native-to-erc-host:
bridge_repo_branch: $CODEBASE_BRANCH
HOME_RPC_URL: "http://parity1:8545" HOME_RPC_URL: "http://parity1:8545"
FOREIGN_RPC_URL: "http://parity2:8545" FOREIGN_RPC_URL: "http://parity2:8545"
VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b" VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
ui-native-to-erc-host: ui-native-to-erc-host:
bridge_repo_branch: $CODEBASE_BRANCH
HOME_RPC_URL: "http://localhost:8541" HOME_RPC_URL: "http://localhost:8541"
FOREIGN_RPC_URL: "http://localhost:8542" FOREIGN_RPC_URL: "http://localhost:8542"
verifier: verifier:

@ -2,5 +2,3 @@
docker_compose_version: 1.23.2 docker_compose_version: 1.23.2
compose_service_user: poadocker compose_service_user: poadocker
bridge_path: "/home/{{ compose_service_user }}/bridge" bridge_path: "/home/{{ compose_service_user }}/bridge"
bridge_repo: https://github.com/poanetwork/tokenbridge.git
bridge_repo_branch: master

@ -22,6 +22,7 @@
- git - git
- python3 - python3
- python3-pip - python3-pip
- rsync
- name: Install Docker Compose - name: Install Docker Compose
get_url: get_url:

@ -1,12 +1,25 @@
--- ---
- name: Get bridge repo - name: Create repo directory
git: file:
repo: "{{ bridge_repo }}" path: "{{ bridge_path }}"
dest: "{{ bridge_path }}" state: directory
force: no
update: no - name: Register files for copying
version: "{{ bridge_repo_branch }}" shell: |
- name: Initialize submodules git ls-tree -r HEAD --name-only
shell: git submodule update --init cd contracts; git ls-tree -r HEAD --name-only | sed -e 's/^/contracts\//'
register: rsync_files
delegate_to: 127.0.0.1
become: false
args: args:
chdir: "{{ bridge_path }}" chdir: ".."
- name: Copy the files
synchronize:
dest: "{{ bridge_path }}"
src: ../../../..
rsync_opts:
- "--include=\"{{ item }}\""
- "--exclude='*'"
- "-avz"
with_items: rsync_files.stdout_lines