123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- ---
- # Configure and start joystream-node RPC service on the servers
- - name: Print bootNodes
- debug:
- var: result.result.bootNodes
- run_once: true
- - name: Create a service file
- template:
- src: joystream-node.service.j2
- dest: /etc/systemd/system/joystream-node.service
- vars:
- template_remote_chain_spec_path: '{{ remote_chain_spec_path }}'
- boot_nodes: '{{ result.result.bootNodes }}'
- become: yes
- - name: Start service joystream-node, if not started
- service:
- name: joystream-node
- state: started
- enabled: yes
- become: yes
- - name: Build required packages
- shell: yarn build:packages
- args:
- chdir: '{{ remote_code_path }}'
- # Run in async fashion for max duration of 1 hr
- async: 3600
- poll: 0
- register: build_result
- - name: Check on build async task
- async_status:
- jid: '{{ build_result.ansible_job_id }}'
- register: job_result
- until: job_result.finished
- # Max number of times to check for status
- retries: 36
- # Check for the status every 100s
- delay: 100
- - name: Make sure docker is running
- command: systemctl start docker
- become: yes
- - name: Run service containers
- command: yarn start
- environment:
- PERSIST: 'true'
- JOYSTREAM_NODE_WS: 'ws://{{ inventory_hostname }}:9944/'
- COLOSSUS_1_URL: 'https://{{ inventory_hostname }}.nip.io/colossus-1/'
- DISTRIBUTOR_1_URL: 'https://{{ inventory_hostname }}.nip.io/distributor-1/'
- SKIP_NODE: 'true'
- SKIP_CHAIN_SETUP: '{{ skip_chain_setup }}'
- TREASURY_ACCOUNT_URI: '{{ endowed_key }}'
- SUDO_ACCOUNT_URI: '{{ sudo_key }}'
- args:
- chdir: '{{ remote_code_path }}'
- async: 3600
- poll: 0
- register: compose_result
- - name: Check on yarn start task
- async_status:
- jid: '{{ compose_result.ansible_job_id }}'
- register: job_result
- until: job_result.finished
- # Max number of times to check for status
- retries: 36
- # Check for the status every 100s
- delay: 100
- - name: Set websocket and http endpoint variables
- set_fact:
- nip_domain: '{{ inventory_hostname }}.nip.io'
- run_once: yes
- - name: Install and configure Caddy
- include_role:
- name: caddy_ansible.caddy_ansible
- apply:
- become: yes
- vars:
- caddy_config: "{{ lookup('template', 'templates/Caddyfile.j2') }}"
- caddy_systemd_capabilities_enabled: true
- caddy_update: false
- - name: Set endpoints
- set_fact:
- all_services: |
- websocket_rpc: wss://{{ nip_domain }}/ws-rpc
- http_rpc: https://{{ nip_domain }}/http-rpc
- colossus: https://{{ nip_domain }}/colossus-1
- distributor: https://{{ nip_domain }}/distributor-1
- graphql_server: https://{{ nip_domain }}/query-node/server/graphql
- graphql_server_websocket: wss://{{ nip_domain }}/query-node/server/graphql
- indexer: https://{{ nip_domain }}/query-node/indexer/graphql
- member_faucet: https://{{ nip_domain }}/member-faucet/register
- config: https://{{ nip_domain }}/network/config.json
- run_once: yes
- - name: Print endpoints
- debug:
- msg: '{{ all_services | from_yaml }}'
- run_once: yes
- - name: Create config.json to serve as Caddy endpoint
- copy:
- content: '{{ all_services | from_yaml | to_json }}'
- dest: '/home/ubuntu/config.json'
- - name: Save output as file on local
- copy:
- content: '{{ all_services | from_yaml | to_json }}'
- dest: 'endpoints.json'
- delegate_to: localhost
|