diff --git a/README.md b/README.md index 3b296d52a79e36b0262af9344a2346fa99d9bf0f..b535a508a3073949e15407b7510339467c369807 100644 --- a/README.md +++ b/README.md @@ -120,125 +120,125 @@ Once succesfully completed, you can see the docker image in the `Registry`sectio Create a file `manifest.yaml` at the root directory of your git repository and fill it with the following definition. > Keep in mind that yaml formating require that you seperate each declaration with `---` line. -* PostgreSQL Server - In order to deploy a Postgresql server we need : +#### PostgreSQL Server +In order to deploy a Postgresql server we need : - - [ ] Storage - - [ ] Configuration - - [ ] Deployment - - [ ] Service +- [ ] Storage +- [ ] Configuration +- [ ] Deployment +- [ ] Service - * Persistent Volume Claim +* Persistent Volume Claim - As a Docker image is immutable, you may need to define some persistent storage. In the case of a PostgreSQL container we need to persist the data of the database. +As a Docker image is immutable, you may need to define some persistent storage. In the case of a PostgreSQL container we need to persist the data of the database. - We do this using a `Persistent Volume Claim`. - > You can see that we define an `accessModes`to `ReadWriteOnce`, this mean that the Persistent Volume will only be accessed by one container. +We do this using a `Persistent Volume Claim`. +> You can see that we define an `accessModes`to `ReadWriteOnce`, this mean that the Persistent Volume will only be accessed by one container. - ```yaml - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: postgres-claim - labels: - app: postgresql - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi - ``` +```yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: +name: postgres-claim +labels: + app: postgresql +spec: +accessModes: + - ReadWriteOnce +resources: + requests: + storage: 1Gi +``` - * PostgreSQL secret +* PostgreSQL secret - We are here defining the PostgreSQL basic parameters : username, password and database. This `Secret` will be reused later in `Deployments`. +We are here defining the PostgreSQL basic parameters : username, password and database. This `Secret` will be reused later in `Deployments`. - > Note: the data have to be base64 encoded. This can be done online or by command line on MacOS or Linux +> Note: the data have to be base64 encoded. This can be done online or by command line on MacOS or Linux -  + - ```yaml - apiVersion: v1 - kind: Secret - metadata: - name: postgresql-credentials - type: Opaque - data: - username: cG9sbHNfdXNlcgo= - password: c2xsb3BfYzNiaQo= - database: cG9sbHMK - ``` +```yaml +apiVersion: v1 +kind: Secret +metadata: +name: postgresql-credentials +type: Opaque +data: +username: cG9sbHNfdXNlcgo= +password: c2xsb3BfYzNiaQo= +database: cG9sbHMK +``` - * PostgreSQL Deployment +* PostgreSQL Deployment - ```yaml - apiVersion: extensions/v1beta1 - kind: Deployment +```yaml +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: +name: postgresql +labels: + app: postgresql +spec: +strategy: + type: Recreate +template: metadata: - name: postgresql labels: app: postgresql + tier: postgreSQL spec: - strategy: - type: Recreate - template: - metadata: - labels: - app: postgresql - tier: postgreSQL - spec: - containers: - - image: postgres:9.6.2-alpine + containers: + - image: postgres:9.6.2-alpine + name: postgresql + env: + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: postgresql-credentials + key: username + - name: POSTGRES_DB + valueFrom: + secretKeyRef: + name: postgresql-credentials + key: database + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: postgresql-credentials + key: password + ports: + - containerPort: 5432 name: postgresql - env: - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: postgresql-credentials - key: username - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: postgresql-credentials - key: database - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: postgresql-credentials - key: password - ports: - - containerPort: 5432 - name: postgresql - volumeMounts: - - name: postgresql - mountPath: /var/lib/postgresql/data - subPath: data - volumes: + volumeMounts: - name: postgresql - persistentVolumeClaim: - claimName: postgres-claim - - name: postgresql-credentials - secret: - secretName: postgresql - ``` + mountPath: /var/lib/postgresql/data + subPath: data + volumes: + - name: postgresql + persistentVolumeClaim: + claimName: postgres-claim + - name: postgresql-credentials + secret: + secretName: postgresql +``` - * PostgreSQL Service +* PostgreSQL Service - ```yaml - apiVersion: v1 - kind: Service - metadata: - name: postgresql - labels: - app: postgresql - spec: - ports: - - port: 5432 - selector: - app: postgresql - tier: postgreSQL - ```` +```yaml +apiVersion: v1 +kind: Service +metadata: +name: postgresql +labels: + app: postgresql +spec: +ports: + - port: 5432 +selector: + app: postgresql + tier: postgreSQL +```` * Django Application * Deployment