From 3cb3e5a27f8c4421886d0a01fa08c2607b6cfae6 Mon Sep 17 00:00:00 2001 From: Miguel Moquillon Date: Fri, 19 Jun 2020 11:53:43 +0200 Subject: [PATCH] Add an example of how to create a database and a user dedicated to that database with a PostgreSQL container. --- silverpeas/content.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/silverpeas/content.md b/silverpeas/content.md index 2c73b3ab3..1bbd0c8b5 100644 --- a/silverpeas/content.md +++ b/silverpeas/content.md @@ -38,12 +38,27 @@ In [Docker Hub](https://hub.docker.com/), no Docker images of Microsoft SQLServe $ docker run --name postgresql -d \ -e POSTGRES_PASSWORD="mysecretpassword" \ -v postgresql-data:/var/lib/postgresql/data \ - postgres:9.6 + postgres:12.3 ``` We recommend strongly to mount the directory with the database file on the host so the data won't be lost when upgrading PostgreSQL to a newer version (a Data Volume Container can be used instead). For any information how to start a PostgreSQL container, you can refer its [documentation](https://hub.docker.com/_/postgres/). -Once the database system is running, a database for Silverpeas has to be created and a user with administrative rights on this database (and only on this database) should be added; it is recommended for a security reason to create a dedicated user account in the database for each application and therefore for Silverpeas. In this document, and by default, a database `Silverpeas` and a user `silverpeas` for that database are created. +Once the database system is running, a database for Silverpeas has to be created and a user with administrative rights on this database (and only on this database) should be added; it is recommended for a security reason to create a dedicated user account in the database for each application and therefore for Silverpeas. In this document, and by default, a database `Silverpeas` and a user `silverpeas` for that database are created. For example: + +```console +$ docker exec -it postgresql psql -U postgres +psql (12.3 (Debian 12.3-1.pgdg100+1)) +Type "help" for help. + +postgres=# create database "Silverpeas"; +CREATE DATABASE +postgres=# create user silverpeas with password 'thesilverpeaspassword'; +CREATE ROLE +postgres=# grant all privileges on database "Silverpeas" to silverpeas; +GRANT +postgres=# \q +$ +``` ### Start a Silverpeas instance with the default configuration