Skip to content

Instantly share code, notes, and snippets.

@scottserok
Last active May 24, 2024 17:26
Show Gist options
  • Save scottserok/ae6926ee3916fefa8b9f85dc5d691e19 to your computer and use it in GitHub Desktop.
Save scottserok/ae6926ee3916fefa8b9f85dc5d691e19 to your computer and use it in GitHub Desktop.
Odoo ERP Docker Compose
---
version: '2'
services:
web:
image: odoo:10.0
depends_on:
- db
ports:
- "8069:8069"
db:
image: postgres:10.1
environment:
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: odoo-ingress
annotations:
kubernetes.io/ingress.global-static-ip-name: odoo-ingress-ip
labels:
app: odoo
tier: frontend
spec:
tls:
- secretName: ssl-secret
backend:
serviceName: odoo-service
servicePort: 8069
---
apiVersion: v1
kind: Service
metadata:
name: odoo-service
labels:
app: odoo
tier: frontend
spec:
type: NodePort
ports:
- port: 8069
targetPort: 8069
selector:
app: odoo
tier: frontend
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: odoo-deployment
spec:
replicas: 2
template:
metadata:
labels:
app: odoo
tier: frontend
spec:
containers:
- name: odoo-container
image: odoo:11
ports:
- containerPort: 8069
resources:
limits:
cpu: 500m
memory: 300Mi
requests:
cpu: 100m
memory: 100Mi
- name: GET_HOSTS_FROM
value: dns
- name: cloudsql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:1.11
command: ["/cloud_sql_proxy", "--dir=/cloudsql",
"-instances=odoo-production:us-central1:odoo-postgres=tcp:5432",
"-credential_file=/secrets/cloudsql/credentials.json"]
resources:
limits:
cpu: 200m
memory: 100Mi
requests:
cpu: 50m
memory: 10Mi
volumeMounts:
- name: cloudsql-instance-credentials
mountPath: /secrets/cloudsql
readOnly: true
- name: ssl-certs
mountPath: /etc/ssl/certs
- name: cloudsql
mountPath: /cloudsql
volumes:
- name: cloudsql-instance-credentials
secret:
secretName: cloudsql-instance-credentials
- name: cloudsql
emptyDir:
- name: ssl-certs
hostPath:
path: /etc/ssl/certs
# Disclaimer: This is untested
#
# Odoo.com ERP version 11
#
# Local testing via "$ docker-compose up" and navigating to localhost:8069
#
# Deploy to Google Cloud Platform's Kubernetes Engine to make use of available
# capacity in your existing GKE cluster (if you have it).
#
# 1. Create a GCP account at console.cloud.google.com, install "gcloud" and "kubectl"
# CLIs.
# 2. Login to GCP and create a GKE cluster if you dont already have one to deploy
# the Odoo container into, named "odoo-production" or update line #63 of
# odoo-kubernetes.yml
# 3. Create a Cloud SQL Postgres instance, named "odoo-postgres" or update line #63
# of odoo-kubernetes.yml
# 4. Follow the instructions for acquiring and setting appropriate credentials
# to get the Cloud SQL sidecar container connected from inside a GKE pod:
# https://cloud.google.com/sql/docs/mysql/connect-kubernetes-engine
# 5. Create a static external IP if you want access from public internet, named
# "odoo-ingress-ip" or update line #7 of odoo-kuberenetes.yml
# 6. Deploy the application to your cluster via "$ kubectl apply -f odoo-kubernetes.yml"
# 7. Navigate to the public static IP and setup Odoo as the administrator.
# 8. Create SSL certificates via LetsEncrypt (donate!) and add the ssl-secret tls secret
# to your GKE cluster.
# 9. Update your DNS records to give your team easier access to the instance.
# 10. Enjoy using only a tenth of a VM for your ERP.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment