-
-
Notifications
You must be signed in to change notification settings - Fork 190
feat: add the supabase admin agent to the ami build #1679
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
Draft
Crispy1975
wants to merge
5
commits into
develop
Choose a base branch
from
pjc/add-supabase-admin-agent
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+301
−21
Draft
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e407b7b
feat: add the supabase admin agent to the ami build
Crispy1975 9b34b24
chore: add the admin agent user to the tests
Crispy1975 7413140
chore: rename file extension for ssa
Crispy1975 4af89b0
chore: fix the admin agent config path
Crispy1975 c3a8b0c
chore: add composite action for downloading artifacts
Crispy1975 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
ansible/files/supabase_admin_agent_config/supabase-admin-agent.sudoers.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
%supabase-admin-agent ALL= NOPASSWD: /usr/bin/salt-call | ||
%supabase-admin-agent ALL= NOPASSWD: /usr/bin/gpg --homedir {{ gpgdir }} --import, /usr/bin/gpg --homedir {{ gpgdir }} --list-secret-keys * |
19 changes: 19 additions & 0 deletions
19
ansible/files/supabase_admin_agent_config/supabase-admin-agent_salt.service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[Unit] | ||
Description=Configuration management via supabase-admin-agent salt | ||
After=network.target | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/opt/supabase-admin-agent/supabase-admin-agent --config /opt/supabase-admin-agent/config.yaml salt --apply --store-result | ||
User=supabase-admin-agent | ||
Group=supabase-admin-agent | ||
StandardOutput=journal | ||
StandardError=journal | ||
StateDirectory=supabase-admin-agent | ||
CacheDirectory=supabase-admin-agent | ||
|
||
# Security hardening | ||
PrivateTmp=true | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
13 changes: 13 additions & 0 deletions
13
ansible/files/supabase_admin_agent_config/supabase-admin-agent_salt.timer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=Run Supabase supabase-admin-agent salt on a schedule | ||
Requires=supabase-admin-agent_salt.service | ||
|
||
[Timer] | ||
OnCalendar=*:0/10 | ||
# Random delay up to {{ splay }} seconds splay | ||
RandomizedDelaySec={{ splay }} | ||
AccuracySec=1s | ||
Persistent=true | ||
|
||
[Install] | ||
WantedBy=timers.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
- name: supabase-admin-agent - system group | ||
group: | ||
name: supabase-admin-agent | ||
system: yes | ||
|
||
- name: supabase-admin-agent - system user | ||
user: | ||
name: supabase-admin-agent | ||
group: supabase-admin-agent | ||
groups: admin,salt | ||
append: yes | ||
system: yes | ||
shell: /bin/sh | ||
|
||
- name: supabase-admin-agent - config dir | ||
file: | ||
path: /opt/supabase-admin-agent | ||
owner: supabase-admin-agent | ||
state: directory | ||
|
||
- name: supabase-admin-agent - gpg dir | ||
file: | ||
path: /etc/salt/gpgkeys | ||
owner: root | ||
group: salt | ||
state: directory | ||
|
||
- name: give supabase-admin-agent user permissions | ||
copy: | ||
src: files/supabase-admin-agent_config/supabase-admin-agent.sudoers.conf | ||
dest: /etc/sudoers.d/supabase-admin-agent | ||
mode: "0644" | ||
|
||
- name: Setting arch (x86) | ||
set_fact: | ||
arch: "x86" | ||
when: platform == "amd64" | ||
|
||
- name: Setting arch (arm) | ||
set_fact: | ||
arch: "arm64" | ||
when: platform == "arm64" | ||
|
||
- name: Download supabase-admin-agent archive | ||
get_url: | ||
url: "https://supabase-internal-artifacts-bucket.s3.amazonaws.com/supabase-admin-agent/v{{ supabase_admin_agent_release }}/supabase-admin-agent-{{ supabase_admin_agent_release }}-linux-{{ arch }}.tar.gz" | ||
dest: "/tmp/supabase-admin-agent.tar.gz" | ||
timeout: 90 | ||
|
||
- name: supabase-admin-agent - unpack archive in /opt | ||
unarchive: | ||
remote_src: yes | ||
src: /tmp/supabase-admin-agent.tar.gz | ||
dest: /opt/supabase-admin-agent/ | ||
owner: supabase-admin-agent | ||
extra_opts: | ||
- --strip-components=1 | ||
|
||
- name: supabase-admin-agent - create symlink | ||
ansible.builtin.file: | ||
path: /opt/supabase-admin-agent/supabase-admin-agent | ||
src: "/opt/supabase-admin-agent/supabase-admin-agent-linux-{{ arch }}" | ||
state: link | ||
owner: supabase-admin-agent | ||
mode: "0755" | ||
force: yes | ||
|
||
- name: supabase-admin-agent - create salt systemd timer file | ||
copy: | ||
src: files/supabase-admin-agent_config/supabase-admin-agent_salt.timer | ||
dest: /etc/systemd/system/supabase-admin-agent_salt.timer | ||
|
||
- name: supabase-admin-agent - create salt service file | ||
copy: | ||
src: files/supabase-admin-agent_config/supabase-admin-agent_salt.service | ||
dest: /etc/systemd/system/supabase-admin-agent_salt.service | ||
|
||
- name: supabase-admin-agent - reload systemd | ||
systemd: | ||
daemon_reload: yes | ||
|
||
# Initially ensure supabase-admin-agent is installed but not started | ||
- name: supabase-admin-agent - DISABLE service | ||
systemd: | ||
name: supabase-admin-agent_salt | ||
enabled: no | ||
state: stopped |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.