Add an example of how to create a database and a user dedicated to that

database with a PostgreSQL container.
This commit is contained in:
Miguel Moquillon 2020-06-19 11:53:43 +02:00
parent b61aae66c7
commit 3cb3e5a27f
1 changed files with 17 additions and 2 deletions

View File

@ -38,12 +38,27 @@ In [Docker Hub](https://hub.docker.com/), no Docker images of Microsoft SQLServe
$ docker run --name postgresql -d \ $ docker run --name postgresql -d \
-e POSTGRES_PASSWORD="mysecretpassword" \ -e POSTGRES_PASSWORD="mysecretpassword" \
-v postgresql-data:/var/lib/postgresql/data \ -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/). 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 ### Start a Silverpeas instance with the default configuration