~alpine/devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[alpine-devel] [PATCH] testing/pgagent: new aport

Rafał Rzepecki <divided.mind@gmail.com>
Details
Message ID
<1416518609-29322-1-git-send-email-divided.mind@gmail.com>
Sender timestamp
1416518609
DKIM signature
missing
Download raw message
Patch: +111 -0
http://www.pgadmin.org/docs/dev/pgagent.html
a job scheduler for PostgreSQL
---
 testing/pgagent/APKBUILD      | 64 +++++++++++++++++++++++++++++++++++++++++++
 testing/pgagent/pgagent.confd | 22 +++++++++++++++
 testing/pgagent/pgagent.initd | 25 +++++++++++++++++
 3 files changed, 111 insertions(+)
 create mode 100644 testing/pgagent/APKBUILD
 create mode 100644 testing/pgagent/pgagent.confd
 create mode 100644 testing/pgagent/pgagent.initd

diff --git a/testing/pgagent/APKBUILD b/testing/pgagent/APKBUILD
new file mode 100644
index 0000000..ae9eaea
--- /dev/null
+++ b/testing/pgagent/APKBUILD
@@ -0,0 +1,64 @@
# Contributor: Rafal Rzepecki <rafal@conjur.net>
# Maintainer:
pkgname=pgagent
pkgver=3.4.0
pkgrel=0
pkgdesc="a job scheduler for PostgreSQL"
url="http://www.pgadmin.org/docs/dev/pgagent.html"
arch="all"
license="POSTGRESQL"
depends="wxgtk2.8-base postgresql"
depends_dev="wxgtk2.8-dev postgresql-dev"
makedepends="$depends_dev cmake"
install=""
subpackages="$pkgname-doc"
source="
	https://ftp.postgresql.org/pub/pgadmin3/release/pgagent/pgAgent-$pkgver-Source.tar.gz
	pgagent.initd
	pgagent.confd
"

_builddir="$srcdir"/pgAgent-$pkgver-Source
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	cmake -DCMAKE_INSTALL_PREFIX=/usr -DSTATIC_BUILD:BOOLEAN=FALSE
	make || return 1
}

package() {
	cd "$_builddir"

	make DESTDIR="$pkgdir" install

	# remove useless doc files
	rm "$pkgdir"/usr/README
	rm "$pkgdir"/usr/LICENSE

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname || return 1
	install -m644 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname || return 1

	install -Dm644 "$_builddir"/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
	install -Dm644 "$_builddir"/README "$pkgdir"/usr/share/doc/$pkgname/README
}

md5sums="187caa1843f0d82f6caa1be0f80d6232  pgAgent-3.4.0-Source.tar.gz
c719d251f7617583864b9b5f7128bf6f  pgagent.initd
c64e1925e38a93ad66f701d3015ae970  pgagent.confd"
sha256sums="0da0ac8f453cf34ab6f708eee036bed0fd0e5fa311de283b92d2ff06600bbb3d  pgAgent-3.4.0-Source.tar.gz
b37ac8a8e95144e19c04cc02fd508515b44ef4ac74b2572e48c55d91b04d679f  pgagent.initd
2bdf4166ff53c57b382788b89818e6c3298fbaa291092236883bd03e08970d4b  pgagent.confd"
sha512sums="3b068fc6f5e51ff20604f8cec3e067d04b5b1537229da15ee442000f5fe834697a4eae86be0e9a58b8ee5da24cc985c8c9804d71cb2a50e93ec4cf9a424a4ff0  pgAgent-3.4.0-Source.tar.gz
e84bf6c3a2bb9d2d8afad2dda7ebcac80ede19a5595ccbe31251731917c3f2337ca3fca68bc47ca8f51bb6e765a0c1e54eabf60466a42d1a6938399d13b71a79  pgagent.initd
fe9fcdd33225a361cbd007ac5bef439946714da9a990169222b8ba88e63362a753e80490ab9402f146ec6a6782b3457846039cc0ad84bf0cdf0c231deec1c286  pgagent.confd"
diff --git a/testing/pgagent/pgagent.confd b/testing/pgagent/pgagent.confd
new file mode 100644
index 0000000..a85be20
--- /dev/null
+++ b/testing/pgagent/pgagent.confd
@@ -0,0 +1,22 @@
# Pool time interval
PGA_POLL="10"

