Add Sigvild Gallery wedding photo application with automated deployment and improve Caddy plugin management
This commit is contained in:
43
roles/sigvild-gallery/tasks/deploy_backend.yml
Normal file
43
roles/sigvild-gallery/tasks/deploy_backend.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
# Backend Deployment Tasks
|
||||
|
||||
- name: Build Go binary locally
|
||||
local_action:
|
||||
module: shell
|
||||
cmd: GOOS=linux GOARCH=amd64 go build -o sigvild-gallery .
|
||||
chdir: "{{ sigvild_gallery_local_project_path }}"
|
||||
become: no
|
||||
tags: [backend, build]
|
||||
|
||||
- name: Check if binary was built successfully
|
||||
local_action:
|
||||
module: stat
|
||||
path: "{{ sigvild_gallery_local_project_path }}/sigvild-gallery"
|
||||
register: binary_stat
|
||||
become: no
|
||||
tags: [backend, build]
|
||||
|
||||
- name: Fail if binary doesn't exist
|
||||
fail:
|
||||
msg: "Failed to build sigvild-gallery binary"
|
||||
when: not binary_stat.stat.exists
|
||||
tags: [backend, build]
|
||||
|
||||
- name: Transfer Go binary
|
||||
copy:
|
||||
src: "{{ sigvild_gallery_local_project_path }}/sigvild-gallery"
|
||||
dest: "{{ sigvild_gallery_binary }}"
|
||||
owner: "{{ sigvild_gallery_user }}"
|
||||
group: "{{ sigvild_gallery_user }}"
|
||||
mode: '0755'
|
||||
notify: restart sigvild-gallery
|
||||
tags: [backend]
|
||||
|
||||
- name: Create data directory for PocketBase
|
||||
file:
|
||||
path: "{{ sigvild_gallery_data_dir }}"
|
||||
state: directory
|
||||
owner: "{{ sigvild_gallery_user }}"
|
||||
group: "{{ sigvild_gallery_user }}"
|
||||
mode: '0755'
|
||||
tags: [backend]
|
||||
Reference in New Issue
Block a user