8000 Merge pull request #90 from supabase/da/clean-build-utis · chazgorman/postgres-1@119a427 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 119a427

Browse files
authored
Merge pull request supabase#90 from supabase/da/clean-build-utis
Install ansible-pull, and cleanup build deps
2 parents 7ecf5de + 88e66f7 commit 119a427

9 files changed

+86
-222
lines changed

ansible/files/ansible-pull.service

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[Unit]
2+
Description=Ansible pull
3+
4+
[Service]
5+
Type=simple
6+
User=ubuntu
7+
8+
ExecStart=/usr/bin/ansible-pull --private-key "$SSH_READ_KEY_FILE" -U "$REPO" --accept-host-key -t "$REGION,db-all" -i localhost --clean --full "$PLAYBOOK" -v -o -C "$REPO_BRANCH"
9+
10+
# --verify-commit
11+
# temporarily disable commit verification, while we figure out how we want to balance commit signatures
12+
# and PR reviews; an --ff-only merge options would have allowed us to use this pretty nicely
13+
14+
MemoryAccounting=true
15+
MemoryMax=30%
16+
17+
StandardOutput=append:/var/log/ansible-pull.stdout
18+
StandardError=append:/var/log/ansible-pull.error
19+
20+
TimeoutStopSec=600

ansible/files/ansible-pull.timer

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=Run ansible roughly every 3 hours
3+
4+
[Timer]
5+
OnBootSec=1h
6+
OnUnitActiveSec=3h
7+
RandomizedDelaySec=1h
8+
Persistent=true
9+
10+
[Install]
11+
WantedBy=timers.target

ansible/files/queries.yml.j2

Lines changed: 0 additions & 217 deletions
This file was deleted.

ansible/files/supabase_facts.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[general]
2+
postgres_version=13

ansible/playbook.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
tags:
4545
- install-supabase-internal
4646

47+
- name: Clean out build dependencies
48+
import_tasks: tasks/clean-build-dependencies.yml
49+
4750
- name: Adjust APT update intervals
4851
copy:
4952
src: files/apt_periodic
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- name: Remove build dependencies
2+
apt:
3+
pkg:
4+
- bison
5+
- build-essential
6+
- clang-11
7+
- cmake
8+
- cpp
9+
- flex
10+
- g++
11+
- g++-10
12+
- g++-9
13+
- gcc-10
14+
- ninja-build
15+
- python2
16+
- zlib1g-dev
17+
state: absent
18+
autoremove: yes

ansible/tasks/internal/postgres-exporter.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
src: files/postgres_exporter.service.j2
3434
dest: /etc/systemd/system/postgres_exporter.service
3535

36-
- name: exporter copy over queries
37-
template:
38-
src: files/queries.yml.j2
39-
dest: /opt/postgres_exporter/queries.yml
40-
4136
- name: exporter ensure service is present
4237
systemd:
4338
enabled: no
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
- name: install ansible
2+
shell:
3+
cmd: |
4+
apt install -y software-properties-common
5+
add-apt-repository --yes --update ppa:ansible/ansible
6+
apt install -y ansible
7+
sed -i -e 's/#callback_whitelist.*/callback_whitelist = profile_tasks/' /etc/ansible/ansible.cfg
8+
9+
- name: ansible pull systemd units
10+
copy:
11+
src: files/{{ item }}
12+
dest: /etc/systemd/system/{{ item }}
13+
with_items:
14+
- ansible-pull.service
15+
- ansible-pull.timer
16+
17+
- name: create facts dir
18+
file:
19+
path: /etc/ansible/facts.d
20+
state: directory
21+
22+
- name: ansible facts
23+
copy:
24+
src: files/supabase_facts.ini
25+
dest: /etc/ansible/facts.d/supabase.fact
26+
27+
- name: reload systemd
28+
systemd:
29+
daemon_reload: yes

ansible/tasks/setup-supabase-internal.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,8 @@
5151
- name: Install adminapi
5252
import_tasks: internal/admin-api.yml
5353

54+
- name: Install Ansible Pull
55+
import_tasks: internal/setup-ansible-pull.yml
56+
5457
- name: Boot time optimizations
5558
import_tasks: internal/optimizations.yml

0 commit comments

Comments
 (0)
0