# Retry period
PGA_RETRY="30"

# Log file
PGA_LOG="/var/log/pgagent.log"

# Logging verbosity
# ERROR=0, WARNING=1, DEBUG=2
PGA_LEVEL="1"

# Server parameters
# Host address
PG_HOST="localhost"

# DB name
PG_DBNAME="postgres"

# Username
PG_USER="postgres"
diff --git a/testing/pgagent/pgagent.initd b/testing/pgagent/pgagent.initd
new file mode 100644
index 0000000..0e37fcc
--- /dev/null
+++ b/testing/pgagent/pgagent.initd
@@ -0,0 +1,25 @@
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/pgagent/files/pgagent.initd,v 1.1 2012/04/28 18:34:11 titanofold Exp $

PGAGENTOPT="-t ${PGA_POLL} -r ${PGA_RETRY} -s ${PGA_LOG} -l ${PGA_LEVEL}"

PGOPT="hostaddr=${PG_HOST} dbname=${PG_DBNAME} user=${PG_USER}"

depend() {
    use net
    need postgresql
}

start() {
    ebegin "Starting pgagent"
    start-stop-daemon --start --exec /usr/bin/pgagent -- ${PGAGENTOPT} ${PGOPT}
    eend $?
}

stop() {
    ebegin "Stopping pgagent"
    start-stop-daemon --stop --name pgagent
    eend $?
}
-- 
2.1.3



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20141121083330.736d8ec5@ncopa-desktop.alpinelinux.org>
In-Reply-To
<1416518609-29322-1-git-send-email-divided.mind@gmail.com> (view parent)
Sender timestamp
1416555210
DKIM signature
missing
Download raw message
On Thu, 20 Nov 2014 16:23:29 -0500
Rafa* Rzepecki <divided.mind@gmail.com> wrote:

> http://www.pgadmin.org/docs/dev/pgagent.html
> a job scheduler for PostgreSQL
> ---
>  testing/pgagent/APKBUILD      | 64 +++++++++++++++++++++++++++++++++++++++++++
>  testing/pgagent/pgagent.confd | 22 +++++++++++++++
>  testing/pgagent/pgagent.initd | 25 +++++++++++++++++
>  3 files changed, 111 insertions(+)
>  create mode 100644 testing/pgagent/APKBUILD
>  create mode 100644 testing/pgagent/pgagent.confd
>  create mode 100644 testing/pgagent/pgagent.initd

Thanks! I applied it, but I have a few questions below.


> diff --git a/testing/pgagent/APKBUILD b/testing/pgagent/APKBUILD
> new file mode 100644
> index 0000000..ae9eaea
> --- /dev/null
> +++ b/testing/pgagent/APKBUILD
> @@ -0,0 +1,64 @@
> +# Contributor: Rafal Rzepecki <rafal@conjur.net>
> +# Maintainer:
> +pkgname=pgagent
> +pkgver=3.4.0
> +pkgrel=0
> +pkgdesc="a job scheduler for PostgreSQL"
> +url="http://www.pgadmin.org/docs/dev/pgagent.html"
> +arch="all"
> +license="POSTGRESQL"
> +depends="wxgtk2.8-base postgresql"

What does it need from wxgtk2.8-base that is not pulled in automatic as
SO (shared object) dependency? Normally abuild will automatically add
the dependencies for dynamic libs.

I n this case, abuild will automatically add so:libwx_baseu-2.8.so.0 as
a dependency which (currently) wxgtk2.8-base provides.

I suspect that wxgtk2.8-base can be removed from depends unless I am
missing something.

Does the server really need to run on the same server as the agent? If
not, then we should not have a hard dependency for the postgresql
server.

...

> diff --git a/testing/pgagent/pgagent.confd b/testing/pgagent/pgagent.confd
> new file mode 100644
> index 0000000..a85be20
> --- /dev/null
> +++ b/testing/pgagent/pgagent.confd
> @@ -0,0 +1,22 @@
> +# Pool time interval
> +PGA_POLL="10"
> +
> +# Retry period
> +PGA_RETRY="30"
> +
> +# Log file
> +PGA_LOG="/var/log/pgagent.log"

