Skip to content

Commit 70a3f8e

Browse files
committed
chore: cleaning up and triggering build
1 parent 09e31e4 commit 70a3f8e

File tree

7 files changed

+7
-156
lines changed

7 files changed

+7
-156
lines changed

.github/workflows/ami-release-nix.yml

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -40,54 +40,9 @@ jobs:
4040
exit 1
4141
fi
4242
43-
# - id: args
44-
# uses: mikefarah/yq@master
45-
# with:
46-
# cmd: yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml'
47-
# - run: docker context create builders
48-
# - uses: docker/setup-buildx-action@v3
49-
# with:
50-
# endpoint: builders
51-
# - uses: docker/build-push-action@v5
52-
# with:
53-
# build-args: |
54-
# ${{ steps.args.outputs.result }}
55-
# target: extensions
56-
# tags: supabase/postgres:extensions
57-
# platforms: linux/${{ matrix.arch }}
58-
# outputs: type=tar,dest=/tmp/extensions.tar
59-
# cache-from: type=gha,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
60-
# # No need to export extensions cache because latest depends on it
61-
62-
# - name: Extract built packages
63-
# run: |
64-
# mkdir -p ansible/files/extensions
65-
# tar xvf /tmp/extensions.tar -C ansible/files/extensions --strip-components 1
66-
# TODO remove this block as extensions are build in nix prior to this step
67-
68-
# - id: version
69-
# run: echo "${{ steps.args.outputs.result }}" | grep "postgresql" >> "$GITHUB_OUTPUT"
70-
# - name: Build Postgres deb
71-
# uses: docker/build-push-action@v5
72-
# with:
73-
# file: docker/Dockerfile
74-
# target: pg-deb
75-
# build-args: |
76-
# ubuntu_release=${{ matrix.ubuntu_release }}
77-
# ubuntu_release_no=${{ matrix.ubuntu_version }}
78-
# postgresql_major=${{ steps.version.outputs.postgresql_major }}
79-
# postgresql_release=${{ steps.version.outputs.postgresql_release }}
80-
# CPPFLAGS=-mcpu=${{ matrix.mcpu }}
81-
# tags: supabase/postgres:deb
82-
# platforms: linux/${{ matrix.arch }}
83-
# outputs: type=tar,dest=/tmp/pg-deb.tar
84-
# cache-from: type=gha,scope=${{ github.ref_name }}-deb
85-
# cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-deb
86-
# - name: Extract Postgres deb
87-
# run: |
88-
# mkdir -p ansible/files/postgres
89-
# tar xvf /tmp/pg-deb.tar -C ansible/files/postgres --strip-components 1
90-
#TODO remove this block as deb is build in nix prior to this step
43+
# extensions are build in nix prior to this step
44+
# so we can just use the binaries from the nix store
45+
# for postgres, extensions and wrappers
9146

9247
- name: Build AMI stage 1
9348
run: |

ansible-nix/tasks/setup-postgres.yml

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
# - name: Postgres - install commons
2-
# apt:
3-
# name: postgresql-common
4-
# install_recommends: no
5-
6-
# - name: Do not create main cluster
7-
# shell:
8-
# cmd: sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf
9-
#
10-
# TODO These lines appear to be installing and configuring https://launchpad.net/ubuntu/+source/postgresql-common
11-
# as far as I can see, we don't need this now.
12-
131
- name: create ssl-cert group
142
group:
153
name: ssl-cert
@@ -23,15 +11,6 @@
2311
name: postgres
2412
state: present
2513

26-
# - name: create users
27-
# user:
28-
# name: postgres
29-
# groups: postgres, ssl-cert
30-
# createhome: yes
31-
# append: no
32-
# shell: /bin/bash # Set shell if needed, default is /bin/bash
33-
# password: ''
34-
3514
- name: create postgres user
3615
shell: useradd -m -r -s /bin/bash -d /home/postgres postgres -g postgres
3716
args:
@@ -136,9 +115,8 @@
136115
group: postgres
137116

138117
# # Install extensions before init
139-
# - name: Install Postgres extensions
140-
# import_tasks: tasks/setup-docker.yml
141-
# TODO resolve in new build
118+
# (samrose) moved to tasks/stage2/setup-extensions.yml
119+
# now called from stage2/stage2-setup-postgres.yml
142120

143121

144122
# init DB

ansible-nix/tasks/stage2/optimizations.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
# - name: ensure services are stopped
2-
# community.general.snap:
3-
# name: amazon-ssm-agent
4-
# state: absent
5-
# TODO taking this out as machine at this stage reports
6-
# that aws-ssm-agent is not installed at all
7-
81
- name: ensure services are stopped and disabled for first boot
92
systemd:
103
enabled: no
114
name: '{{ item }}'
125
state: stopped
136
with_items:
14-
#- snapd
157
- postgresql
168
- pgbouncer
179
- fail2ban
@@ -24,17 +16,6 @@
2416
pkg:
2517
- snapd
2618

27-
# - name: ensure services are stopped and disabled for first boot
28-
# systemd:
29-
# enabled: no
30-
# name: '{{ item }}'
31-
# state: stopped
32-
# masked: yes
33-
# with_items:
34-
# - lvm2-monitor
35-
# machine at this stage reports this service is stopped and disabled
36-
37-
3819
- name: disable man-db
3920
become: yes
4021
file:

ansible-nix/tasks/stage2/setup-extensions.yml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
# - name: Copy extension packages
2-
# copy:
3-
# src: files/extensions/
4-
# dest: /tmp/extensions/
5-
6-
# # Builtin apt module does not support wildcard for deb paths
7-
# - name: Install extensions
8-
# shell: |
9-
# set -e
10-
# apt-get update
11-
# apt-get install -y --no-install-recommends /tmp/extensions/*.deb
12-
# TODO remove
13-
14-
# The following tasks were moved to stage 2 from the original ansible/tasks/setup-docker.yml
15-
# due to these configurations being required to be applied at this stage, after the database package
16-
# has been installed and before the database is started.
17-
# These tasks are required to be run before the database is started, as they modify the database configuration
18-
191
- name: pg_cron - set cron.database_name
202
become: yes
213
lineinfile:
@@ -78,9 +60,3 @@
7860
path: /etc/postgresql/postgresql.conf
7961
regexp: "#include = '/etc/postgresql-custom/supautils.conf'"
8062
replace: "include = '/etc/postgresql-custom/supautils.conf'"
81-
82-
# - name: Cleanup - extension packages
83-
# file:
84-
# path: /tmp/extensions
85-
# state: absent
86-
# TODO remove extensions are already packaged in the nix build

ansible-nix/tasks/stage2/stage2-setup-postgres.yml

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,13 @@
22
become: yes
33
shell: |
44
sudo -u postgres bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/sam/2-stage-ami-nix#psql_15/bin"
5+
#TODO (samrose) switch pg_prove sourcing to develop branch once PR is merged
56

67
- name: Install pg_prove from nix binary cache
78
become: yes
89
shell: |
910
sudo -u postgres bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/sam/2-stage-ami-nix#pg_prove"
1011
11-
#TODO switch pg_prove sourcing to develop branch once PR is merged
12-
13-
# - name: Generate en_US.UTF-8 locale
14-
# command: sudo localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
15-
16-
17-
# - name: Add LOCALE_ARCHIVE to .bashrc
18-
# ansible.builtin.lineinfile:
19-
# dest: "/home/postgres/.bashrc"
20-
# line: 'export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive'
21-
# create: yes
22-
# become: yes
23-
# become_user: postgres
24-
25-
# - name: Add LANG items to .bashrc
26-
# ansible.builtin.lineinfile:
27-
# dest: "/home/postgres/.bashrc"
28-
# line: "{{ item }}"
29-
30-
# loop:
31-
# - 'export LANG="en_US.UTF-8"'
32-
# - 'export LANGUAGE="en_US.UTF-8"'
33-
# - 'export LC_ALL="en_US.UTF-8"'
34-
# - 'export LANG="en_US.UTF-8"'
35-
# - 'export LC_CTYPE="en_US.UTF-8"'
36-
# become: yes
37-
# become_user: postgres
38-
39-
40-
#TODO include ls $(nix profile list | grep glibc-locales | tail -n 1 | cut -d ':' -f 2 | sed 's/^[ \t]*//')/lib/locale-archive
41-
4212
- name: Set ownership and permissions for /etc/ssl/private
4313
become: yes
4414
file:
@@ -146,7 +116,6 @@
146116
state: directory
147117
recurse: yes
148118

149-
# TODO check that these dirs were created correctly in final AMI
150119
- name: Recursively create symbolic links and set permissions for the contrib/postgis-* dir
151120
shell: >
152121
sudo mkdir -p /usr/lib/postgresql/share/postgresql/contrib && \
@@ -186,12 +155,6 @@
186155
owner: postgres
187156
group: postgres
188157

189-
# - name: Set LANG environment variable
190-
# environment:
191-
# LANG: en_US.UTF-8
192-
# #become: yes
193-
#source /home/postgres/.bashrc &&
194-
195158
- name: Initialize the database
196159
become: yes
197160
become_user: postgres

common-nix.vars.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.6.1.52-nix-staged"
1+
postgres-version = "15.6.1.53-nix-staged"

nix/ext/wrappers/default.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ buildPgrxExtension_0_11_3 rec {
3030
CARGO="${cargo}/bin/cargo";
3131

3232
cargoLock = {
33-
#TODO when we move to newer versions this lockfile will need to be sourced
34-
# from ${src}/Cargo.lock
3533
lockFile = "${src}/Cargo.lock";
3634
outputHashes = {
3735
"clickhouse-rs-1.0.0-alpha.1" = "sha256-0zmoUo/GLyCKDLkpBsnLAyGs1xz6cubJhn+eVqMEMaw=";

0 commit comments

Comments
 (0)