|
17 | 17 | ansible.builtin.import_playbook: postgres.yaml |
18 | 18 | vars: |
19 | 19 | host: explorer |
| 20 | + ini_file: ini/config-explorer.ini |
20 | 21 |
|
21 | | -- hosts: explorer |
| 22 | +- name: Setup Explorer |
| 23 | + hosts: explorer |
22 | 24 | vars: |
23 | 25 | service: "explorer" |
24 | 26 |
|
|
31 | 33 | ansible_ssh_user: "{{ admin_user }}" |
32 | 34 |
|
33 | 35 | - name: Clone the aligned_layer repository |
34 | | - register: clone_repo |
35 | 36 | ansible.builtin.git: |
36 | 37 | repo: https://github.com/yetanotherco/aligned_layer |
37 | | - dest: "{{ ansible_env.HOME }}/aligned_layer" |
| 38 | + dest: "/home/{{ ansible_user }}/repos/explorer/aligned_layer" |
| 39 | + version: explorer-ssl |
38 | 40 | update: yes |
39 | 41 |
|
40 | 42 | tasks: |
| 43 | + - name: Add environment file for Explorer |
| 44 | + template: |
| 45 | + src: explorer/explorer_env.j2 |
| 46 | + dest: /home/{{ ansible_user }}/repos/explorer/aligned_layer/explorer/.env |
| 47 | + vars: |
| 48 | + RPC_URL: "{{ lookup('ini', 'RPC_URL file=ini/config-explorer.ini') }}" |
| 49 | + ENVIRONMENT: "{{ lookup('ini', 'ENVIRONMENT file=ini/config-explorer.ini') }}" |
| 50 | + ALIGNED_CONFIG_FILE: "{{ lookup('ini', 'ALIGNED_CONFIG_FILE file=ini/config-explorer.ini') }}" |
| 51 | + PHX_HOST: "{{ lookup('ini', 'PHX_HOST file=ini/config-explorer.ini') }}" |
| 52 | + ELIXIR_HOSTNAME: "{{ lookup('ini', 'ELIXIR_HOSTNAME file=ini/config-explorer.ini') }}" |
| 53 | + DB_NAME: "{{ lookup('ini', 'DB_NAME file=ini/config-explorer.ini') }}" |
| 54 | + DB_USER: "{{ lookup('ini', 'DB_USER file=ini/config-explorer.ini') }}" |
| 55 | + DB_PASS: "{{ lookup('ini', 'DB_PASS file=ini/config-explorer.ini') }}" |
| 56 | + DB_HOST: "{{ lookup('ini', 'DB_HOST file=ini/config-explorer.ini') }}" |
| 57 | + TRACKER_API_URL: "{{ lookup('ini', 'TRACKER_API_URL file=ini/config-explorer.ini') }}" |
| 58 | + SECRET_KEY_BASE: "{{ lookup('ini', 'SECRET_KEY_BASE file=ini/config-explorer.ini') }}" |
| 59 | + |
41 | 60 | - name: Build the explorer release |
42 | 61 | args: |
43 | | - chdir: "{{ clone_repo.git_dir_now }}" |
| 62 | + chdir: "/home/{{ ansible_user }}/repos/explorer/aligned_layer/explorer" |
44 | 63 | environment: |
45 | 64 | MIX_ENV: prod |
46 | | - ansible.builtin.shell: |
| 65 | + shell: |
| 66 | + executable: /bin/bash |
47 | 67 | cmd: | |
48 | 68 | set -ex |
| 69 | + source .env |
49 | 70 | mix local.hex --force |
50 | 71 | mix local.rebar --force |
51 | 72 | mix deps.get --only $MIX_ENV |
52 | 73 | mix compile |
53 | 74 | pnpm --prefix=assets/ install |
54 | 75 | mix phx.digest |
55 | 76 | mix assets.deploy |
56 | | - mix release |
| 77 | + mix release --overwrite |
| 78 | +
|
| 79 | + - name: Set CAP_NET_BIND_SERVICE to beam |
| 80 | + shell: |
| 81 | + cmd: sudo setcap CAP_NET_BIND_SERVICE=+eip /home/app/repos/explorer/aligned_layer/explorer/_build/prod/rel/explorer/erts-14.2.1/bin/beam.smp |
| 82 | + vars: |
| 83 | + ansible_ssh_user: "{{ admin_user }}" |
| 84 | + |
| 85 | + # TODO: add systemd service |
0 commit comments