Having the log file in /var/log means it needs to have root
permissions. Does the agent really need to run as root?

> diff --git a/testing/pgagent/pgagent.initd b/testing/pgagent/pgagent.initd
> new file mode 100644
> index 0000000..0e37fcc
> --- /dev/null
> +++ b/testing/pgagent/pgagent.initd
> @@ -0,0 +1,25 @@
> +#!/sbin/runscript
> +# Copyright 1999-2012 Gentoo Foundation
> +# Distributed under the terms of the GNU General Public License v2
> +# $Header: /var/cvsroot/gentoo-x86/dev-db/pgagent/files/pgagent.initd,v 1.1 2012/04/28 18:34:11 titanofold Exp $
> +
> +PGAGENTOPT="-t ${PGA_POLL} -r ${PGA_RETRY} -s ${PGA_LOG} -l ${PGA_LEVEL}"
> +
> +PGOPT="hostaddr=${PG_HOST} dbname=${PG_DBNAME} user=${PG_USER}"
> +
> +depend() {
> +    use net
> +    need postgresql

Does the agent really require that a postgresql server runs on this
host even if the PG_HOST is pointing to some other host?

I suspect that you can actually run the agent on different host than the
postgresql server and in that case, you don't need postgresql. It
should probably say "use postgresql".

> +}
> +
> +start() {
> +    ebegin "Starting pgagent"
> +    start-stop-daemon --start --exec /usr/bin/pgagent -- ${PGAGENTOPT} ${PGOPT}
> +    eend $?
> +}
> +
> +stop() {
> +    ebegin "Stopping pgagent"
> +    start-stop-daemon --stop --name pgagent
> +    eend $?
> +}

-nc


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Rafał Rzepecki <divided.mind@gmail.com>
Details
Message ID
<CAJu-Zix8jx3dmws-bsr7QEYhcSXP-8i6RPJg1aaUMpUYsXprFQ@mail.gmail.com>
In-Reply-To
<20141121083330.736d8ec5@ncopa-desktop.alpinelinux.org> (view parent)
Sender timestamp
1416595208
DKIM signature
missing
Download raw message
On Fri, Nov 21, 2014 at 2:33 AM, Natanael Copa <ncopa@alpinelinux.org> wrote:
>
> On Thu, 20 Nov 2014 16:23:29 -0500
> Rafa* Rzepecki <divided.mind@gmail.com> wrote:
>
> > http://www.pgadmin.org/docs/dev/pgagent.html
> > a job scheduler for PostgreSQL
> > ---
> >  testing/pgagent/APKBUILD      | 64 +++++++++++++++++++++++++++++++++++++++++++
> >  testing/pgagent/pgagent.confd | 22 +++++++++++++++
> >  testing/pgagent/pgagent.initd | 25 +++++++++++++++++
> >  3 files changed, 111 insertions(+)
> >  create mode 100644 testing/pgagent/APKBUILD
> >  create mode 100644 testing/pgagent/pgagent.confd
> >  create mode 100644 testing/pgagent/pgagent.initd
>
> Thanks! I applied it, but I have a few questions below.

Thanks! It's my first Alpine package, so I do appreciate the feedback
and will try to fix it.

> > diff --git a/testing/pgagent/APKBUILD b/testing/pgagent/APKBUILD
> > new file mode 100644
> > index 0000000..ae9eaea
> > --- /dev/null
> > +++ b/testing/pgagent/APKBUILD
> > @@ -0,0 +1,64 @@
> > +# Contributor: Rafal Rzepecki <rafal@conjur.net>
> > +# Maintainer:
> > +pkgname=pgagent
> > +pkgver=3.4.0
> > +pkgrel=0
> > +pkgdesc="a job scheduler for PostgreSQL"
> > +url="http://www.pgadmin.org/docs/dev/pgagent.html"
> > +arch="all"
> > +license="POSTGRESQL"
> > +depends="wxgtk2.8-base postgresql"
>
> What does it need from wxgtk2.8-base that is not pulled in automatic as
> SO (shared object) dependency? Normally abuild will automatically add
> the dependencies for dynamic libs.
>
> I n this case, abuild will automatically add so:libwx_baseu-2.8.so.0 as
> a dependency which (currently) wxgtk2.8-base provides.
>
> I suspect that wxgtk2.8-base can be removed from depends unless I am
> missing something.
>
> Does the server really need to run on the same server as the agent? If
> not, then we should not have a hard dependency for the postgresql
> server.

