Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init pghero #72975

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions pkgs/development/ruby-modules/gem-config/default.nix
Expand Up @@ -416,6 +416,22 @@ in
];
};

pg_query = attrs:
let
libpg_query = fetchurl {
url = "https://codeload.github.com/lfittl/libpg_query/tar.gz/10-1.0.1";
sha256 = "0m5jv134hgw2vcfkqlnw80fr3wmrdvgrvk1ndcx9s44bzi5nsp47";
};
in {

dontBuild = false;
postPatch = ''
substituteInPlace ext/pg_query/extconf.rb \
--replace "'https://codeload.github.com/lfittl/libpg_query/tar.gz/' + LIB_PG_QUERY_TAG" \
"'${libpg_query}'"
'';
};

puma = attrs: {
buildInputs = [ openssl ];
};
Expand Down
10 changes: 10 additions & 0 deletions pkgs/development/tools/database/pghero/Gemfile
@@ -0,0 +1,10 @@
source "https://rubygems.org"

gem "rails", "~> 5.2.0"
gem "pg", "< 1" # < 1 for Debian 7 and CentOS 6 builds
gem "pghero" #, git: "https://github.com/ankane/pghero.git"
gem "pg_query"
gem "aws-sdk-cloudwatch"
gem "puma"
gem "activerecord-nulldb-adapter", require: false
gem "tzinfo-data"
149 changes: 149 additions & 0 deletions pkgs/development/tools/database/pghero/Gemfile.lock
@@ -0,0 +1,149 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.3)
actionpack (= 5.2.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.3)
actionview (= 5.2.3)
activesupport (= 5.2.3)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.3)
activesupport (= 5.2.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.3)
activesupport (= 5.2.3)
globalid (>= 0.3.6)
activemodel (5.2.3)
activesupport (= 5.2.3)
activerecord (5.2.3)
activemodel (= 5.2.3)
activesupport (= 5.2.3)
arel (>= 9.0)
activerecord-nulldb-adapter (0.4.0)
activerecord (>= 2.0.0)
activestorage (5.2.3)
actionpack (= 5.2.3)
activerecord (= 5.2.3)
marcel (~> 0.3.1)
activesupport (5.2.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (9.0.0)
aws-eventstream (1.0.3)
aws-partitions (1.235.0)
aws-sdk-cloudwatch (1.30.0)
aws-sdk-core (~> 3, >= 3.71.0)
aws-sigv4 (~> 1.1)
aws-sdk-core (3.75.0)
aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1, >= 1.228.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sigv4 (1.1.0)
aws-eventstream (~> 1.0, >= 1.0.2)
builder (3.2.3)
concurrent-ruby (1.1.5)
crass (1.0.5)
erubi (1.9.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.7.0)
concurrent-ruby (~> 1.0)
jmespath (1.4.0)
loofah (2.3.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mimemagic (0.3.3)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.13.0)
nio4r (2.5.2)
nokogiri (1.10.5)
mini_portile2 (~> 2.4.0)
pg (0.21.0)
pg_query (1.1.0)
pghero (2.3.0)
activerecord (>= 5)
puma (4.2.1)
nio4r (~> 2.0)
rack (2.0.7)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.3)
actioncable (= 5.2.3)
actionmailer (= 5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
activemodel (= 5.2.3)
activerecord (= 5.2.3)
activestorage (= 5.2.3)
activesupport (= 5.2.3)
bundler (>= 1.3.0)
railties (= 5.2.3)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (5.2.3)
actionpack (= 5.2.3)
activesupport (= 5.2.3)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rake (13.0.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (0.20.3)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
tzinfo-data (1.2019.3)
tzinfo (>= 1.0.0)
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)

PLATFORMS
ruby

DEPENDENCIES
activerecord-nulldb-adapter
aws-sdk-cloudwatch
pg (< 1)
pg_query
pghero
puma
rails (~> 5.2.0)
tzinfo-data

BUNDLED WITH
1.17.3
48 changes: 48 additions & 0 deletions pkgs/development/tools/database/pghero/default.nix
@@ -0,0 +1,48 @@
{ stdenv, fetchFromGitHub, bundlerEnv, writeShellScriptBin }:
let
env = bundlerEnv {
name = "pghero";
gemdir = ./.;
};

pghero = stdenv.mkDerivation rec {
pname = "pghero";
version = (import ./gemset.nix).pghero.version;
src = fetchFromGitHub {
owner = "pghero";
repo = "pghero";
rev = "v2.3.0";
sha256 = "0fh6ssxp3gh50sqd0sl264p62jg1swdgkm7wi5dfsqc8rh8zcpbz";
};

buildInputs = [ env ];

RAILS_ENV = "production";
DATABASE_URL = "postgresql://user:pass@127.0.0.1/dbname";
SECRET_TOKEN = "dummytoken";

buildPhase = ''
mkdir -p $out/lib $out/bin
cp -r $src $out/lib/pghero/
chmod u+rw -R $out
cd $out/lib/pghero
rake assets:precompile
rm -rf tmp
'';

installPhase = ''
echo "#!${stdenv.shell}" > $out/bin/pghero
echo "cd $out/lib/pghero" >> $out/bin/pghero
echo "${env}/bin/puma -C config/puma.rb" >> $out/bin/pghero
chmod +x $out/bin/pghero
'';

meta = with stdenv.lib; {
description = "Performance dashboard for PostgreSQL";
homepage = "https://pghero.org/";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ manveru ];
};
};
in pghero