testnet-ops/nitro-contracts-setup/deploy-contracts.yml
Prathamesh Musale 2e0fbd82f1 Update service provider setup to configure laconicd chain id (#12)
Part of [Service Provider setup](https://www.notion.so/Service-provider-setup-a09e2207e1f34f3a847f7ce9713b7ac5) and [Service provider auctions for web deployments](https://www.notion.so/Service-provider-auctions-for-web-deployments-104a6b22d47280dbad51d28aa3a91d75)

- Configure laconicd chain id
- Configure whether deployer should handle auctions and amount to bid
- Update playbook to issue wildcard cert on deploying k8s

Co-authored-by: Adw8 <adwaitgharpure@gmail.com>
Co-authored-by: Shreerang Kale <shreerangkale@gmail.com>
Reviewed-on: #12
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-21 10:22:32 +00:00

102 lines
3.9 KiB
YAML

- name: Deploy nitro contracts
hosts: "{{ target_host }}"
vars_files:
- setup-vars.yml
- contract-vars.yml
environment:
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
tasks:
- name: Create directory for nitro bridge deployment
file:
path: "{{ nitro_directory }}"
state: directory
- name: Change owner of nitro-directory
file:
path: "{{ nitro_directory }}"
owner: "{{ansible_user}}"
group: "{{ansible_user}}"
state: directory
recurse: yes
- name: Clone nitro stack repo
expect:
command: laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack --git-ssh --pull
responses:
"Are you sure you want to continue connecting \\(yes/no/\\[fingerprint\\]\\)\\?": "yes"
timeout: 300
ignore_errors: yes
- name: Clone repositories required for nitro-stack
expect:
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts setup-repositories --git-ssh --pull
responses:
"Are you sure you want to continue connecting \\(yes/no/\\[fingerprint\\]\\)\\?": "yes"
timeout: 300
ignore_errors: yes
- name: Build containers
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts build-containers --force-rebuild
when: not skip_container_build
- name: Generate spec file for nitro contracts deployment
template:
src: "./templates/specs/nitro-contracts-spec.yml.j2"
dest: "{{ nitro_directory }}/nitro-contracts-spec.yml"
- name: Check if deployment exists for nitro contracts
stat:
path: "{{ nitro_directory }}/nitro-contracts-deployment"
register: nitro_contracts_deployment
- name: Create a deployment for nitro contracts
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts deploy create --spec-file nitro-contracts-spec.yml --deployment-dir nitro-contracts-deployment
args:
chdir: "{{ nitro_directory }}"
when: not nitro_contracts_deployment.stat.exists
- name: Start deployment for nitro-contracts
command: laconic-so deployment --dir nitro-contracts-deployment start
args:
chdir: "{{ nitro_directory }}"
- name: Wait for the contracts to be deployed
wait_for:
path: "{{ nitro_directory }}/nitro-contracts-deployment/data/nitro_deployment/nitro-addresses.json"
timeout: 300
- name: Export NA_ADDRESS
shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.NitroAdjudicator.address' /app/deployment/nitro-addresses.json"
args:
chdir: "{{ nitro_directory }}"
register: na_address
- debug:
msg: "NA_ADDRESS: {{ na_address.stdout }}"
- name: Export CA_ADDRESS
shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json"
args:
chdir: "{{ nitro_directory }}"
register: ca_address
- debug:
msg: "CA_ADDRESS: {{ ca_address.stdout }}"
- name: Export VPA_ADDRESS
shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json"
args:
chdir: "{{ nitro_directory }}"
register: vpa_address
- debug:
msg: "VPA_ADDRESS: {{ vpa_address.stdout }}"
- name: Export ASSET_ADDRESS
shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.{{ token_name }}.address' /app/deployment/nitro-addresses.json"
args:
chdir: "{{ nitro_directory }}"
register: asset_address
- debug:
msg: "ASSET_ADDRESS: {{ asset_address.stdout }}"