diff --git a/.bldr.toml b/.bldr.toml index 42d1f5e074..726b58ecec 100644 --- a/.bldr.toml +++ b/.bldr.toml @@ -1016,6 +1016,8 @@ plan_path = "socat" plan_path = "spark" [sqitch] plan_path = "sqitch" +[sqitch_pg] +plan_path = "sqitch_pg" [sqlite] plan_path = "sqlite" [sshpass] diff --git a/CODEOWNERS b/CODEOWNERS index 0a8f1e881d..a8b694d7bd 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -154,6 +154,8 @@ protobuf-cpp @afiune rabbitmqadmin @predominant redis @irvingpop shared-mime-info @rsertelon +sqitch @irvingpop +sqitch_pg @irvingpop sqlserver @mwrock sqlserver-ha-ag @mwrock vault @defilan diff --git a/sqitch_pg/README.md b/sqitch_pg/README.md new file mode 100644 index 0000000000..fde3c9c65b --- /dev/null +++ b/sqitch_pg/README.md @@ -0,0 +1,24 @@ +# sqitch_pg +This is a Habitat plan for [Sqitch](http://sqitch.org/) with [DBD-Pg](http://search.cpan.org/dist/DBD-Pg/) which is used to do database deploys to PostgreSQL. + +## Maintainers +The Habitat Maintainers humans@habitat.sh + +## Type of Package + +This is a hybrid binary + library package, designed to make it easy to install Sqitch for PostgreSQL with a single package definition. + +## Usage + +Install this package by running: +``` +hab pkg install -b core/sqitch_pg +``` + +Run this package like so: +``` +cd your_schema_folder +hab pkg exec core/sqitch_pg sqitch --engine pg deploy "db:pg://${USER}:${PASS}@${HOST}/$DB" +``` + +For a complete example, see [this db-migrations script](https://github.com/chef/chef-server/blob/master/src/bookshelf/habitat/config/database-migrations.sh) diff --git a/sqitch_pg/plan.sh b/sqitch_pg/plan.sh new file mode 100644 index 0000000000..20bfce75eb --- /dev/null +++ b/sqitch_pg/plan.sh @@ -0,0 +1,36 @@ +pkg_name=sqitch_pg +pkg_origin=core +pkg_version="3.7.4" +pkg_maintainer="The Habitat Maintainers humans@habitat.sh" +pkg_license=('Artistic-1.0-Perl' 'GPL-2.0') +pkg_deps=( + core/glibc + core/perl + core/postgresql-client + core/zlib + core/sqitch +) +pkg_build_deps=( + core/cpanminus + core/local-lib + core/gcc + core/make +) +pkg_description="Sqitch the database management application, bundled with the DBD::Pg Perl module for PostgreSQL" +pkg_upstream_url="http://sqitch.org/" # Note: also http://search.cpan.org/dist/DBD-Pg/ +pkg_bin_dirs=(bin) + +do_setup_environment() { + push_runtime_env PERL5LIB "${pkg_prefix}/lib/perl5/x86_64-linux-thread-multi" +} + +do_build() { + return 0 +} + +do_install() { + source <(perl -I"$(pkg_path_for core/local-lib)/lib/perl5" -Mlocal::lib="$(pkg_path_for core/local-lib)") + source <(perl -I"$(pkg_path_for core/cpanminus)/lib/perl5" -Mlocal::lib="$(pkg_path_for core/cpanminus)") + source <(perl -Mlocal::lib="$pkg_prefix") + cpanm "DBD::Pg@$pkg_version" --local-lib "$pkg_prefix" +}