11# example-postgresql [ ![ Build Status] ( https://dev.azure.com/lganzzzo/lganzzzo/_apis/build/status/oatpp.example-postgresql?branchName=master )] ( https://dev.azure.com/lganzzzo/lganzzzo/_build/latest?definitionId=17&branchName=master )
22
3- Example of a production grade entity service with Swagger-UI and configuration profiles. Storing information in PostgreSQL.
3+ Example of a production grade entity service storing information in PostgreSQL. With Swagger-UI and configuration profiles.
44* Libpq is used to communicate with PostgreSQL database.*
55* Dockerfile and docker-compose.yaml files included.*
66
@@ -46,12 +46,14 @@ This project is using `oatpp` and `oatpp-swagger` modules.
4646
4747---
4848
49- ### Build and Run
49+ ## Build and Run
5050
51- #### Using CMake
51+ ### Using CMake
5252
53- * Requires libpq installed*
54- Tip: To install libpq on Mac - ` $ brew install libpq ` . To install libpq on Linux-Alpine - ` apk add postgresql-dev `
53+ ** Requires libpq installed** . To install libpq:
54+ - On Mac ` $ brew install libpq `
55+ - On Alpine ` $ apk add postgresql-dev `
56+ - On Ubuntu - goto [ Install PostgreSQL Client From Sources] ( #install-postgresql-client-from-sources )
5557
5658```
5759$ mkdir build && cd build
@@ -61,29 +63,50 @@ $ make run ## Download, build, and install all dependencies. Run project
6163
6264* PostgreSQL is expected running as for ` dev ` config profile*
6365
64- #### In Docker
66+ ### In Docker
6567
66- ##### Dockerfile
68+ #### Dockerfile
6769
6870```
6971$ docker build -t example-postgresql .
7072$ docker run -p 8000:8000 -e CONFIG_PROFILE='dev' -t example-postgresql
7173```
7274
73- ##### docker-compose
75+ #### docker-compose
7476
7577```
7678$ docker-compose up
7779```
7880
7981* docker-compose will run service with ` local-docker ` config profile*
8082
81- ---
82-
8383### After run
8484
8585Go to [ http://localhost:8000/swagger/ui ] ( http://localhost:8000/swagger/ui ) to try endpoints.
8686
87- ---
88-
89- Enjoy
87+ ## Install PostgreSQL Client From Sources
88+
89+ - Download sources from [ https://www.postgresql.org/ftp/source/ ] ( https://www.postgresql.org/ftp/source/ )
90+ ```
91+ $ wget https://ftp.postgresql.org/pub/source/v11.1/postgresql-11.1.tar.gz
92+ ```
93+
94+ - Untar
95+ ```
96+ $ tar -xvzf postgresql-11.1.tar.gz
97+ ```
98+
99+ - CD to postgresql-11.1, configure, make:
100+ ```
101+ $ cd postgresql-11.1
102+ $ ./configure
103+ $ make
104+ ```
105+ - Install PostgreSQL client-only
106+ * For this particular example we don't need full PostgreSQL installation.*
107+ ```
108+ $ make -C src/include install
109+ $ make -C src/interfaces install
110+ ```
111+
112+ For more information see [ PostgreSQL installation guide] ( https://www.postgresql.org/docs/11/install-procedure.html#INSTALL )
0 commit comments