Yes, you're right; I didn't know what was the established convention
here, the wiki page on creating packages doesn't mention so-deps at
all.

> > diff --git a/testing/pgagent/pgagent.confd b/testing/pgagent/pgagent.confd
> > new file mode 100644
> > index 0000000..a85be20
> > --- /dev/null
> > +++ b/testing/pgagent/pgagent.confd
> > @@ -0,0 +1,22 @@
> > +# Pool time interval
> > +PGA_POLL="10"
> > +
> > +# Retry period
> > +PGA_RETRY="30"
> > +
> > +# Log file
> > +PGA_LOG="/var/log/pgagent.log"
>
> Having the log file in /var/log means it needs to have root
> permissions. Does the agent really need to run as root?

It doesn't and shouldn't; in fact it should run as postgres in the
case the scripts are used verbatim. Frankly I just copied them from
Gentoo without much thought :) Those things probably should get
reported 'upstream' once we converge on the best solution.

Anyway, what's the preferred way to setup logging in this case? A
post-install script that creates a /var/log subdirectory with proper
permissions?

Also, I'm not entirely sure what the user should be. If the agent is
running on a local postgres, it's most practical (even if not the most
secure) if it runs as 'postgres' user so it has superuser on the
database; if it's not running on the local server, the scripts aren't
generic enough to make it work anyway (auth needs to be set up, which
might be done in a number of different ways -- password, kerberos,
ident, ssl, etc.) so an admin would have to modify the init script
anyway.

> > diff --git a/testing/pgagent/pgagent.initd b/testing/pgagent/pgagent.initd
> > new file mode 100644
> > index 0000000..0e37fcc
> > --- /dev/null
> > +++ b/testing/pgagent/pgagent.initd
> > @@ -0,0 +1,25 @@
> > +#!/sbin/runscript
> > +# Copyright 1999-2012 Gentoo Foundation
> > +# Distributed under the terms of the GNU General Public License v2
> > +# $Header: /var/cvsroot/gentoo-x86/dev-db/pgagent/files/pgagent.initd,v 1.1 2012/04/28 18:34:11 titanofold Exp $
> > +
> > +PGAGENTOPT="-t ${PGA_POLL} -r ${PGA_RETRY} -s ${PGA_LOG} -l ${PGA_LEVEL}"
> > +
> > +PGOPT="hostaddr=${PG_HOST} dbname=${PG_DBNAME} user=${PG_USER}"
> > +
> > +depend() {
> > +    use net
> > +    need postgresql
>
> Does the agent really require that a postgresql server runs on this
> host even if the PG_HOST is pointing to some other host?
>
> I suspect that you can actually run the agent on different host than the
> postgresql server and in that case, you don't need postgresql. It
> should probably say "use postgresql".

Yes, thanks; as mentioned above it's just lifted from Gentoo verbatim.
I agree it should probably have use postgres, but heed the
aforementioned comments about how one would probably modify the script
anyway in anything different than the most common case.

I'm not sure how to approach it best. Ideas are welcome :)

> > +}
> > +
> > +start() {
> > +    ebegin "Starting pgagent"
> > +    start-stop-daemon --start --exec /usr/bin/pgagent -- ${PGAGENTOPT} ${PGOPT}
> > +    eend $?
> > +}
> > +
> > +stop() {
> > +    ebegin "Stopping pgagent"
> > +    start-stop-daemon --stop --name pgagent
> > +    eend $?
> > +}
>
> -nc




