diff options
Diffstat (limited to 'INSTALL-DEV')
-rw-r--r-- | INSTALL-DEV | 53 |
1 files changed, 48 insertions, 5 deletions
diff --git a/INSTALL-DEV b/INSTALL-DEV index 8f5ba6f..eb74ff8 100644 --- a/INSTALL-DEV +++ b/INSTALL-DEV @@ -28,14 +28,26 @@ group, not user. However, most installations use the same name for both.] $ sudo sudo -u postgres psql # Note: double sudo is not a mistake. -CREATE DATABASE brep_package TEMPLATE template0 ENCODING 'UTF8' -LC_COLLATE 'en_US.UTF8' LC_CTYPE 'en_US.UTF8'; -CREATE DATABASE brep_build TEMPLATE template0 ENCODING 'UTF8' -LC_COLLATE 'en_US.UTF8' LC_CTYPE 'en_US.UTF8'; +CREATE DATABASE brep_package + TEMPLATE template0 + ENCODING 'UTF8' + LC_COLLATE 'en_US.UTF8' + LC_CTYPE 'en_US.UTF8'; + +CREATE DATABASE brep_build + TEMPLATE template0 + ENCODING 'UTF8' + LC_COLLATE 'en_US.UTF8' + LC_CTYPE 'en_US.UTF8'; + CREATE USER <user>; + GRANT ALL PRIVILEGES ON DATABASE brep_package, brep_build TO <user>; + CREATE USER "www-data" INHERIT IN ROLE <user>; +CREATE USER "brep-build" INHERIT IN ROLE <user> PASSWORD '-'; + Exit psql (^D), then make sure the logins work: $ psql -d brep_package @@ -47,6 +59,33 @@ $ sudo sudo -u www-data psql -d brep_package $ sudo sudo -u www-data psql -d brep_build ^D +$ sudo sudo -u postgres psql -d brep_build + +CREATE EXTENSION postgres_fdw; + +CREATE SERVER package_server + FOREIGN DATA WRAPPER postgres_fdw + OPTIONS (dbname 'brep_package', updatable 'false'); + +GRANT USAGE ON FOREIGN SERVER package_server to <user>; + +CREATE USER MAPPING FOR PUBLIC + SERVER package_server + OPTIONS (user 'brep-build', password '-'); + +Exit psql (^D) + +Add the following lines at the beginning of the PostgreSQL client +authentication configuration file (pg_hba.conf): + +# TYPE DATABASE USER ADDRESS METHOD +local brep_package brep-build md5 + +Restart PostgreSQL (use the second version for systemd): + +$ sudo /etc/init.d/postgresql restart +$ sudo systemctl restart postgresql + To troubleshoot, see PostgreSQL logs, for example: $ sudo tail -f /var/log/postgresql/*.log @@ -68,6 +107,7 @@ To verify: $ psql -d brep_package -c 'SELECT name, summary FROM repository' $ psql -d brep_build -c 'SELECT package_name FROM build' # Empty row set. +$ psql -d brep_build -c 'SELECT DISTINCT name FROM build_package' 3. Setup Apache2 Module @@ -76,7 +116,8 @@ Here we assume Apache2 is installed and you have an appropriate VirtualServer ready (the one for the default site is usually a good candidate). Open the corresponding Apache2 .conf file and add the following inside VirtualServer, replacing <BREP-OUT-ROOT> and <BREP-SRC-ROOT> with the actual absolute paths -(if you built brep in the source tree, then the two would be the same). +(if you built brep in the source tree, then the two would be the same), and +replacing <user> with your login. # Load the brep module. # @@ -113,6 +154,8 @@ replacing <BREP-OUT-ROOT> and <BREP-SRC-ROOT> with the actual absolute paths # Brep module configuration. # brep-conf <BREP-SRC-ROOT>/etc/brep-module.conf + brep-package-db-role <user> + brep-build-db-role <user> # Static brep content (CSS files). # |