-
Notifications
You must be signed in to change notification settings - Fork 269
/
supabase.yml
executable file
·87 lines (77 loc) · 2.99 KB
/
supabase.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env ansible-playbook
---
#==============================================================#
# File : supabase.yml
# Desc : init supabase cluster
# Ctime : 2024-11-24
# Mtime : 2024-11-24
# Path : supabase.yml
# Docs : https://pigsty.io/docs/kernel/supabase/
# License : AGPLv3 @ https://pigsty.io/docs/about/license
# Copyright : 2018-2024 Ruohang Feng / Vonng ([email protected])
#==============================================================#
#---------------------------------------------------------------
# Usage
#---------------------------------------------------------------
# ./configure -c supa # use the supabase template, modify it to fit your needs
# ./install.yml # install pigsty components: infra, node, minio, pgsql
# ./supabase.yml # launch supabase with docker compose
#---------------------------------------------------------------
# Tasks
#---------------------------------------------------------------
# - supa-image : copy local docker images to remote (optional)
# - supa-docker : install & launch docker daemon on supabase nodes
# - supa-init : install supabase with docker compose
# - supa_copy : copy app/supabse to /opt/supabase
# - supa_config : overwrite /opt/supabsae/.env config
# - supa_launch : cd /opt/supabase docker compose up
#---------------------------------------------------------------
# [OPTIONAL], copy local supabase docker images
# put docker saved *.tgz tarball under /tmp/supabase
- name: SUPABASE IMAGE
become: yes
hosts: supabase
tags: [ supa-image, image ]
gather_facts: no
tasks:
- name: copy local docker images
copy: src="{{ item }}" dest="/tmp/docker/"
with_fileglob: "{{ supa_images }}"
vars: # you can override this with -e cli args
supa_images: /tmp/supabase/*.tgz
# install docker on the hard-coded `supabase` group
- name: SUPABASE DOCKER
become: yes
hosts: supabase
gather_facts: no
tags: [ supa-docker, docker ]
roles:
- { role: node_id ,tags: id }
- { role: docker ,tags: docker }
# install supabase with docker compose
- name: SUPABASE INSTALL
become: yes
hosts: supabase
gather_facts: no
tags: [ supa-init , supabase ]
tasks:
# copy app/supabase to /opt/supabase
- name: copy supabase app dir
tags: supa_copy
copy: src="{{ playbook_dir }}/app/supabase/" dest=/opt/supabase/
# copy app/supabase to /opt/supabase
- name: overwrite supabase config
tags: supa_config
lineinfile:
path: /opt/supabase/.env
regexp: '^{{ item.key | upper }}='
line: '{{ item.key | upper }}={{ item.value if item.value is not boolean else item.value | string | lower }}'
create: yes
loop: "{{ supa_config | dict2items }}"
# it may take a while to pull images, or very fast if you already have local image loaded
- name: start supabase
tags: supa_launch
shell:
cmd: docker compose up -d
chdir: /opt/supabase
...