Skip to content

Commit 46d6c72

Browse files
committed
Put all the UNIX domain sockets in /var/vcap/sys/run
This was a lot more work than it should have been. Specifically: - Upgraded pgpoolII to 3.5.4 (from 3.5.0) because 3.5.0 didn't properly parse the config file to pull out the `pcp_socket_dir` option. - Patch pgpoolII 3.5.4 to set the default UNIX domain socket directories to be in `/var/vcap/sys/run`, so we don't have to configure it. - Patch postgresql 9.5.1 to set the default UNIX domain socket directories to be in `/var/vcap/sys/run` as well. Fixes #7
1 parent 24da320 commit 46d6c72

File tree

6 files changed

+85
-10
lines changed

6 files changed

+85
-10
lines changed

ci/release_notes.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Upgrades
2+
3+
- pgpoolII upgraded from 3.5.0 to 3.5.4
4+
5+
## Improvements
6+
7+
- All UNIX domain sockets now reside under `/var/vcap/sys/run`,
8+
where they ought to, and not in `/tmp`.

config/blobs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
---
2-
pgpool2/pgpool-II-3.5.0.tar.gz:
3-
object_id: 80b22485-079c-408f-9bb6-b8691bdfd734
4-
sha: f5041afe078bc8c414e4db8ab0119c4e76aaaaab
5-
size: 2205490
62
pgrt/pgrt:
73
object_id: b7968265-d373-404d-b6e0-12caa15f9f98
84
sha: 2f6c7cc5a7b89712be68f2663fdf3fa9f997a2fa
@@ -11,3 +7,7 @@ postgres/postgresql-9.5.1.tar.bz2:
117
object_id: c3acc49c-a9ec-49a1-ae82-e97a00672695
128
sha: 905bc31bc4d500e9498340407740a61835a2022e
139
size: 18441638
10+
pgpool2/pgpool-II-3.5.4.tar.gz:
11+
object_id: c0821167-44de-470e-ad15-48309d6dd44a
12+
sha: 4ea15dc8bb740baf720b18f182b400ea60b1ae45
13+
size: 2237911
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
localhost:<%= p('pgpool.config.pcp_port', 9898) %>:system:<%= p('pcp.system_password') %>
1+
*:<%= p('pgpool.config.pcp_port', 9898) %>:system:<%= p('pcp.system_password') %>

jobs/postgres/templates/config/postgresql.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# postgres main configuration
2+
unix_socket_directories = '/var/vcap/sys/run/postgres/'
3+
4+
##
25
<%
36
pgs = link("db").instances
47
replication = p('postgres.replication.enabled', false) && pgs.size() > 1

packages/pgpool2/packaging

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
set -e # exit immediately if a simple command exits with a non-zero status
2-
set -u # report the usage of uninitialized variables
1+
#!/bin/bash
2+
set -eu
33

44
# Detect # of CPUs so make jobs can be parallelized
55
CPUS=$(grep -c ^processor /proc/cpuinfo)
@@ -10,10 +10,60 @@ export HOME=/var/vcap
1010

1111

1212
# see http://www.pgpool.net/download.php?f=pgpool-II-3.5.0.tar.gz
13-
VERSION=3.5.0
13+
VERSION=3.5.4
1414