-- 
Rafał Rzepecki


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20141216144718.6aec8aef@ncopa-desktop.alpinelinux.org>
In-Reply-To
<CAJu-Zix8jx3dmws-bsr7QEYhcSXP-8i6RPJg1aaUMpUYsXprFQ@mail.gmail.com> (view parent)
Sender timestamp
1418737638
DKIM signature
missing
Download raw message
On Fri, 21 Nov 2014 13:40:08 -0500
Rafa* Rzepecki <divided.mind@gmail.com> wrote:

> On Fri, Nov 21, 2014 at 2:33 AM, Natanael Copa <ncopa@alpinelinux.org> wrote:
> >
> > On Thu, 20 Nov 2014 16:23:29 -0500
> > Rafa* Rzepecki <divided.mind@gmail.com> wrote:
> >
> > > http://www.pgadmin.org/docs/dev/pgagent.html
> > > a job scheduler for PostgreSQL
> > > ---
...
> > > diff --git a/testing/pgagent/pgagent.confd b/testing/pgagent/pgagent.confd
> > > new file mode 100644
> > > index 0000000..a85be20
> > > --- /dev/null
> > > +++ b/testing/pgagent/pgagent.confd
> > > @@ -0,0 +1,22 @@
> > > +# Pool time interval
> > > +PGA_POLL="10"
> > > +
> > > +# Retry period
> > > +PGA_RETRY="30"
> > > +
> > > +# Log file
> > > +PGA_LOG="/var/log/pgagent.log"
> >
> > Having the log file in /var/log means it needs to have root
> > permissions. Does the agent really need to run as root?
> 
> It doesn't and shouldn't; in fact it should run as postgres in the
> case the scripts are used verbatim. Frankly I just copied them from
> Gentoo without much thought :) Those things probably should get
> reported 'upstream' once we converge on the best solution.
> 
> Anyway, what's the preferred way to setup logging in this case? A
> post-install script that creates a /var/log subdirectory with proper
> permissions?
> 
> Also, I'm not entirely sure what the user should be. If the agent is
> running on a local postgres, it's most practical (even if not the most
> secure) if it runs as 'postgres' user so it has superuser on the
> database; if it's not running on the local server, the scripts aren't
> generic enough to make it work anyway (auth needs to be set up, which
> might be done in a number of different ways -- password, kerberos,
> ident, ssl, etc.) so an admin would have to modify the init script
> anyway.

I think we can run it as postgresql as default and make the
alternatives configurable.

> 
> > > diff --git a/testing/pgagent/pgagent.initd b/testing/pgagent/pgagent.initd
> > > new file mode 100644
> > > index 0000000..0e37fcc
> > > --- /dev/null
> > > +++ b/testing/pgagent/pgagent.initd
> > > @@ -0,0 +1,25 @@
> > > +#!/sbin/runscript
> > > +# Copyright 1999-2012 Gentoo Foundation
> > > +# Distributed under the terms of the GNU General Public License v2
> > > +# $Header: /var/cvsroot/gentoo-x86/dev-db/pgagent/files/pgagent.initd,v 1.1 2012/04/28 18:34:11 titanofold Exp $
> > > +
> > > +PGAGENTOPT="-t ${PGA_POLL} -r ${PGA_RETRY} -s ${PGA_LOG} -l ${PGA_LEVEL}"
> > > +
> > > +PGOPT="hostaddr=${PG_HOST} dbname=${PG_DBNAME} user=${PG_USER}"
> > > +
> > > +depend() {
> > > +    use net
> > > +    need postgresql
> >
> > Does the agent really require that a postgresql server runs on this
> > host even if the PG_HOST is pointing to some other host?
> >
> > I suspect that you can actually run the agent on different host than the
> > postgresql server and in that case, you don't need postgresql. It
> > should probably say "use postgresql".
> 
> Yes, thanks; as mentioned above it's just lifted from Gentoo verbatim.
> I agree it should probably have use postgres, but heed the
> aforementioned comments about how one would probably modify the script
> anyway in anything different than the most common case.
> 
> I'm not sure how to approach it best. Ideas are welcome :)

Well, you should not need edit the scripts, only the config. Thats why
there is a separate conf.d/ file.

I would just replace the 'need postgresql' with 'use postgresql' and
remove postgresql from depends.

thanks!

-nc


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)