main.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ---
  2. # Configure and start joystream-node RPC service on the servers
  3. - name: Print bootNodes
  4. debug:
  5. var: result.result.bootNodes
  6. run_once: true
  7. - name: Create a service file
  8. template:
  9. src: joystream-node.service.j2
  10. dest: /etc/systemd/system/joystream-node.service
  11. vars:
  12. template_remote_chain_spec_path: "{{ remote_chain_spec_path }}"
  13. boot_nodes: "{{ result.result.bootNodes }}"
  14. become: yes
  15. - name: Start service joystream-node, if not started
  16. service:
  17. name: joystream-node
  18. state: started
  19. enabled: yes
  20. become: yes
  21. - name: Build required packages
  22. shell: yarn build:packages
  23. args:
  24. chdir: '{{ remote_code_path }}'
  25. # Run in async fashion for max duration of 1 hr
  26. async: 3600
  27. poll: 0
  28. register: build_result
  29. - name: Check on build async task
  30. async_status:
  31. jid: '{{ build_result.ansible_job_id }}'
  32. register: job_result
  33. until: job_result.finished
  34. # Max number of times to check for status
  35. retries: 36
  36. # Check for the status every 100s
  37. delay: 100
  38. - name: Run query node containers
  39. command: yarn workspace query-node-root start:dev
  40. environment:
  41. JOYSTREAM_NODE_WS: 'ws://{{ inventory_hostname }}:9944/'
  42. args:
  43. chdir: '{{ remote_code_path }}'
  44. async: 1800
  45. poll: 0
  46. register: compose_result
  47. - name: Check on yarn start task
  48. async_status:
  49. jid: '{{ compose_result.ansible_job_id }}'
  50. register: job_result
  51. until: job_result.finished
  52. # Max number of times to check for status
  53. retries: 18
  54. # Check for the status every 100s
  55. delay: 100
  56. - name: Set websocket and http endpoint variables
  57. set_fact:
  58. ws_rpc: "{{ inventory_hostname }}.nip.io/ws-rpc"
  59. http_rpc: "{{ inventory_hostname }}.nip.io/http-rpc"
  60. nip_domain: "{{ inventory_hostname }}.nip.io"
  61. run_once: yes
  62. - name: Install and configure Caddy
  63. include_role:
  64. name: caddy_ansible.caddy_ansible
  65. apply:
  66. become: yes
  67. vars:
  68. caddy_config: "{{ lookup('template', 'templates/Caddyfile.j2') }}"
  69. caddy_systemd_capabilities_enabled: true
  70. caddy_update: false
  71. - name: Print RPC node DNS
  72. debug:
  73. msg: "RPC Endpoint: wss://{{ ws_rpc }}"