dockerfile

This commit is contained in:
Stas Kelvich
2021-03-29 15:09:49 +03:00
parent d1ef8a1784
commit 9038116714
3 changed files with 30 additions and 34 deletions

View File

@@ -1,34 +0,0 @@
#
# Purpose of this Makefile is to build and install postgres in a local directory
# so that zenith intergation tests would find pg binaries and support files.
#
# 'make postgres' would do following:
#
# 1) run out-of-source build of postgres in REPO_ROOT/tmp_install/build directory (I'm reusing
# tmp_install path here since it is already present in .gitignore)
#
# 2) installs postgres to REPO_ROOT/tmp_install/
#
# This Makefile is integrated with cargo build by the means of build.rs file (special file
# that cargo build would run if it is present) which will call `make postgres` if there is no
# tmp_install/bin/postgres binary.
#
../tmp_install/build/Makefile:
mkdir -p ../tmp_install/build && \
cd ../tmp_install/build && \
../../configure CFLAGS='-O0' --enable-debug --enable-cassert \
--enable-depend --with-libxml --prefix=/
pg-configure: ../tmp_install/build/Makefile
# this makefile would set env variables that would interfere with postgres build
# preventing it from finding autogenerated headers. Hence 'env -i'
pg-build: pg-configure
env -i make -j8 -C ../tmp_install/build
postgres: pg-build
mkdir -p ../tmp_install/log
env -i make -C ../tmp_install/build \
DESTDIR=/Users/stas/code/postgres/tmp_install install \
> /Users/stas/code/postgres/tmp_install/log/install.log 2>&1

25
pgbuild.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/sh
#
# Purpose of this script is to build and install postgres in a local directory
# so that zenith intergation tests would find pg binaries and support files.
#
# ./pgbuild.sh would do following:
#
# 1) run out-of-source build of postgres in REPO_ROOT/tmp_install/build directory (I'm reusing
# tmp_install path here since it is already present in .gitignore)
#
# 2) installs postgres to REPO_ROOT/tmp_install/
#
REPO_ROOT=$(dirname "$0")/..
REPO_ROOT="`( cd \"$REPO_ROOT\" && pwd )`"
# configure
mkdir -p $REPO_ROOT/tmp_install/build
cd $REPO_ROOT/tmp_install/build
../../configure CFLAGS='-O0' --enable-debug --enable-cassert \
--enable-depend --with-libxml --prefix=/
# compile
make -j8
export DESTDIR=$REPO_ROOT/tmp_install
make install

View File

@@ -23,6 +23,8 @@ lazy_static! {
// postgres would be there if it was build by 'make postgres' here in the repo
pub static ref PG_BIN_DIR : PathBuf = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../tmp_install/bin");
pub static ref PG_LIB_DIR : PathBuf = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../tmp_install/lib");
pub static ref CARGO_BIN_DIR : PathBuf = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("./target/debug/");
@@ -89,6 +91,7 @@ impl PageServerNode {
let initdb = Command::new(PG_BIN_DIR.join("initdb"))
.args(&["-D", self.data_dir.join("wal_redo_pgdata").to_str().unwrap()])
.env_clear()
.env("LD_LIBRARY_PATH", PG_LIB_DIR.to_str().unwrap())
.status()
.expect("failed to execute initdb");
if !initdb.success() {
@@ -193,6 +196,7 @@ impl ComputeControlPlane {
let initdb = Command::new(initdb_path)
.args(&["-D", node.pgdata.to_str().unwrap()])
.env_clear()
.env("LD_LIBRARY_PATH", PG_LIB_DIR.to_str().unwrap())
.status()
.expect("failed to execute initdb");
@@ -254,6 +258,7 @@ impl PostgresNode {
action,
])
.env_clear()
.env("LD_LIBRARY_PATH", PG_LIB_DIR.to_str().unwrap())
.status()
.expect("failed to execute pg_ctl");