Skip to content

Commit 6e90f47

Browse files
deploy dolibarr on podman and kubernetes (#15)
* deploy dolibarr on podman * deploy dolibarr on kubernetes
1 parent a6746e3 commit 6e90f47

File tree

17 files changed

+623
-9
lines changed

17 files changed

+623
-9
lines changed

dolibarr/README.adoc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
= Dolibarr Application
2+
:author: Antonio C.
3+
:email: <ac (at) trikorasolutions (dot) com>
4+
:Revision: 1
5+
:toc: left
6+
:toc-title: Table of Contents
7+
:icons: font
8+
:description: Dolibarr Application guide
9+
:source-highlighter: highlight.js
10+
11+
== Introduction
12+
13+
[.lead]
14+
Dolibarr deployment and administration.
15+
16+
== Systems
17+
18+
This project is available for Kubernetes and Podman. Follow the links to match
19+
the platform.
20+
21+
* link:kubernetes/README.adoc[Kubernetes]
22+
23+
* link:podman/README.adoc[Podman]

dolibarr/k8s/README.adoc

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
= Dolibarr on Kubernetes
2+
:author: Antonio C.
3+
:email: <ac (at) trikorasolutions (dot) com>
4+
:revdate: {{docdate}}
5+
:toc: left
6+
:toc-title: Table of Contents
7+
:icons: font
8+
:description: Dolibarr on a Kubernetes cluster.
9+
:source-highlighter: highlight.js
10+
11+
== Introduction
12+
13+
[.lead]
14+
Dolibarr on a Kubernetes cluster.
15+
16+
This document describes ths Dolibarr deployment and maintenance tasks on a
17+
Kubernetes cluster.
18+
19+
20+
21+
== Installation Guide
22+
23+
=== Namespace
24+
25+
[.lead]
26+
Create the namespace.
27+
28+
[source,bash]
29+
----
30+
ansible-playbook kubernetes/ansible/create-namespace-playbook.yaml \
31+
-e @dolibarr/k8s/helm/ansible/defaults/main.yaml
32+
----
33+
34+
=== PostgreSQL
35+
36+
[.lead]
37+
Install PostgreSQL using the Helm Chart.
38+
39+
[source,bash]
40+
----
41+
ansible-playbook pgsql/k8s/helm/ansible/pgsql-install-playbook.yaml \
42+
-e "@kubernetes/storage/ceph/ansible/defaults/main.yaml" \
43+
-e @dolibarr/k8s/helm/ansible/defaults/main.yaml \
44+
-e db_password=${DB_PASSWORD}
45+
----
46+
47+
=== Dolibarr
48+
49+
[.lead]
50+
Deploy the Dolibarr container.
51+
52+
Set the environment variables.
53+
54+
[source,bash]
55+
----
56+
DB_PASSWORD=
57+
APP_ADMIN_PASSWORD=
58+
CRON_KEY=
59+
ROOT_URL=
60+
----
61+
62+
63+
== Uninstall
64+
65+
[NOTE]
66+
====
67+
Optionally set the trikora_helm_project_dir variable if deploying local helm chart project.
68+
69+
[source,bash]
70+
----
71+
ansible-playbook dolibarr/k8s/helm/ansible/dolibarr-install-pb.yaml \
72+
-e "@_local_config/network.yaml" \
73+
-e "@kubernetes/storage/ceph/ansible/defaults/main.yaml" \
74+
-e @dolibarr/k8s/helm/ansible/defaults/main.yaml \
75+
-e db_assword="${DB_PASSWORD}" \
76+
-e app_admin_password="${APP_ADMIN_PASSWORD}" \
77+
-e cron_key="${CRON_KEY}" \
78+
-e root_url="${ROOT_URL}" \
79+
-e trikora_helm_project_dir=....
80+
----
81+
82+
83+
PostgreSQL
84+
85+
[source,bash]
86+
----
87+
ansible-playbook pgsql/k8s/helm/ansible/pgsql-uninstall-playbook.yaml \
88+
-e @dolibarr/k8s/helm/ansible/defaults/main.yaml
89+
----
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
app_name: dolibarr
2+
app_namespace: dolibarr
3+
app_version: "22"
4+
5+
db_name: dolibarr
6+
db_user: dolibarr
7+
db_image_tag: 17
8+
9+
namespace_resources:
10+
limits:
11+
cpu: "2000m"
12+
memory: "2Gi"
13+
requests:
14+
cpu: "500m"
15+
memory: "768Mi"
16+
17+
app_resources:
18+
limits:
19+
cpu: "1000m"
20+
memory: "1Gi"
21+
requests:
22+
cpu: "250m"
23+
memory: "256Mi"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
- name: "Install Dolibarr - {{ app_version }}"
3+
hosts: "{{ k8s_host | default('localhost') }}"
4+
gather_facts: "{{ gathering_host_info | default('true') | bool == true }}"
5+
6+
pre_tasks:
7+
- name: "Validate variables"
8+
assert:
9+
that:
10+
# - "pv_root_folder is defined"
11+
- "app_name is defined"
12+
- "app_namespace is defined"
13+
fail_msg: "Missing required parameters"
14+
15+
tasks:
16+
- name: "Template Dolibarr deployment files"
17+
ansible.builtin.template:
18+
src: "helm-dolibarr-values.yaml.j2"
19+
dest: "/tmp/helm-dolibarr-values.yaml"
20+
mode: '0600'
21+
22+
- name: "Deploy Dolibarr with Helm"
23+
kubernetes.core.helm:
24+
name: dolibarr
25+
chart_ref: "{% if trikora_helm_project_dir is defined %}{{ trikora_helm_project_dir }}/charts/dolibarr{% else %}trikorasolns/dolibarr{% endif %}"
26+
release_namespace: "{{ app_namespace }}"
27+
wait: true
28+
replace: true
29+
values_files:
30+
- /tmp/helm-dolibarr-values.yaml
31+
register: odoo_helm_res
32+
...
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
- name: "Install Dolibarr - {{ app_version }}"
3+
hosts: "{{ k8s_host | default('localhost') }}"
4+
gather_facts: "{{ gathering_host_info | default('true') | bool == true }}"
5+
6+
pre_tasks:
7+
- name: "Validate variables"
8+
assert:
9+
that:
10+
# - "pv_root_folder is defined"
11+
- "app_name is defined"
12+
- "app_namespace is defined"
13+
fail_msg: "Missing required parameters"
14+
15+
tasks:
16+
17+
- name: "Undeploy Dolibarr with Helm"
18+
kubernetes.core.helm:
19+
name: dolibarr
20+
release_namespace: "{{ app_namespace }}"
21+
wait: true
22+
state: absent
23+
register: odoo_helm_res
24+
...
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
persistence:
2+
{% if storage_class_rwo is defined or storage_class is defined %}
3+
storageClassName: "{{ storage_class_rwo | default(storage_class) }}"
4+
{% endif %}
5+
volumeDolibarrDocuments: 20Gi
6+
volumeDolibarrCustom: 1Gi
7+
dbHost: postgresql.{{ app_name }}.svc.cluster.local
8+
dbName: dolibarr
9+
dbUser: dolibarr
10+
dbType: pgsql
11+
dbPort: "5432"
12+
dbPassword: {{ db_password }}
13+
14+
ingress:
15+
enabled: true
16+
className: "nginx"
17+
annotations:
18+
nginx.ingress.kubernetes.io/proxy-read-timeout: "180"
19+
nginx.ingress.kubernetes.io/proxy-send-timeout: "180"
20+
nginx.ingress.kubernetes.io/proxy-connect-timeout: "180"
21+
nginx.ingress.kubernetes.io/proxy-read-timeout: "180"
22+
nginx.ingress.kubernetes.io/proxy-send-timeout: "180"
23+
nginx.ingress.kubernetes.io/proxy-body-size: 50m
24+
nginx.ingress.kubernetes.io/client-body-buffer-size: 50m
25+
hosts:
26+
- host: "{{ app_name }}.{{ local_domain }}"
27+
paths:
28+
- path: /
29+
pathType: Prefix
30+
backend:
31+
serviceName: http
32+
servicePort: 80
33+
34+
app:
35+
adminUser: admin
36+
adminPassword: "{{ app_admin_password }}"
37+
# dolibarr,ldap,openid,http
38+
auth: dolibarr,openid
39+
companyName: "{{ company_name }}"
40+
companyCountryCode: ES
41+
doliCron: "0"
42+
doliCronKey: "{{ cron_key }}"
43+
# Comma-separated list of modules to be activated at install. modUser will always be activated. (Ex: Societe,Facture,Stock).
44+
enableModules: User,ExpenseReport,HRM,Societe,Propale,Commande,Contrat,Fournisseur,SupplierProposal,Reception,Facture,Tax,Margin,Product,Service,Projet,Agenda,Fckeditor,Import,Export,Api,OpenIDConnect
45+
# Set initDemo to 1 to load the demo data.
46+
initDemo: "0"
47+
rootUrl: "{{ root_url }}"
48+
49+
resources:
50+
limits:
51+
cpu: "1000m"
52+
memory: "1Gi"
53+
requests:
54+
cpu: "250m"
55+
memory: "256Mi"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
app_name: dolibarr
2+
app_namespace: dolibarr
3+
app_version: "22"
4+
5+
db_name: dolibarr
6+
db_user: dolibarr
7+
8+
namespace_resources:
9+
limits:
10+
cpu: "2000m"
11+
memory: "2Gi"
12+
requests:
13+
cpu: "500m"
14+
memory: "500Mi"
15+
16+
app_resources:
17+
limits:
18+
cpu: "1000m"
19+
memory: "1Gi"
20+
requests:
21+
cpu: "250m"
22+
memory: "256Mi"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
- name: "Install Dolibarr"
3+
hosts: "{{ k8s_host | default('localhost') }}"
4+
gather_facts: "{{ gathering_host_info | default('true') | bool == true }}"
5+
6+
pre_tasks:
7+
- name: "Validate variables"
8+
assert:
9+
that:
10+
# - "pv_root_folder is defined"
11+
- "app_name is defined"
12+
- "app_namespace is defined"
13+
fail_msg: "Missing required parameters"
14+
15+
tasks:
16+
- name: "Create deployment"
17+
kubernetes.core.k8s:
18+
definition:
19+
apiVersion: apps/v1
20+
kind: Deployment
21+
metadata:
22+
name: example
23+
namespace: testing
24+
"app.kubernetes.io/name": "{{ app_name }}"
25+
"app.kubernetes.io/version": "{{ app_version }}"
26+
spec:
27+
paused: True
28+
wait: yes
29+
wait_condition:
30+
type: Progressing
31+
status: Unknown
32+
reason: DeploymentPaused
33+
34+
...

dolibarr/podman/README.adoc

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
= Deploy Dolibarr on Podman
2+
:author: Antonio C.
3+
:email: <ac (at) trikorasolutions (dot) com>
4+
:revdate: {{docdate}}
5+
:toc: left
6+
:toc-title: Table of Contents
7+
:icons: font
8+
:description: Deploy Dolibarr on a Podman
9+
:source-highlighter: highlight.js
10+
11+
== Introduction
12+
13+
[.lead]
14+
This document describes how to deploy a PostgreSQL database with Podman.
15+
16+
== Preparation
17+
18+
TBD
19+
20+
== Install
21+
22+
Create the POD.
23+
24+
[source,bash]
25+
----
26+
podman pod create --label app=dolibarr \
27+
--label app.kubernetes.io/name="dolibarr" \
28+
--label app.kubernetes.io/instance="dolibarr" \
29+
--label app.kubernetes.io/version="22" \
30+
--label app.kubernetes.io/component="application" \
31+
--label app.kubernetes.io/part-of="dolibarr" \
32+
-p 7180:80 -p 7432:5432 \
33+
dolibarr
34+
----
35+
36+
Deploy the database
37+
38+
[source,bash]
39+
----
40+
ansible-playbook pgsql/podman/ansible/podman-install-playbook.yaml \
41+
-e pod_name=dolibarr \
42+
-e db_name=dolibarr \
43+
-e db_user=dolibarr \
44+
-e pgsql_version="17.1" \
45+
-e db_password="${DB_PASSWORD:-dolibarr}"
46+
----
47+
48+
[source,bash]
49+
----
50+
ansible-playbook dolibarr/podman/ansible/dolibarr-install-playbook.yaml \
51+
-e pod_name=dolibarr
52+
----
53+
54+
55+
== Uninstall
56+
57+
[source,bash]
58+
----
59+
ansible-playbook dolibarr/podman/ansible/dolibarr-uninstall-playbook.yaml \
60+
-e pod_name=dolibarr
61+
----
62+
63+
[source,bash]
64+
----
65+
ansible-playbook pgsql/podman/ansible/podman-uninstall-playbook.yaml \
66+
-e pod_name=dolibarr \
67+
-e db_name=dolibarr
68+
----
69+
70+
== Upgrade
71+

0 commit comments

Comments
 (0)