Adds odoo app.

This commit is contained in:
2026-06-19 21:33:17 +00:00
parent 8f8d3f7680
commit a3dafa925b
11 changed files with 345 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# Odoo
Odoo is a comprehensive open-source ERP and CRM suite covering accounting, sales, inventory, HR, project management, and more.
## Dependencies
- **PostgreSQL** - Database for storing all business data
## Configuration
Key settings in `config.yaml`:
- **domain** - Where Odoo will be accessible
- **storage** - Persistent volume size (default: `2Gi`)
- **db.name** - Database name (default: `odoo`)
## First-Time Setup
1. Add and deploy the app:
```bash
wild app add odoo
wild app deploy odoo
```
2. **First start takes 1015 minutes** as Odoo installs the base module and runs all database migrations. The startup probe allows up to 20 minutes before failing.
3. Once ready, log in with:
- **Email**: `admin`
- **Password**: value of `adminPassword` in your `secrets.yaml`
4. The Odoo home menu will appear — install additional modules (Sales, Accounting, Inventory, etc.) from **Apps**.
## Notes
- The `adminPassword` in `secrets.yaml` is the **master password** for the Odoo database manager — this is separate from the `admin` user password, which is set during first boot using the same value
- Odoo is started with `-d <db.name> -i base` to explicitly name the database and install the base module — this is required for the health check to pass
- Each restart re-runs the base module check (idempotent) which adds a few seconds to startup time

View File

@@ -0,0 +1,63 @@
apiVersion: batch/v1
kind: Job
metadata:
name: odoo-db-init
labels:
component: db-init
spec:
template:
metadata:
labels:
component: db-init
spec:
restartPolicy: OnFailure
securityContext:
runAsNonRoot: true
runAsUser: 999
runAsGroup: 999
seccompProfile:
type: RuntimeDefault
containers:
- name: db-init
image: postgres:17
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
command: ["/bin/bash", "-c"]
args:
- |
PGPASSWORD=${POSTGRES_ADMIN_PASSWORD} psql -h ${DB_HOSTNAME} -U postgres <<EOF
DO \$\$
BEGIN
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = '${DB_USERNAME}') THEN
CREATE USER ${DB_USERNAME} WITH ENCRYPTED PASSWORD '${DB_PASSWORD}';
ELSE
ALTER USER ${DB_USERNAME} WITH ENCRYPTED PASSWORD '${DB_PASSWORD}';
END IF;
END
\$\$;
SELECT 'CREATE DATABASE ${DB_DATABASE_NAME}' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '${DB_DATABASE_NAME}')\gexec
ALTER DATABASE ${DB_DATABASE_NAME} OWNER TO ${DB_USERNAME};
GRANT ALL PRIVILEGES ON DATABASE ${DB_DATABASE_NAME} TO ${DB_USERNAME};
EOF
env:
- name: POSTGRES_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secrets
key: password
- name: DB_HOSTNAME
value: "{{ .db.host }}"
- name: DB_DATABASE_NAME
value: "{{ .db.name }}"
- name: DB_USERNAME
value: "{{ .db.user }}"
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: odoo-secrets
key: dbPassword

View File

