Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New way of deploying repository #195

Merged
merged 10 commits into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,19 @@ jobs:
executor: tokenbridge-orb/machine-with-docker-caching
steps:
- checkout
- run: git submodule update --init
- run: deployment/molecule/molecule.sh oracle
deployment-ui:
executor: tokenbridge-orb/machine-with-docker-caching
steps:
- checkout
- run: git submodule update --init
- run: deployment/molecule/molecule.sh ui
deployment-monitor:
executor: tokenbridge-orb/machine-with-docker-caching
steps:
- checkout
- run: git submodule update --init
- run: deployment/molecule/molecule.sh monitor
ultimate:
executor: tokenbridge-orb/machine-with-docker-caching
Expand Down
4 changes: 0 additions & 4 deletions deployment/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.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.5 `docker_compose_version` - specifies a version of docker-compose to be installed.
Expand Down
1 change: 1 addition & 0 deletions deployment/molecule/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.7-stretch
RUN apt-get update && apt-get install -y rsync
RUN curl -fsSL https://get.docker.com | sh
RUN pip3 install docker molecule==2.22rc1 molecule[docker] flake8
WORKDIR mono/deployment
4 changes: 1 addition & 3 deletions deployment/molecule/molecule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
cd $(dirname $0)
set -e # exit when any command fails

CODEBASE_BRANCH=${CIRCLE_BRANCH-$(git symbolic-ref --short HEAD)}

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
done
1 change: 0 additions & 1 deletion deployment/molecule/monitor/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ provisioner:
inventory:
host_vars:
monitor-host:
bridge_repo_branch: $CODEBASE_BRANCH
syslog_server_port: "udp://127.0.0.1:514"
verifier:
name: testinfra
Expand Down
1 change: 0 additions & 1 deletion deployment/molecule/oracle/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ provisioner:
oracle-host:
VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
syslog_server_port: "udp://127.0.0.1:514"
bridge_repo_branch: $CODEBASE_BRANCH
verifier:
name: testinfra
lint:
Expand Down
1 change: 0 additions & 1 deletion deployment/molecule/ui/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ provisioner:
host_vars:
ui-host:
syslog_server_port: "udp://127.0.0.1:514"
bridge_repo_branch: $CODEBASE_BRANCH
verifier:
name: testinfra
lint:
Expand Down
2 changes: 0 additions & 2 deletions deployment/molecule/ultimate-erc-to-erc/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ provisioner:
inventory:
host_vars:
oracle-erc-to-erc-host:
bridge_repo_branch: $CODEBASE_BRANCH
HOME_RPC_URL: "http://parity1:8545"
FOREIGN_RPC_URL: "http://parity2:8545"
VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
ui-erc-to-erc-host:
bridge_repo_branch: $CODEBASE_BRANCH
HOME_RPC_URL: "http://localhost:8541"
FOREIGN_RPC_URL: "http://localhost:8542"
verifier:
Expand Down
2 changes: 0 additions & 2 deletions deployment/molecule/ultimate-erc-to-native/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ provisioner:
inventory:
host_vars:
oracle-erc-to-native-host:
bridge_repo_branch: $CODEBASE_BRANCH
HOME_RPC_URL: "http://parity1:8545"
FOREIGN_RPC_URL: "http://parity2:8545"
VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
ui-erc-to-native-host:
bridge_repo_branch: $CODEBASE_BRANCH
HOME_RPC_URL: "http://localhost:8541"
FOREIGN_RPC_URL: "http://localhost:8542"
verifier:
Expand Down
2 changes: 0 additions & 2 deletions deployment/molecule/ultimate-native-to-erc/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ provisioner:
inventory:
host_vars:
oracle-native-to-erc-host:
bridge_repo_branch: $CODEBASE_BRANCH
HOME_RPC_URL: "http://parity1:8545"
FOREIGN_RPC_URL: "http://parity2:8545"
VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
ui-native-to-erc-host:
bridge_repo_branch: $CODEBASE_BRANCH
HOME_RPC_URL: "http://localhost:8541"
FOREIGN_RPC_URL: "http://localhost:8542"
verifier:
Expand Down
2 changes: 0 additions & 2 deletions deployment/roles/common/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
docker_compose_version: 1.23.2
compose_service_user: poadocker
bridge_path: "/home/{{ compose_service_user }}/bridge"
bridge_repo: https://github.com/poanetwork/tokenbridge.git
bridge_repo_branch: master
1 change: 1 addition & 0 deletions deployment/roles/common/tasks/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- git
- python3
- python3-pip
- rsync

- name: Install Docker Compose
get_url:
Expand Down
33 changes: 23 additions & 10 deletions deployment/roles/common/tasks/repo.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
---
- name: Get bridge repo
git:
repo: "{{ bridge_repo }}"
dest: "{{ bridge_path }}"
force: no
update: no
version: "{{ bridge_repo_branch }}"
- name: Initialize submodules
shell: git submodule update --init
- name: Create repo directory
file:
path: "{{ bridge_path }}"
state: directory

- name: Register files for copying
shell: |
git ls-tree -r HEAD --name-only
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:
chdir: "{{ bridge_path }}"
chdir: ".."

- name: Copy the files
synchronize:
dest: "{{ bridge_path }}"
src: ../../../..
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned in #194 consider to copy just files from git ls-tree -r HEAD --name-only

rsync_opts:
- "--include=\"{{ item }}\""
- "--exclude='*'"
- "-avz"
with_items: rsync_files.stdout_lines