Skip to content

Commit d08267d

Browse files
committed
chore: restore wal-g build approach
1 parent b61a027 commit d08267d

File tree

3 files changed

+72
-15
lines changed

3 files changed

+72
-15
lines changed

Diff for: ansible/playbook.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
- name: Install WAL-G
4040
import_tasks: tasks/setup-wal-g.yml
41-
when: debpkg_mode or stage2_nix
41+
when: debpkg_mode or nixpkg_mode
4242

4343
- name: Install Gotrue
4444
import_tasks: tasks/setup-gotrue.yml

Diff for: ansible/tasks/setup-wal-g.yml

+70-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,72 @@
1-
- name: Install WAL-G with nix profile
2-
shell: |
3-
sudo -u ubuntu bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#wal-g"
1+
# Downloading dependencies
2+
- name: wal-g dependencies
3+
become: yes
4+
apt:
5+
pkg:
6+
- libbrotli-dev
7+
- liblzo2-dev
8+
- libsodium-dev
9+
- cmake
10+
11+
# install go dependency for WAL-G
12+
- name: wal-g go dependency
13+
get_url:
14+
url: "https://golang.org/dl/go{{ golang_version }}.linux-{{ platform }}.tar.gz"
15+
dest: /tmp
16+
checksum: "{{ golang_version_checksum[platform] }}"
17+
timeout: 60
18+
19+
- name: unpack go archive
20+
unarchive:
21+
remote_src: yes
22+
src: "/tmp/go{{ golang_version }}.linux-{{ platform }}.tar.gz"
23+
dest: /usr/local
24+
25+
# Download WAL-G
26+
- name: wal-g - download latest version
27+
git:
28+
repo: https://github.com/wal-g/wal-g.git
29+
dest: /tmp/wal-g
30+
version: "v{{ wal_g_release }}"
31+
become: yes
32+
33+
- name: wal-g - pg_clean
34+
make:
35+
chdir: /tmp/wal-g
36+
target: pg_clean
37+
params:
38+
GOBIN: "/usr/local/bin"
39+
PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin"
40+
USE_LIBSODIUM: true
41+
become: yes
42+
ignore_errors: yes
43+
44+
- name: wal-g - deps
45+
make:
46+
chdir: /tmp/wal-g
47+
target: deps
48+
params:
49+
GOBIN: "/usr/local/bin"
50+
PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin"
51+
USE_LIBSODIUM: true
52+
become: yes
53+
ignore_errors: yes
54+
55+
- name: wal-g - build and install
56+
community.general.make:
57+
chdir: /tmp/wal-g
58+
target: pg_install
59+
jobs: "{{ parallel_jobs | default(omit) }}"
60+
params:
61+
GOBIN: "/usr/local/bin"
62+
PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin"
63+
USE_LIBSODIUM: true
464
become: yes
5-
when: stage2_nix
665

7-
# Create required groups and users
866
- name: Create wal-g group
967
group:
1068
name: wal-g
1169
state: present
12-
when: stage2_nix
1370

1471
- name: Create wal-g user
1572
user:
@@ -18,7 +75,6 @@
1875
comment: WAL-G user
1976
group: wal-g
2077
groups: wal-g, postgres
21-
when: stage2_nix
2278

2379
- name: Create a config directory owned by wal-g
2480
file:
@@ -27,7 +83,6 @@
2783
owner: wal-g
2884
group: wal-g
2985
mode: '0770'
30-
when: stage2_nix
3186

3287
- name: Create /etc/wal-g/config.json
3388
file:
@@ -36,7 +91,6 @@
3691
owner: wal-g
3792
group: wal-g
3893
mode: '0664'
39-
when: stage2_nix
4094

4195
- name: Move custom wal-g.conf file to /etc/postgresql-custom/wal-g.conf
4296
template:
@@ -45,7 +99,6 @@
4599
mode: 0664
46100
owner: postgres
47101
group: postgres
48-
when: stage2_nix
49102

50103
- name: Add script to be run for restore_command
51104
template:
@@ -54,20 +107,24 @@
54107
mode: 0500
55108
owner: postgres
56109
group: postgres
57-
when: stage2_nix
58110

59111
- name: Add helper script for wal_fetch.sh
60112
template:
61113
src: "files/walg_helper_scripts/wal_change_ownership.sh"
62114
dest: /root/wal_change_ownership.sh
63115
mode: 0700
64116
owner: root
65-
when: stage2_nix
66117

67118
- name: Include /etc/postgresql-custom/wal-g.conf in postgresql.conf
68119
become: yes
69120
replace:
70121
path: /etc/postgresql/postgresql.conf
71122
regexp: "#include = '/etc/postgresql-custom/wal-g.conf'"
72123
replace: "include = '/etc/postgresql-custom/wal-g.conf'"
73-
when: stage2_nix
124+
125+
# Clean up Go
126+
- name: Uninstall Go
127+
become: yes
128+
file:
129+
path: /usr/local/go
130+
state: absent

Diff for: ansible/vars.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ kong_deb_checksum: sha1:f458c8b183f79cffae4cd84c989cea4a4ecaaaba
4545
nginx_release: 1.22.0
4646
nginx_release_checksum: sha1:419efb77b80f165666e2ee406ad8ae9b845aba93
4747

48-
wal_g_release: "3.0.5"
48+
wal_g_release: "2.0.1"
4949

5050
postgres_exporter_release: "0.15.0"
5151
postgres_exporter_release_checksum:

0 commit comments

Comments
 (0)