@@ -0,0 +1,95 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: odoo
namespace: {{ .namespace }}
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
component: web
template:
metadata:
labels:
component: web
spec:
securityContext:
runAsNonRoot: true
runAsUser: 100
runAsGroup: 101
fsGroup: 101
seccompProfile:
type: RuntimeDefault
containers:
- name: odoo
image: odoo:18.0
ports:
- name: http
containerPort: 8069
protocol: TCP
args: ["-d", "{{ .db.name }}", "-i", "base"]
env:
- name: HOST
value: {{ .db.host }}
- name: PORT
value: "{{ .db.port }}"
- name: USER
value: {{ .db.user }}
- name: PASSWORD
valueFrom:
secretKeyRef:
name: odoo-secrets
key: dbPassword
- name: ADMIN_PASSWD
valueFrom:
secretKeyRef:
name: odoo-secrets
key: adminPassword
volumeMounts:
- name: odoo-data
mountPath: /var/lib/odoo
startupProbe:
httpGet:
path: /web/health
port: 8069
failureThreshold: 40
periodSeconds: 30
timeoutSeconds: 10
livenessProbe:
httpGet:
path: /web/health
port: 8069
initialDelaySeconds: 0
timeoutSeconds: 10
periodSeconds: 30
failureThreshold: 6
readinessProbe:
httpGet:
path: /web/health
port: 8069
initialDelaySeconds: 0
timeoutSeconds: 5
periodSeconds: 15
failureThreshold: 3
resources:
requests:
cpu: 250m
memory: 512Mi
ephemeral-storage: 50Mi
limits:
cpu: 1000m
memory: 2Gi
ephemeral-storage: 2Gi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
volumes:
- name: odoo-data
persistentVolumeClaim:
claimName: odoo-data
restartPolicy: Always

View File

@@ -0,0 +1,26 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: odoo
namespace: {{ .namespace }}
annotations:
external-dns.alpha.kubernetes.io/target: {{ .externalDnsDomain }}
external-dns.alpha.kubernetes.io/cloudflare-proxied: "false"
external-dns.alpha.kubernetes.io/ttl: "60"
spec:
ingressClassName: traefik
rules:
- host: {{ .domain }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: odoo
port:
number: 8069
tls:
- hosts:
- {{ .domain }}
secretName: {{ .tlsSecretName }}

View File

@@ -0,0 +1,17 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: {{ .namespace }}
labels:
- includeSelectors: true
pairs:
app: odoo
managedBy: kustomize
partOf: wild-cloud
resources:
- namespace.yaml
- deployment.yaml
- service.yaml
- ingress.yaml
- pvc.yaml
- db-init-job.yaml
- schema-init-job.yaml

View File

@@ -0,0 +1,19 @@
version: 18.0-2
requires:
- name: postgres
defaultConfig:
namespace: odoo
externalDnsDomain: "{{ .cloud.domain }}"
domain: odoo.{{ .cloud.domain }}
tlsSecretName: wildcard-wild-cloud-tls
storage: 2Gi
db:
host: "{{ .apps.postgres.host }}"
port: "{{ .apps.postgres.port }}"
name: odoo
user: odoo
defaultSecrets:
- key: dbPassword
- key: adminPassword
requiredSecrets:
- postgres.password

View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{ .namespace }}

11
odoo/versions/18/pvc.yaml Normal file
View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: odoo-data
namespace: {{ .namespace }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .storage }}

View File

@@ -0,0 +1,54 @@
apiVersion: batch/v1
kind: Job
metadata:
name: odoo-schema-init
labels:
component: schema-init
spec:
backoffLimit: 3
template:
metadata:
labels:
component: schema-init
spec:
restartPolicy: OnFailure
securityContext:
runAsNonRoot: true
runAsUser: 100
runAsGroup: 101
seccompProfile:
type: RuntimeDefault
containers:
- name: odoo-init
image: odoo:18.0
args: ["--database", "{{ .db.name }}", "--init=base", "--stop-after-init"]
env:
- name: HOST
value: {{ .db.host }}
- name: PORT
value: "{{ .db.port }}"
- name: USER
value: {{ .db.user }}
- name: PASSWORD
valueFrom:
secretKeyRef:
name: odoo-secrets
key: dbPassword
- name: ADMIN_PASSWD
valueFrom:
secretKeyRef:
name: odoo-secrets
key: adminPassword
resources:
requests:
cpu: 50m
memory: 256Mi
limits:
cpu: 2
memory: 3Gi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: odoo
namespace: {{ .namespace }}
spec:
selector:
component: web
ports:
- name: http
port: 8069
targetPort: 8069
protocol: TCP