pgc-db/INSTALL

86 lines
2.6 KiB
Plaintext

0. Dependencies
These are required for loading the catalog data.
postgresql-13
libdbd-csv-perl
libdbd-pg-perl
For the perl modules,
libdbix-class-perl
libtest2-suite-perl
libdatetime-format-pg-perl
If you want to alter the tables, this will let your run
bin/make-schema.sh to modify the DBIx-based modules to match.
libdbix-class-schema-loader-perl
1. Preliminary configuration for postgresql
These are one-time things to do, in that you can recreate and reload
the catalog database any number of times without having to do these
steps again.
Create roles to own and manage the tables. (The connection limits are
merely suggestions.)
## The table owner, must be 'pgc_owner'
$ createuser --connection-limit=1 --createdb --echo pgc_owner
## The table user role, must be 'pgc_user'
$ createuser --connection-limit=5 --no-login pgc_user
## A user who will connect as pgc_owner, named as you like,
## e.g. your own username.
$ createuser --connection-limit=1 irulan
Configure postgres to allow "irulan" to connect to the catalog
database as pgc_owner, so that irulan can manage the database. This
is for the case that the postgres server runs on the same host.
Consult postgres's excellent documentation for other cases.
In pg_ident.conf, add map lines so that the end of the file resembles this:
# MAPNAME SYSTEM-USERNAME PG-USERNAME
irulanmap irulan irulan
irulanmap irulan pgc_owner
In pg_hba.conf, modify the second "local" line, the one following the
"postgres" line, so that it has a map option on the end.
local all all peer map=irulanmap
Tell postgres about these edits.
# systemctl reload postgresql
At this point "irulan" has privilege to create and drop the catalog
database. Routine use of the database is more safely done by a
username with lesser privilege, i.e. only pgc_user. See pgc-www's
INSTALL for an example (<https://tildegit.org/barnold/pgc-www>).
2. As the operating system user "irulan", you should now be able to
create and load the catalog database.
$ make PGC_DANGEROUS=1 rebuild-db
$ make load-catalog
At this point, "irulan" should be able to run the tests successfully
with e.g.
$ prove -l
3. To install the perl modules, run
sudo make install-modules
which installs them under /usr/local/lib/site_perl. Alternatively do
e.g.
make PGC_PERL5LIB=~/.local/lib/perl5 install-modules
though you'll probably need to set PER5LIB in this case before using
the modules in your perl code.
Comments and questions welcome at <barnold@tilde.club>.