Re: [HACKERS] Can we add sample systemd service file to git repo?

2013-11-18 Thread Will Crawford
On 12 November 2013 20:54, Nigel Heron  wrote:
> On Tue, Nov 12, 2013 at 11:47 AM, Devrim GÜNDÜZ  wrote:
...
>> http://svn.pgrpms.org/browser/rpm/redhat/9.3/postgresql/F-19/postgresql-9.3.service
>>  is an example of what we use in the RPMs. (if website fails, please just 
>> reload)
>>
>> Attached is a modified version that will work with the compile defaults.

> Hi, should we put PGPORT in the systemd file without an easy way to override 
> it?
> As an example, when yum updating minor versions on fedora 18 (using
> the yum.postgresql.org rpms), any changes to the systemd service file
> are overwritten by the new rpm and the port is forced back to 5432.
> This makes having pg9.2 and pg9.3 on the same box conflict after each
> minor version update.

IIRC there's a "%config(noreplace)" directive in the .spec that can
cause the new file to be saved with an extension (.rpmnew?) instead of
overwriting the old one.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Can we add sample systemd service file to git repo?

2013-11-12 Thread Peter Eisentraut
On 11/12/13, 11:47 AM, Devrim GÜNDÜZ wrote:
> Attached is a modified version that will work with the compile defaults.

I think you don't need both a PGDATA environment variable and the -D
option to pg_ctl.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Can we add sample systemd service file to git repo?

2013-11-12 Thread Andrew Dunstan


On 11/12/2013 03:54 PM, Nigel Heron wrote:

On Tue, Nov 12, 2013 at 11:47 AM, Devrim GÜNDÜZ  wrote:

Hi,

Many distros are switching/switched to systemd. In the git repo, we only
have init script for SysV. Would it make sense to add systemd service
script to our tarball as well? This could also standardize the systemd
scripts used in other distros.

http://svn.pgrpms.org/browser/rpm/redhat/9.3/postgresql/F-19/postgresql-9.3.service
 is an example of what we use in the RPMs. (if website fails, please just 
reload)

Attached is a modified version that will work with the compile defaults.


Hi, should we put PGPORT in the systemd file without an easy way to override it?
As an example, when yum updating minor versions on fedora 18 (using
the yum.postgresql.org rpms), any changes to the systemd service file
are overwritten by the new rpm and the port is forced back to 5432.
This makes having pg9.2 and pg9.3 on the same box conflict after each
minor version update.
On RHEL6 with SysV we have /etc/sysconfig/[..] files to override the
init.d script defaults. The same can be done with systemd using the
"EnvironmentFile" directive, like this:
[Service]
EnvironmentFile=-/etc/sysconfig/postgresql

which would let us keep our overrides of PGPORT and PGDATA across
updates (the "=-" makes the file optional).

Given a choice, I'd rather rely on postgresql.conf to set the port
number though...



You might also find this useful, in particular Tom Lane's comment: 



cheers

andrew


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Can we add sample systemd service file to git repo?

2013-11-12 Thread Nigel Heron
On Tue, Nov 12, 2013 at 11:47 AM, Devrim GÜNDÜZ  wrote:
>
> Hi,
>
> Many distros are switching/switched to systemd. In the git repo, we only
> have init script for SysV. Would it make sense to add systemd service
> script to our tarball as well? This could also standardize the systemd
> scripts used in other distros.
>
> http://svn.pgrpms.org/browser/rpm/redhat/9.3/postgresql/F-19/postgresql-9.3.service
>  is an example of what we use in the RPMs. (if website fails, please just 
> reload)
>
> Attached is a modified version that will work with the compile defaults.


Hi, should we put PGPORT in the systemd file without an easy way to override it?
As an example, when yum updating minor versions on fedora 18 (using
the yum.postgresql.org rpms), any changes to the systemd service file
are overwritten by the new rpm and the port is forced back to 5432.
This makes having pg9.2 and pg9.3 on the same box conflict after each
minor version update.
On RHEL6 with SysV we have /etc/sysconfig/[..] files to override the
init.d script defaults. The same can be done with systemd using the
"EnvironmentFile" directive, like this:
[Service]
EnvironmentFile=-/etc/sysconfig/postgresql

which would let us keep our overrides of PGPORT and PGDATA across
updates (the "=-" makes the file optional).

Given a choice, I'd rather rely on postgresql.conf to set the port
number though...

-nigel.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Can we add sample systemd service file to git repo?

2013-11-12 Thread Devrim GÜNDÜZ

Hi,

Many distros are switching/switched to systemd. In the git repo, we only
have init script for SysV. Would it make sense to add systemd service
script to our tarball as well? This could also standardize the systemd
scripts used in other distros.

http://svn.pgrpms.org/browser/rpm/redhat/9.3/postgresql/F-19/postgresql-9.3.service
 is an example of what we use in the RPMs. (if website fails, please just 
reload)

Attached is a modified version that will work with the compile defaults.

Regards,
-- 
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz
[Unit]
Description=PostgreSQL 9.3 database server
After=syslog.target
After=network.target

[Service]
Type=forking

User=postgres
Group=postgres

# Note: avoid inserting whitespace in these Environment= lines, or you may
# break postgresql-setup.

# Port number for server to listen on
Environment=PGPORT=5432

# Location of database directory
Environment=PGDATA=/usr/local/pgsql/data/

# Where to send early-startup messages from the server (before the logging
# options of postgresql.conf take effect)
StandardOutput=syslog

# Disable OOM kill on the postmaster
OOMScoreAdjust=-1000

ExecStart=/usr/local/pgsql/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" 
-w -t 300
ExecStop=/usr/local/pgsql/bin/pg_ctl stop -D ${PGDATA} -s -m fast
ExecReload=/usr/local/pgsql/bin/pg_ctl reload -D ${PGDATA} -s

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

[Install]
WantedBy=multi-user.target


signature.asc
Description: This is a digitally signed message part