Skip to content

Commit a528f70

Browse files
committed
fix: dealing with locales in stages
1 parent fbe0983 commit a528f70

File tree

4 files changed

+58
-55
lines changed

4 files changed

+58
-55
lines changed

ansible-nix/files/postgresql_config/postgresql.service.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ TimeoutStartSec=86400
1818
Restart=always
1919
RestartSec=5
2020
OOMScoreAdjust=-1000
21+
EnvironmentFile=-/etc/environment.d/postgresql.env
2122

2223
[Install]
2324
WantedBy=multi-user.target

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

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,45 @@
3939

4040
#TODO include ls $(nix profile list | grep glibc-locales | tail -n 1 | cut -d ':' -f 2 | sed 's/^[ \t]*//')/lib/locale-archive
4141

42+
- name: Set permissions for postgresql.env
43+
become: yes
44+
file:
45+
path: /etc/environment.d/postgresql.env
46+
owner: postgres
47+
group: postgres
48+
mode: '0644'
49+
50+
- name: Set ownership of /etc/ssl/private directory
51+
become: yes
52+
file:
53+
path: /etc/ssl/private
54+
owner: root
55+
group: ssl-cert
56+
state: directory
57+
58+
- name: Set permissions for /etc/ssl/private directory
59+
become: yes
60+
file:
61+
path: /etc/ssl/private
62+
mode: '0750'
63+
state: directory
64+
65+
66+
- name: Set ownership of private key file
67+
become: yes
68+
file:
69+
path: /etc/ssl/private/server.key
70+
owner: root
71+
group: ssl-cert
72+
state: file
73+
74+
- name: Set permissions for private key file
75+
become: yes
76+
file:
77+
path: /etc/ssl/private/server.key
78+
mode: '0640'
79+
state: file
80+
4281
- name: Ensure /usr/lib/postgresql/bin directory exists
4382
file:
4483
path: /usr/lib/postgresql/bin
@@ -182,12 +221,10 @@
182221
LC_ALL: en_US.UTF-8
183222
LC_CTYPE: en_US.UTF-8
184223
LOCALE_ARCHIVE: /usr/lib/locale/locale-archive
185-
# LOCALE_ARCHIVE: /usr/lib/locale/locale-archive
186-
# LOCALE_ARCHIVE: /usr/lib/locale/locale-archive
187224
vars:
188225
ansible_command_timeout: 60
189-
# # Circumvents the following error:
190-
# # "Timeout (12s) waiting for privilege escalation prompt"
226+
# Circumvents the following error:
227+
# "Timeout (12s) waiting for privilege escalation prompt"
191228

192229
- name: copy PG systemd unit
193230
template:

ansible-nix/tasks/test-image.yml

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

ebssurrogate/scripts/chroot-bootstrap-nix.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,21 @@ cat << EOF > /etc/default/locale
8686
LANG="C.UTF-8"
8787
LC_CTYPE="C.UTF-8"
8888
EOF
89-
localedef -i en_US -f UTF-8 en_US.UTF-8
89+
locale-gen en_US.UTF-8
90+
}
91+
92+
function setup_postgesql_env {
93+
# Create the directory if it doesn't exist
94+
sudo mkdir -p /etc/environment.d
95+
96+
# Define the contents of the PostgreSQL environment file
97+
cat <<EOF | sudo tee /etc/environment.d/postgresql.env >/dev/null
98+
LOCALE_ARCHIVE=/usr/lib/locale/locale-archive
99+
LANG="en_US.UTF-8"
100+
LANGUAGE="en_US.UTF-8"
101+
LC_ALL="en_US.UTF-8"
102+
LC_CTYPE="en_US.UTF-8"
103+
EOF
90104
}
91105

92106
function install_packages_for_build {
@@ -191,6 +205,7 @@ function cleanup_cache {
191205

192206
update_install_packages
193207
setup_locale
208+
setup_postgesql_env
194209
#install_packages_for_build
195210
install_configure_grub
196211
setup_apparmor

0 commit comments

Comments
 (0)