diff --git a/deployment-e2e/Dockerfile b/deployment-e2e/Dockerfile index c7cf4406..bb798167 100644 --- a/deployment-e2e/Dockerfile +++ b/deployment-e2e/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7-stretch +FROM python:3.7 RUN curl -fsSL https://get.docker.com | sh -RUN pip3 install docker molecule==2.22rc1 molecule[docker] flake8 +RUN pip3 install docker molecule[docker,ansible] pytest pytest-testinfra flake8 WORKDIR mono/deployment-e2e diff --git a/deployment-e2e/molecule/monitor/molecule.yml b/deployment-e2e/molecule/monitor/molecule.yml index 8b8542d0..9163e950 100644 --- a/deployment-e2e/molecule/monitor/molecule.yml +++ b/deployment-e2e/molecule/monitor/molecule.yml @@ -3,12 +3,6 @@ dependency: name: galaxy driver: name: docker -lint: - name: yamllint - enabled: True - options: - config-data: - ignore: ../../hosts.yml platforms: - name: monitor-host groups: @@ -22,11 +16,6 @@ platforms: - /var/run/docker.sock:/var/run/docker.sock provisioner: name: ansible - lint: - name: ansible-lint - enabled: True - options: - r: ["bug"] playbooks: prepare: ../prepare.yml converge: ./converge.yml @@ -37,14 +26,11 @@ provisioner: syslog_server_port: "udp://127.0.0.1:514" verifier: name: testinfra - lint: - name: flake8 additional_files_or_dirs: - ../../tests/* scenario: name: monitor test_sequence: - - lint - cleanup - destroy - dependency diff --git a/deployment-e2e/molecule/multiple/molecule.yml b/deployment-e2e/molecule/multiple/molecule.yml index 0f03732f..050b706b 100644 --- a/deployment-e2e/molecule/multiple/molecule.yml +++ b/deployment-e2e/molecule/multiple/molecule.yml @@ -3,12 +3,6 @@ dependency: name: galaxy driver: name: docker -lint: - name: yamllint - enabled: True - options: - config-data: - ignore: ../../hosts.yml platforms: - name: multiple-host groups: @@ -23,11 +17,6 @@ platforms: - /var/run/docker.sock:/var/run/docker.sock provisioner: name: ansible - lint: - name: ansible-lint - enabled: True - options: - r: ["bug"] playbooks: prepare: ../prepare.yml converge: ../monitor/converge.yml @@ -39,14 +28,11 @@ provisioner: syslog_server_port: "udp://127.0.0.1:514" verifier: name: testinfra - lint: - name: flake8 additional_files_or_dirs: - ../../tests/* scenario: name: multiple test_sequence: - - lint - cleanup - destroy - dependency diff --git a/deployment-e2e/molecule/oracle/molecule.yml b/deployment-e2e/molecule/oracle/molecule.yml index e3ff47ec..133e8017 100644 --- a/deployment-e2e/molecule/oracle/molecule.yml +++ b/deployment-e2e/molecule/oracle/molecule.yml @@ -3,18 +3,12 @@ dependency: name: galaxy driver: name: docker -lint: - name: yamllint - enabled: True - options: - config-data: - ignore: ../../hosts.yml platforms: - name: oracle-host groups: - example children: - - oracle + - oracle_swarm image: ubuntu:16.04 privileged: true network_mode: host @@ -22,29 +16,22 @@ platforms: - /var/run/docker.sock:/var/run/docker.sock provisioner: name: ansible - lint: - name: ansible-lint - enabled: True - options: - r: ["bug"] playbooks: prepare: ../prepare.yml converge: ../../../deployment/site.yml inventory: host_vars: oracle-host: - ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "6c48435bd464a53ed66ed62127c4dba8af75cf1a99a8ebe2680599948fbfbc6d" + ORACLE_VALIDATOR_KEYSTORE_PATH: "../../../e2e-commons/keystore.json" + ORACLE_VALIDATOR_KEYSTORE_PASSWORD: "12345678" syslog_server_port: "udp://127.0.0.1:514" verifier: name: testinfra - lint: - name: flake8 additional_files_or_dirs: - ../../tests/* scenario: name: oracle test_sequence: - - lint - cleanup - destroy - dependency diff --git a/deployment-e2e/molecule/oracle/tests/test_oracle.py b/deployment-e2e/molecule/oracle/tests/test_oracle.py index 147ff81a..68ae3e9e 100644 --- a/deployment-e2e/molecule/oracle/tests/test_oracle.py +++ b/deployment-e2e/molecule/oracle/tests/test_oracle.py @@ -3,22 +3,21 @@ import pytest import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('oracle') + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('oracle_swarm') @pytest.mark.parametrize("name", [ - ("oracle_rabbit_1"), - ("oracle_redis_1"), - ("oracle_bridge_request_1"), - ("oracle_bridge_collected_1"), - ("oracle_bridge_affirmation_1"), - ("oracle_bridge_senderhome_1"), - ("oracle_bridge_senderforeign_1"), - ("oracle_bridge_shutdown_1"), + ("oracle_rabbit"), + ("oracle_redis"), + ("oracle_bridge_request"), + ("oracle_bridge_collected"), + ("oracle_bridge_affirmation"), + ("oracle_bridge_senderhome"), + ("oracle_bridge_senderforeign"), + ("oracle_bridge_shutdown"), ]) def test_docker_containers(host, name): - container = host.docker(name) - assert container.is_running + assert host.docker(name) is not None @pytest.mark.parametrize("service", [ diff --git a/deployment-e2e/molecule/ultimate-amb/molecule.yml b/deployment-e2e/molecule/ultimate-amb/molecule.yml index c523faf8..a6bf6d09 100644 --- a/deployment-e2e/molecule/ultimate-amb/molecule.yml +++ b/deployment-e2e/molecule/ultimate-amb/molecule.yml @@ -25,8 +25,6 @@ provisioner: ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" verifier: name: testinfra - lint: - name: flake8 scenario: name: ultimate-amb test_sequence: diff --git a/deployment-e2e/molecule/ultimate-erc-to-native/molecule.yml b/deployment-e2e/molecule/ultimate-erc-to-native/molecule.yml index 79084fc1..9ddb0448 100644 --- a/deployment-e2e/molecule/ultimate-erc-to-native/molecule.yml +++ b/deployment-e2e/molecule/ultimate-erc-to-native/molecule.yml @@ -27,8 +27,6 @@ provisioner: ORACLE_FOREIGN_START_BLOCK: 1 verifier: name: testinfra - lint: - name: flake8 scenario: name: ultimate-erc-to-native test_sequence: diff --git a/deployment/requirements.txt b/deployment/requirements.txt deleted file mode 100644 index 81e83c69..00000000 --- a/deployment/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -# pre-release because it contains "CI Fixes for ansible 2.8" -molecule==2.22rc1 -docker -flake8 diff --git a/deployment/roles/common/tasks/dependencies.yml b/deployment/roles/common/tasks/dependencies.yml index bdee6a57..f7586866 100644 --- a/deployment/roles/common/tasks/dependencies.yml +++ b/deployment/roles/common/tasks/dependencies.yml @@ -46,6 +46,9 @@ group: docker createhome: yes +- name: reset ssh connection to allow user changes to affect ansible user + meta: reset_connection + - name: Install auditd apt: name: auditd diff --git a/deployment/roles/oracle_swarm/tasks/jumpbox.yml b/deployment/roles/oracle_swarm/tasks/jumpbox.yml index 792ed436..35e08611 100644 --- a/deployment/roles/oracle_swarm/tasks/jumpbox.yml +++ b/deployment/roles/oracle_swarm/tasks/jumpbox.yml @@ -4,3 +4,5 @@ name: "{{ oracle_image }}" source: pull when: skip_pull is undefined + vars: + ansible_python_interpreter: /usr/bin/python3 diff --git a/deployment/roles/oracle_swarm/tasks/post_config.yml b/deployment/roles/oracle_swarm/tasks/post_config.yml index e624e79e..e67e3186 100644 --- a/deployment/roles/oracle_swarm/tasks/post_config.yml +++ b/deployment/roles/oracle_swarm/tasks/post_config.yml @@ -29,6 +29,8 @@ name: oracle_keystore state: present data_src: "{{ keystore_path }}" + vars: + ansible_python_interpreter: /usr/bin/python3 - name: Remove unencrypted keystore file file: diff --git a/deployment/roles/oracle_swarm/tasks/pre_config.yml b/deployment/roles/oracle_swarm/tasks/pre_config.yml index b91da506..03d7874b 100644 --- a/deployment/roles/oracle_swarm/tasks/pre_config.yml +++ b/deployment/roles/oracle_swarm/tasks/pre_config.yml @@ -4,11 +4,15 @@ state: present autolock_managers: yes listen_addr: 127.0.0.1:2377 + vars: + ansible_python_interpreter: /usr/bin/python3 - name: Get unlock token community.docker.docker_swarm_info: unlock_key: yes register: result + vars: + ansible_python_interpreter: /usr/bin/python3 - name: Print unlock token debug: diff --git a/deployment/roles/oracle_swarm/templates/.env.j2 b/deployment/roles/oracle_swarm/templates/.env.j2 new file mode 100644 index 00000000..575c05e0 --- /dev/null +++ b/deployment/roles/oracle_swarm/templates/.env.j2 @@ -0,0 +1,86 @@ +## General settings +ORACLE_BRIDGE_MODE={{ ORACLE_BRIDGE_MODE }} +{% if ORACLE_LOG_LEVEL | default('') != '' %} +ORACLE_LOG_LEVEL={{ ORACLE_LOG_LEVEL }} +{% endif %} + +## Home contract +COMMON_HOME_RPC_URL={{ COMMON_HOME_RPC_URL }} +COMMON_HOME_BRIDGE_ADDRESS={{ COMMON_HOME_BRIDGE_ADDRESS }} +ORACLE_HOME_RPC_POLLING_INTERVAL={{ ORACLE_HOME_RPC_POLLING_INTERVAL }} + +## Foreign contract +COMMON_FOREIGN_RPC_URL={{ COMMON_FOREIGN_RPC_URL }} +{% if ORACLE_FOREIGN_ARCHIVE_RPC_URL | default('') != '' %} +ORACLE_FOREIGN_ARCHIVE_RPC_URL={{ ORACLE_FOREIGN_ARCHIVE_RPC_URL }} +{% endif %} +COMMON_FOREIGN_BRIDGE_ADDRESS={{ COMMON_FOREIGN_BRIDGE_ADDRESS }} +ORACLE_FOREIGN_RPC_POLLING_INTERVAL={{ ORACLE_FOREIGN_RPC_POLLING_INTERVAL }} + +{% if ORACLE_TX_REDUNDANCY | default('') != '' %} +ORACLE_TX_REDUNDANCY={{ ORACLE_TX_REDUNDANCY }} +{% endif %} + +## Gasprice +{% if COMMON_HOME_GAS_PRICE_SUPPLIER_URL | default('') != '' %} +COMMON_HOME_GAS_PRICE_SUPPLIER_URL={{ COMMON_HOME_GAS_PRICE_SUPPLIER_URL }} +{% endif %} +{% if COMMON_HOME_GAS_PRICE_SPEED_TYPE | default('') != '' %} +COMMON_HOME_GAS_PRICE_SPEED_TYPE={{ COMMON_HOME_GAS_PRICE_SPEED_TYPE }} +{% endif %} +COMMON_HOME_GAS_PRICE_FALLBACK={{ COMMON_HOME_GAS_PRICE_FALLBACK }} +{% if ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL | default('') != '' %} +ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL={{ ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL }} +{% endif %} +{% if COMMON_HOME_GAS_PRICE_FACTOR | default('') != '' %} +COMMON_HOME_GAS_PRICE_FACTOR={{ COMMON_HOME_GAS_PRICE_FACTOR }} +{% endif %} + +{% if COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL | default('') != '' %} +COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL={{ COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL }} +{% endif %} +{% if COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE | default('') != '' %} +COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE={{ COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE }} +{% endif %} +COMMON_FOREIGN_GAS_PRICE_FALLBACK={{ COMMON_FOREIGN_GAS_PRICE_FALLBACK }} +{% if ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL | default('') != '' %} +ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL={{ ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL }} +{% endif %} +{% if COMMON_FOREIGN_GAS_PRICE_FACTOR | default('') != '' %} +COMMON_FOREIGN_GAS_PRICE_FACTOR={{ COMMON_FOREIGN_GAS_PRICE_FACTOR }} +{% endif %} + +## Transport configuration +ORACLE_ALLOW_HTTP_FOR_RPC={{ "yes" if ORACLE_ALLOW_HTTP_FOR_RPC else "no" }} +ORACLE_QUEUE_URL={{ ORACLE_QUEUE_URL }} +ORACLE_REDIS_URL={{ ORACLE_REDIS_URL }} +{% if ORACLE_FOREIGN_TX_RESEND_INTERVAL | default('') != '' %} +ORACLE_FOREIGN_TX_RESEND_INTERVAL={{ ORACLE_FOREIGN_TX_RESEND_INTERVAL }} +{% endif %} +{% if ORACLE_HOME_TX_RESEND_INTERVAL | default('') != '' %} +ORACLE_HOME_TX_RESEND_INTERVAL={{ ORACLE_HOME_TX_RESEND_INTERVAL }} +{% endif %} + +## Emergency shutdown configuration +{% if ORACLE_SHUTDOWN_SERVICE_URL | default('') != '' %} +ORACLE_SHUTDOWN_SERVICE_URL={{ ORACLE_SHUTDOWN_SERVICE_URL }} +{% endif %} +{% if ORACLE_SHUTDOWN_SERVICE_POLLING_INTERVAL | default('') != '' %} +ORACLE_SHUTDOWN_SERVICE_POLLING_INTERVAL={{ ORACLE_SHUTDOWN_SERVICE_POLLING_INTERVAL }} +{% endif %} +{% if ORACLE_SIDE_RPC_URL | default('') != '' %} +ORACLE_SIDE_RPC_URL={{ ORACLE_SIDE_RPC_URL }} +{% endif %} +{% if ORACLE_SHUTDOWN_CONTRACT_ADDRESS | default('') != '' %} +ORACLE_SHUTDOWN_CONTRACT_ADDRESS={{ ORACLE_SHUTDOWN_CONTRACT_ADDRESS }} +{% endif %} +{% if ORACLE_SHUTDOWN_CONTRACT_METHOD | default('') != '' %} +ORACLE_SHUTDOWN_CONTRACT_METHOD={{ ORACLE_SHUTDOWN_CONTRACT_METHOD }} +{% endif %} + +{% if ORACLE_HOME_START_BLOCK | default('') != '' %} +ORACLE_HOME_START_BLOCK={{ ORACLE_HOME_START_BLOCK }} +{% endif %} +{% if ORACLE_FOREIGN_START_BLOCK | default('') != '' %} +ORACLE_FOREIGN_START_BLOCK={{ ORACLE_FOREIGN_START_BLOCK }} +{% endif %} diff --git a/e2e-commons/keystore.json b/e2e-commons/keystore.json new file mode 100644 index 00000000..d8e27456 --- /dev/null +++ b/e2e-commons/keystore.json @@ -0,0 +1 @@ +[{"version":3,"id":"e7e64a1b-5e61-4c17-a473-963d2bbb59e5","address":"d138a69eb2da1c3518e792737c820b23cce62e4b","crypto":{"ciphertext":"f6ddf0b2638fb9fd5777de2aa07937b5ee9bc17acc74c8e6e6580e2dfd0d3de6","cipherparams":{"iv":"bcdbc5af4582887e5cdcf264e8d5b80d"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"f9e621918990e64e278e0fb8cf0343219e1cceaea8547d50fae452ad8f42f231","n":8192,"r":8,"p":1},"mac":"34149cd0b3ddea52588825d403fb75cfb8b864b616d455f75f2de001cc2601ed"}}]