New charm postgresql-psql

Bug #1167363 reported by Stuart Bishop
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juju Charms Collection
Fix Released
Undecided
Unassigned

Bug Description

I have a new charm at lp:~stub/charms/precise/postgresql-psql/trunk

# Overview

This charm provides shell access to PostgreSQL services via the standard
psql tool.

# Usage

To setup a test environment::

    juju bootstrap
    juju deploy postgresql
    juju deploy postgresql-psql psql
    juju add-relationship postgresql:db psql:db
    juju add-relationship postgresql:db-admin psql:db-admin

On the psql unit, wrappers to psql have been installed to provide easy access:

    juju ssh 2

Standard 'db' relations have a wrapper installed connecting to the
defined database on each individual PostgreSQL unit::

    % psql-db-postgresql-0
    psql (9.1.9)
    SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
    Type "help" for help.

    psql=> \q

Administrative 'db-admin' relations have a wrapper installed that can be
used to connect to any database on each individual PostgreSQL unit::

    % psql-db-admin-postgresql-0 postgres
    psql (9.1.9)
    SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
    Type "help" for help.

    postgres=# \q

The default database name for 'db' relations may be overridden::

    juju set psql database=foo2
    juju ssh 2

    % psql-db-postgresql-0
    psql (9.1.9)
    SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
    Type "help" for help.

    foo2=> \q

Related branches

Revision history for this message
Juan L. Negron (negronjl) wrote :

Reviewing this now.

-Juan

Revision history for this message
Juan L. Negron (negronjl) wrote :

Hi Stuart:

Thanks for the charm. There are a couple of things that need fixing:
- charm proof shows the following:
W: all charms should provide at least one thing
E: relation db is not a map
E: relation db-admin is not a map
W: missing recommended hook start
W: missing recommended hook stop
The two errors mentioned above are due to an error in metadata.yaml. Currently, the interface definitions seem to be wrong. I explain....
requires:
    db: pgsql
    db-admin: pgsql
Normally you would define the interfaces such as the above in the following manner:
requires:
  db:
    interface: pgsql
  db-admin:
    interface: pgsql

I can't move forward with testing until this is addressed however, I would be happy to review it again when you have made the changes needed.

It's also recommended to run charm proof ( from charm-tools package available in ppa:juju/pkgs ) to avoid the above kind of errors.

Thanks,

Juan

Changed in charms:
status: New → Incomplete
Revision history for this message
Stuart Bishop (stub) wrote :

I've made the update.

https://juju.ubuntu.com/docs/charm.html documents the syntax I was using. I don't know if this is a bug in 'charm proof' or in the documentation.

Changed in charms:
status: Incomplete → New
Revision history for this message
Stuart Bishop (stub) wrote :

""" As a shortcut, if these properties are not defined, and instead a single string value is provided next to the relation name, the string is taken as the interface value, as seen in this example:

            requires:
              db: mysql
"""

Revision history for this message
Robert Ayres (robert-ayres) wrote :

Thanks for updating, I've reviewed your new charm and have made a few comments below.

*Consider storing pgpass files under ~ubuntu, being that the scripts are located here

*I'd remove 'README' placing everything in 'README.markdown'

*~ubuntu/bin/psql-db-* scripts are badly formatted, the shebang isn't even the first line!

*~ubuntu/bin/psql-db-*, I'd make them call psql with "$@" rather than $*

I'm curious as to what you're using this charm for? I think it's useful, but why a separate charm when this could be either part of the PostgreSQL charm or say a subordinate charm? I'm just wondering why you'd run a whole separate node for psql :)

Revision history for this message
Stuart Bishop (stub) wrote : Re: [Bug 1167363] Re: New charm postgresql-psql

On Tue, May 21, 2013 at 11:26 AM, Robert Ayres
<email address hidden> wrote:
> Thanks for updating, I've reviewed your new charm and have made a few
> comments below.
>
> *Consider storing pgpass files under ~ubuntu, being that the scripts are
> located here

I'm somewhat nervous about colocated charms. I would have generated
the scripts into the charm directory too except there seemed to be no
sane way to get them onto the PATH. If ~ubuntu is a better choice then
I'm happy to move them.

> *I'd remove 'README' placing everything in 'README.markdown'
>
> *~ubuntu/bin/psql-db-* scripts are badly formatted, the shebang isn't
> even the first line!
>
> *~ubuntu/bin/psql-db-*, I'd make them call psql with "$@" rather than $*

I'll fix these, next week probably.

> I'm curious as to what you're using this charm for? I think it's useful,
> but why a separate charm when this could be either part of the
> PostgreSQL charm or say a subordinate charm? I'm just wondering why
> you'd run a whole separate node for psql :)

The prime use is for automated testing of the PostgreSQL charm. I need
a simple reliable client that can be automated to interogate the
PostgreSQL cluster to ensure that things are working as expected after
charm upgrades, failover, relationship changes etc. The initial
framework and first simple test is up for review and requires the
postgresql-psql charm to be found in the store.

--
Stuart Bishop <email address hidden>

Changed in charms:
status: New → Incomplete
Revision history for this message
Stuart Bishop (stub) wrote :

README and generated scripts have been fixed.

Revision history for this message
Stuart Bishop (stub) wrote :

Scripts are now being generated into the charm directory, with the script's directory being added to the $PATH. This also allows us to clean up old scripts.

Changed in charms:
status: Incomplete → New
Revision history for this message
Mark Mims (mark-mims) wrote :

This looks good.

I'd personally like to see this as one of many roles of a single postgresql charm, but this makes perfect sense as a standalone charm.

Charm proof still gripes quite a bit:

W: Metadata is missing categories.
https://bugs.launchpad.net/charms/+source/postgresql-psql/+bug/1187196

W: No icon.svg file.
https://bugs.launchpad.net/charms/+source/postgresql-psql/+bug/1187194

W: all charms should provide at least one thing
imo it's safe to ignore these given the nature of this consumer-only, 'provides-nothing' service

W: missing recommended hook start
W: missing recommended hook stop
and it doesn't actually start or stop anything, so we should ignore these.

promulgated... thanks!

Changed in charms:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.