Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: do not install candles-api if an external release process is involved #32

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions roles/candles_api/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ candles_api_polygonio_api_key: ""
candles_api_with_caddy_config: false
candles_api_caddy_config_destination: /etc/caddy/sites/candles-api.caddy
candles_api_domains: []
candles_api_external_release_enabled: true
50 changes: 29 additions & 21 deletions roles/candles_api/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,37 @@
groups: sudo,candles-api
append: true

- name: Download candles-api binary
ansible.builtin.get_url:
force: true
url: "https://github.com/{{- candles_api_binary_repository -}}/releases/download/{{- candles_api_binary_version -}}/candles-api-linux-amd64.zip"
dest: &bin_dest /tmp/candles_api.zip
mode: '0600'
- name: Check if candles-api already installed
ansible.builtin.stat:
path: /usr/local/bin/candles-api
register: candles_api_installed

- name: Unpack candles-api
ansible.builtin.unarchive:
src: *bin_dest
remote_src: true
dest: /tmp
when: not ansible_check_mode
- name: Install candles-api
when: not candles_api_external_release_enabled or not candles_api_installed.stat.exists
block:
- name: Download candles-api binary
ansible.builtin.get_url:
force: true
url: "https://github.com/{{- candles_api_binary_repository -}}/releases/download/{{- candles_api_binary_version -}}/candles-api-linux-amd64.zip"
dest: &bin_dest /tmp/candles_api.zip
mode: '0600'

- name: Copy candles-api binary
ansible.builtin.copy:
remote_src: true
src: "/tmp/candles-api-linux-amd64"
dest: /usr/local/bin/candles-api
owner: root
group: root
mode: '0755'
when: not ansible_check_mode
- name: Unpack candles-api
ansible.builtin.unarchive:
src: *bin_dest
remote_src: true
dest: /tmp
when: not ansible_check_mode

- name: Copy candles-api binary
ansible.builtin.copy:
remote_src: true
src: "/tmp/candles-api-linux-amd64"
dest: /usr/local/bin/candles-api
owner: root
group: root
mode: '0755'
when: not ansible_check_mode

- name: Install candles-api systemd files
ansible.builtin.template:
Expand Down
2 changes: 2 additions & 0 deletions roles/docker/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
delay: 3
register: docker_apt_result
until: docker_apt_result is succeeded
when: not ansible_check_mode

- name: Restart docker
ansible.builtin.systemd:
state: restarted
daemon_reload: true
name: docker
when: not ansible_check_mode
5 changes: 5 additions & 0 deletions roles/pyth_price_scheduler/tasks/process-watcher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
src: *watcherdist
remote_src: true
dest: /tmp
when: not ansible_check_mode

- name: Copy the binary
ansible.builtin.copy:
Expand All @@ -19,6 +20,7 @@
owner: root
group: root
mode: '0755'
when: not ansible_check_mode

- name: Copy process watcher config
ansible.builtin.template:
Expand All @@ -27,6 +29,7 @@
owner: root
group: root
mode: '0644'
when: not ansible_check_mode

- name: Copy process watcher service file
ansible.builtin.template:
Expand All @@ -35,10 +38,12 @@
owner: root
group: root
mode: '0644'
when: not ansible_check_mode

- name: Start pusher watcher service
ansible.builtin.service:
name: "pyth-process-watcher"
state: restarted
enabled: true
daemon_reload: true
when: not ansible_check_mode
Loading