1515
tar -xzf pgpool2/pgpool-II-${VERSION}.tar.gz
1616
cd pgpool-II-${VERSION}/
17+
# patch it up, since there isn't much in the way of configure options....
18+
patch -p1 <<EOF
19+
diff -u -ur pgpool-II-3.5.4.pristine/src/include/parser/pg_config_manual.h pgpool-II-3.5.4/src/include/parser/pg_config_manual.h
20+
--- pgpool-II-3.5.4.pristine/src/include/parser/pg_config_manual.h 2016-08-30 05:04:13.000000000 -0400
21+
+++ pgpool-II-3.5.4/src/include/parser/pg_config_manual.h 2016-11-01 22:12:34.000000000 -0400
22+
@@ -189,7 +189,7 @@
23+
* here's where to twiddle it. You can also override this at runtime
24+
* with the postmaster's -k switch.
25+
*/
26+
-#define DEFAULT_PGSOCKET_DIR "/tmp"
27+
+#define DEFAULT_PGSOCKET_DIR "/var/vcap/sys/run/postgres"
28+
29+
/*
30+
* This is the default event source for Windows event log.
31+
diff -u -ur pgpool-II-3.5.4.pristine/src/include/pcp/pcp_stream.h pgpool-II-3.5.4/src/include/pcp/pcp_stream.h
32+
--- pgpool-II-3.5.4.pristine/src/include/pcp/pcp_stream.h 2016-08-30 05:04:13.000000000 -0400
33+
+++ pgpool-II-3.5.4/src/include/pcp/pcp_stream.h 2016-11-01 22:11:45.000000000 -0400
34+
@@ -48,6 +48,6 @@
35+
extern int pcp_write(PCP_CONNECTION *pc, void *buf, int len);
36+
extern int pcp_flush(PCP_CONNECTION *pc);
37+
38+
-#define UNIX_DOMAIN_PATH "/tmp"
39+
+#define UNIX_DOMAIN_PATH "/var/vcap/sys/run/pgpool"
40+
41+
#endif /* PCP_STREAM_H */
42+
diff -u -ur pgpool-II-3.5.4.pristine/src/include/pool.h pgpool-II-3.5.4/src/include/pool.h
43+
--- pgpool-II-3.5.4.pristine/src/include/pool.h 2016-08-30 05:17:56.000000000 -0400
44+
+++ pgpool-II-3.5.4/src/include/pool.h 2016-11-01 22:10:17.000000000 -0400
45+
@@ -72,16 +72,16 @@
46+
#define HBA_CONF_FILE_NAME "pool_hba.conf"
47+
48+
/* pid file directory */
49+
-#define DEFAULT_LOGDIR "/tmp"
50+
+#define DEFAULT_LOGDIR "/var/vcap/sys/log/pgpool"
51+
52+
/* Unix domain socket directory */
53+
-#define DEFAULT_SOCKET_DIR "/tmp"
54+
+#define DEFAULT_SOCKET_DIR "/var/vcap/sys/run/pgpool"
55+
56+
/* Unix domain socket directory for watchdog IPC */
57+
-#define DEFAULT_WD_IPC_SOCKET_DIR "/tmp"
58+
+#define DEFAULT_WD_IPC_SOCKET_DIR "/var/vcap/sys/run/pgpool"
59+
60+
/* pid file name */
61+
-#define DEFAULT_PID_FILE_NAME "/var/run/pgpool/pgpool.pid"
62+
+#define DEFAULT_PID_FILE_NAME "/var/vcap/sys/run/pgpool/pgpool.pid"
63+
64+
/* status file name */
65+
#define STATUS_FILE_NAME "pgpool_status"
66+
EOF
1767
./configure --prefix ${BOSH_INSTALL_TARGET} --with-pgsql=/var/vcap/packages/postgres
1868
make
1969
make install

packages/postgres/packaging

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
set -e # exit immediately if a simple command exits with a non-zero status
2-
set -u # report the usage of uninitialized variables
1+
#!/bin/bash
2+
set -eu
33

44
# Detect # of CPUs so make jobs can be parallelized
55
CPUS=$(grep -c ^processor /proc/cpuinfo)
@@ -12,6 +12,20 @@ export HOME=/var/vcap
1212
VERSION=9.5.1
1313
tar -xjf postgres/postgresql-${VERSION}.tar.bz2
1414
cd postgresql-${VERSION}/
15+
patch -p1 <<EOF
16+
diff -u -ur postgresql-9.5.1.pristine/src/include/pg_config_manual.h postgresql-9.5.1/src/include/pg_config_manual.h
17+
--- postgresql-9.5.1.pristine/src/include/pg_config_manual.h 2016-02-08 16:12:28.000000000 -0500
18+
+++ postgresql-9.5.1/src/include/pg_config_manual.h 2016-11-01 22:21:21.000000000 -0400
19+
@@ -169,7 +169,7 @@
20+
* here's where to twiddle it. You can also override this at runtime
21+
* with the postmaster's -k switch.
22+
*/
23+
-#define DEFAULT_PGSOCKET_DIR "/tmp"
24+
+#define DEFAULT_PGSOCKET_DIR "/var/vcap/sys/run/postgres"
25+
26+
/*
27+
* This is the default event source for Windows event log.
28+
EOF
1529
./configure --prefix ${BOSH_INSTALL_TARGET}
1630
make world
1731
make install-world

0 commit comments

Comments
 (0)