Grinnz / perldoc-browser

Perldoc Browser
https://perldoc.perl.org
Artistic License 2.0
55 stars 21 forks source link

PostgreSQL Container for Docker Cluster #42

Closed bodo-hugo-barwich closed 3 years ago

bodo-hugo-barwich commented 3 years ago

This introduces support for PostgreSQL for the Docker Cluster. As discussed in #26

It's important to mention that the DBD::Pg Perl Module required PostgreSQL development libraries on the Web Service container which are only available for the PostgresSQL Version 11 The databases of Version 10 and 11 are incompatible so the version of the PostgreSQL container is 11.13 According to the End of Life Policy at Postgres this seems to be a reasonable versioning: Postgres Versioning Chart

bodo-hugo-barwich commented 3 years ago

The access from the Web Service container is documented as correct according to the Mojolicious documentation: https://docs.mojolicious.org/Mojo/Pg#SYNOPSIS

per1_web@b2046f460754:~$ perl -I ~/perl5/lib/perl5/ perldoc-browser.pl index all
pg 0 dmp:
bless({
  dsn => "dbi:Pg:dbname=perldoc;host=db",
  options => {
    AutoCommit          => 1,
    AutoInactiveDestroy => 1,
    PrintError          => 0,
    PrintWarn           => 0,
    RaiseError          => 1,
  },
  password => "secret",
  username => "perldoc",
}, "Mojo::Pg")
pg version: 'PostgreSQL 11.13 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424, 64-bit'

also in the PostgreSQL container the entries can be found correctly:

$ docker-compose exec db /bin/sh
/ $ psql -h db -U perldoc perldoc
Password for user perldoc: 
psql (11.13)
Type "help" for help.

perldoc=# \dt
             List of relations
 Schema |      Name       | Type  |  Owner  
--------+-----------------+-------+---------
 public | faqs            | table | perldoc
 public | functions       | table | perldoc
 public | mojo_migrations | table | perldoc
 public | perldeltas      | table | perldoc
 public | pods            | table | perldoc
 public | variables       | table | perldoc
(6 rows)

perldoc=# select count(*) from pods;
 count 
-------
  1456
(1 row)
bodo-hugo-barwich commented 3 years ago

to resolve the permission conflict at image build time I added the .dockerignore as documented at Conflict about persistent Database Storage Location

Grinnz commented 3 years ago

Thanks again!