Commit c5fc8b26 authored by Mariama Tambedou's avatar Mariama Tambedou

correction

parent c8fca9a4
FROM odoo:16.0 FROM odoo:16.0
# Installer les dépendances nécessaires
# Assurez-vous que les commandes suivantes s'exécutent avec les droits root
USER root
# Nettoyer les caches existants
RUN rm -rf /var/lib/apt/lists/*
# Mettre à jour les paquets et installer les dépendances nécessaires
RUN apt-get update && apt-get install -y \
wget \
gnupg \
apt-transport-https \
ca-certificates && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
apt-get update && \
apt-get install -y \
git \
python3-pip \
libpq-dev \
&& rm -rf /var/lib/apt/lists/* && \
apt-get clean
# Copier les fichiers nécessaires dans le conteneur # Copier les fichiers nécessaires dans le conteneur
COPY ./config/odoo.conf /etc/odoo/ COPY ./config/odoo.conf /etc/odoo/
......
[options] [options]
#addons_path = /mnt/extra-addons addons_path = /mnt/extra-addons
data_dir = /home/data data_dir = /home/data
admin_passwd = p.8at(k4ER\p:BYx*L) admin_passwd = p.8at(k4ER\p:BYx*L)
; csv_internal_sep = , ; csv_internal_sep = ,
; db_maxconn = 64 ; db_maxconn = 64
; db_template = template1
dbfilter = dbtest
;db_name = ijayo_crm ;db_name = ijayo_crm
;list_db = False
log_level = debug ; db_template = template1
longpolling_port = 8072 dbfilter = .*
proxy_mode = True
limit_memory_hard = 1677721600 limit_memory_hard = 1677721600
limit_memory_soft = 629145600 limit_memory_soft = 629145600
...@@ -27,13 +25,15 @@ workers = 3 ...@@ -27,13 +25,15 @@ workers = 3
; limit_request = 8192 ; limit_request = 8192
; limit_time_cpu = 60 ; limit_time_cpu = 60
; limit_time_real = 120 ; limit_time_real = 120
list_db = true
; log_db = False ; log_db = False
; log_handler = [':INFO'] ; log_handler = [':INFO']
log_level = debug
; logfile = None ; logfile = None
;longpolling_port = 8072
; max_cron_threads = 2 ; max_cron_threads = 2
gevent_port = 8072
; osv_memory_age_limit = 1.0 ; osv_memory_age_limit = 1.0
; osv_memory_count_limit = False ; osv_memory_count_limit = False
...@@ -49,4 +49,5 @@ workers = 3 ...@@ -49,4 +49,5 @@ workers = 3
; xmlrpcs = True ; xmlrpcs = True
; xmlrpcs_interface = ; xmlrpcs_interface =
; xmlrpcs_port = 8071 ; xmlrpcs_port = 8071
; proxy_mode = True proxy_mode = True
version: "3.9" version: "3.9"
services: services:
odoo: odoo:
build: build:
...@@ -12,9 +11,11 @@ services: ...@@ -12,9 +11,11 @@ services:
depends_on: depends_on:
- db - db
environment: environment:
- HOST=db - DB_HOST=db
- USER=postgresadmin - DB_PORT=5432
- PASSWORD=admin123 - DB_USER=odoo
- DB_PASSWORD=odoo
- ADMIN_PASSWD=p.8at(k4ER\p:BYx*L
volumes: volumes:
- ./addons:/mnt/extra-addons - ./addons:/mnt/extra-addons
- ./entreprise_addons:/mnt/extra-addons - ./entreprise_addons:/mnt/extra-addons
...@@ -28,11 +29,11 @@ services: ...@@ -28,11 +29,11 @@ services:
db: db:
image: postgres:13 image: postgres:13
container_name: postgres-container container_name: postgres-container
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports: ports:
- "5432:5432" - "5432:5432"
environment:
POSTGRES_USER: postgresadmin
POSTGRES_PASSWORD: admin123
volumes: volumes:
- pg-data:/var/lib/postgresql/data - pg-data:/var/lib/postgresql/data
- ./pg_hba.conf:/etc/postgresql/pg_hba.conf - ./pg_hba.conf:/etc/postgresql/pg_hba.conf
...@@ -47,3 +48,4 @@ volumes: ...@@ -47,3 +48,4 @@ volumes:
networks: networks:
odoo-network: odoo-network:
driver: bridge driver: bridge
...@@ -7,10 +7,10 @@ if [ -v PASSWORD_FILE ]; then ...@@ -7,10 +7,10 @@ if [ -v PASSWORD_FILE ]; then
fi fi
# Utiliser les valeurs des variables d'environnement ou les valeurs par défaut # Utiliser les valeurs des variables d'environnement ou les valeurs par défaut
: ${HOST:=${DB_HOST:='db'}} # Mettre à jour ici le nom du conteneur PostgreSQL : ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}
: ${PORT:=${DB_PORT:=5432}} : ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
: ${USER:=${DB_USER:='postgresadmin'}} # Utilisez l'utilisateur défini dans votre config : ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
: ${PASSWORD:=${DB_PASS:='admin123'}} # Utilisez le mot de passe défini dans votre config : ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
DB_ARGS=() DB_ARGS=()
function check_config() { function check_config() {
......
...@@ -46,23 +46,97 @@ spec: ...@@ -46,23 +46,97 @@ spec:
{{- toYaml .Values.readinessProbe | nindent 12 }} {{- toYaml .Values.readinessProbe | nindent 12 }}
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }} env:
- name: DB_HOST
value: postgresql # Nom du service PostgreSQL
- name: DB_PORT
value: "5432"
- name: DB_USER
value: {{ .Values.postgresql.postgresqlUsername }} # Utilisateur PostgreSQL
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: odoo-db-secret # Secret contenant le mot de passe PostgreSQL
key: password
- name: DB_NAME
value: {{ .Values.postgresql.postgresqlDatabase }} # Nom de la base de données
volumeMounts: volumeMounts:
{{- toYaml . | nindent 12 }} {{- toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes: volumes:
- name: odoo-db-pv
persistentVolumeClaim:
claimName: odoo-db-pvc # PVC pour PostgreSQL si vous l'avez configuré
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml .Values.nodeSelector | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity: affinity:
{{- toYaml . | nindent 8 }} {{- toYaml .Values.affinity | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations: tolerations:
{{- toYaml . | nindent 8 }} {{- toYaml .Values.tolerations | nindent 8 }}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgresql
labels:
app: postgresql
spec:
replicas: 1
selector:
matchLabels:
app: postgresql
template:
metadata:
labels:
app: postgresql
spec:
containers:
- name: postgresql
image: "postgres:13" # Image de PostgreSQL
env:
- name: POSTGRES_USER
value: {{ .Values.postgresql.postgresqlUsername }} # Utilisateur PostgreSQL
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: odoo-db-secret # Secret contenant le mot de passe PostgreSQL
key: password
- name: POSTGRES_DB
value: {{ .Values.postgresql.postgresqlDatabase }} # Nom de la base de données
volumeMounts:
- name: postgresql-data
mountPath: /var/lib/postgresql/data
volumes:
- name: postgresql-data
persistentVolumeClaim:
claimName: postgresql-pvc # PVC pour PostgreSQL
---
apiVersion: v1
kind: Service
metadata:
name: postgresql
spec:
ports:
- port: 5432
selector:
app: postgresql
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "my-odoo-app.fullname" . }}
spec:
ports:
- port: {{ .Values.service.port }}
targetPort: 8069
selector:
app: {{ include "my-odoo-app.fullname" . }}
...@@ -7,9 +7,38 @@ replicaCount: 1 ...@@ -7,9 +7,38 @@ replicaCount: 1
# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/ # This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
image: image:
repository: tambedou/odoo # Remplacez par le nom de votre image Docker repository: tambedou/odoo-image # Remplacez par le nom de votre image Docker
tag: latest # Vous pouvez définir une version spécifique si vous le souhaitez tag: latest # Vous pouvez définir une version spécifique si vous le souhaitez
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
env:
- name: DB_HOST
value: "postgresql"
- name: DB_PORT
value: "5432"
- name: DB_USER
value: "postgresadmin"
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: odoo-db-secret
key: password
postgresql:
image:
repository: postgres
tag: 13
service:
type: ClusterIP
port: 5432
env:
- name: POSTGRES_USER
value: "postgresadmin"
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: odoo-db-secret
key: password
# This is for the secretes for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ # This is for the secretes for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
#imagePullSecrets: [] #imagePullSecrets: []
...@@ -76,31 +105,32 @@ ingress: ...@@ -76,31 +105,32 @@ ingress:
# hosts: # hosts:
# - chart-example.local # - chart-example.local
resources: {} resources:
# We usually recommend not to specify default resources and to leave this as a conscious # We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little # choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following # resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'. # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits: requests:
# cpu: 100m memory: "512Mi"
# memory: 128Mi cpu: "500m"
# requests: limits:
# cpu: 100m memory: "1Gi"
# memory: 128Mi cpu: "1"
# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ # This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /
port: http port: 8069
initialDelaySeconds: 30 # Délai initial pour éviter des erreurs au démarrage initialDelaySeconds: 60 # Délai initial pour éviter des erreurs au démarrage
periodSeconds: 10 # Fréquence des vérifications periodSeconds: 10 # Fréquence des vérifications
timeoutSeconds: 5 timeoutSeconds: 5
readinessProbe: readinessProbe:
httpGet: httpGet:
path: / path: /
port: http port: 8069
initialDelaySeconds: 30 initialDelaySeconds: 60
periodSeconds: 10 periodSeconds: 10
timeoutSeconds: 5 timeoutSeconds: 5
......
DB_HOST = db DB_HOST=postgres-container
DB_PORT = 5432 DB_PORT=5432
DB_USER = postgresadmin DB_USER=postgresadmin
DB_PASS = admin123 DB_PASS=admin123
db_name = ijayo_crm
apiVersion: v1
kind: Secret
metadata:
name: odoo-db-secret
type: Opaque
data:
password: YWRtaW4xMjM= # Remplacez par le mot de passe encodé en base64
apiVersion: v1
kind: Secret
metadata:
name: odoo-db-secret
type: Opaque
data:
password: YWRtaW4xMjM= # Remplacez par le mot de passe encodé en base64
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment