Skip to content

Commit 51c8abb

Browse files
committed
chore: install, symlink
1 parent f239151 commit 51c8abb

File tree

2 files changed

+79
-65
lines changed

2 files changed

+79
-65
lines changed

ansible/playbook.yml

Lines changed: 1 addition & 1 deletion
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 nixpkg_mode
41+
when: debpkg_mode or stage2_nix
4242

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

ansible/tasks/setup-wal-g.yml

Lines changed: 78 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,73 @@
11
# 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
2+
# - name: wal-g dependencies
3+
# become: yes
4+
# apt:
5+
# pkg:
6+
# - libbrotli-dev
7+
# - liblzo2-dev
8+
# - libsodium-dev
9+
# - cmake
1010

1111
# 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
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
1818

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
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
2424

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
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
3232

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
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
4343

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
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
5454

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
64-
become: yes
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
64+
# become: yes
6565

6666
- name: Create wal-g group
6767
group:
6868
name: wal-g
6969
state: present
70+
when: stage2_nix
7071

7172
- name: Create wal-g user
7273
user:
@@ -75,22 +76,38 @@
7576
comment: WAL-G user
7677
group: wal-g
7778
groups: wal-g, postgres
78-
79+
when: stage2_nix
7980
- name: Create a config directory owned by wal-g
8081
file:
8182
path: /etc/wal-g
8283
state: directory
8384
owner: wal-g
8485
group: wal-g
8586
mode: '0770'
87+
when: stage2_nix
8688

89+
- name: Install wal-g from nix binary cache
90+
become: yes
91+
shell: |
92+
sudo -u wal-g bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#{{psql_version}}/bin"
93+
when: stage2_nix
94+
95+
- name: Create symlink for wal-g from Nix profile to /usr/local/bin
96+
ansible.builtin.file:
97+
src: /home/wal-g/.nix-profile/bin/wal-g
98+
dest: /usr/local/bin/wal-g
99+
state: link
100+
force: yes # This will replace existing file/symlink if it exists
101+
become: yes # Need sudo to write to /usr/local/bin
102+
when: stage2_nix
87103
- name: Create /etc/wal-g/config.json
88104
file:
89105
path: /etc/wal-g/config.json
90106
state: touch
91107
owner: wal-g
92108
group: wal-g
93109
mode: '0664'
110+
when: stage2_nix
94111

95112
- name: Move custom wal-g.conf file to /etc/postgresql-custom/wal-g.conf
96113
template:
@@ -99,6 +116,7 @@
99116
mode: 0664
100117
owner: postgres
101118
group: postgres
119+
when: stage2_nix
102120

103121
- name: Add script to be run for restore_command
104122
template:
@@ -107,24 +125,20 @@
107125
mode: 0500
108126
owner: postgres
109127
group: postgres
128+
when: stage2_nix
110129

111130
- name: Add helper script for wal_fetch.sh
112131
template:
113132
src: "files/walg_helper_scripts/wal_change_ownership.sh"
114133
dest: /root/wal_change_ownership.sh
115134
mode: 0700
116135
owner: root
136+
when: stage2_nix
117137

118138
- name: Include /etc/postgresql-custom/wal-g.conf in postgresql.conf
119139
become: yes
120140
replace:
121141
path: /etc/postgresql/postgresql.conf
122142
regexp: "#include = '/etc/postgresql-custom/wal-g.conf'"
123143
replace: "include = '/etc/postgresql-custom/wal-g.conf'"
124-
125-
# Clean up Go
126-
- name: Uninstall Go
127-
become: yes
128-
file:
129-
path: /usr/local/go
130-
state: absent
144+
when: stage2_nix

0 commit comments

Comments
 (0)