Compare commits

...

25 Commits

Author SHA1 Message Date
Mohammad Awais 065ff33494
[ADD] main docs 2024-04-21 16:31:44 +05:00
Mohammad Awais b5257b64d5
[ADD] main docs 2024-04-21 16:23:19 +05:00
Mohammad Awais 6ba71d7103
[ADD] main docs 2024-04-21 16:17:39 +05:00
Mohammad Awais a8ddaa4bcc
[MOD] DB Server Docs 2024-04-21 16:00:13 +05:00
Mohammad Awais 3894be3456
[MOD] k8s cluster setup guide 2024-04-21 15:56:57 +05:00
Mohammad Awais f370e3ca24
[ADD] k8s cluster setup guide 2024-04-21 15:49:47 +05:00
Mohammad Awais f1fe1c86b9
[MOD] DB Server Docs 2024-04-21 15:32:16 +05:00
Mohammad Awais f3e979c96b
[MOD] DB Server Docs 2024-04-21 15:23:59 +05:00
Mohammad Awais 0f54c3056f
[MOD] DB Server Docs 2024-04-21 15:22:23 +05:00
Mohammad Awais 09c576a320
[MOD] DB Server Docs 2024-04-21 15:15:14 +05:00
Mohammad Awais 769738f8c3
[MOD] Docs 2024-04-21 15:11:29 +05:00
Mohammad Awais 60f77f3d9c
[MOD] DB server 2024-04-21 15:08:54 +05:00
Mohammad Awais 18b713bc44
[ADD] DO Documentation 2024-04-21 15:03:59 +05:00
Mohammad Awais 8b7e257d49
[ADD] new page 2024-04-20 10:16:22 +05:00
Mohammad Awais 223a93d887
[ADD] imgaes 2024-04-19 18:10:28 +05:00
Mohammad Awais d386629b84
[WIP] Navigation 2024-04-19 17:47:33 +05:00
Mohammad Awais a753df5dbc
[ADD] navigation 2024-04-19 17:45:01 +05:00
Mohammad Awais 6267779858
Merge pull request #3 from herawais/dependabot/pip/docs/pymdown-extensions-10.0
Bump pymdown-extensions from 9.5 to 10.0 in /docs
2024-04-14 20:06:02 +05:00
dependabot[bot] 28640e3b28
Bump pymdown-extensions from 9.5 to 10.0 in /docs
Bumps [pymdown-extensions](https://github.com/facelessuser/pymdown-extensions) from 9.5 to 10.0.
- [Release notes](https://github.com/facelessuser/pymdown-extensions/releases)
- [Commits](https://github.com/facelessuser/pymdown-extensions/compare/9.5...10.0)

---
updated-dependencies:
- dependency-name: pymdown-extensions
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-14 15:05:13 +00:00
Mohammad Awais e1eee3ae25
[MOD] title of docs 2024-04-13 17:01:51 +05:00
Mohammad Awais dfe81cccd9
[ADD] requirements.in 2024-04-13 17:00:20 +05:00
Mohammad Awais 640708082a
[ADD] requirements.txt 2024-04-13 16:58:33 +05:00
Mohammad Awais 5fcfaebbcf
[FIX] minor 2024-04-13 16:56:19 +05:00
Mohammad Awais 168045cd17
[ADD] docs first commit 2024-04-13 16:54:40 +05:00
Mohammad Awais 67c173a6ec
[ADD] readthedocs yaml 2024-04-13 13:54:22 +05:00
16 changed files with 322 additions and 0 deletions

20
.readthedocs.yaml Normal file
View File

@ -0,0 +1,20 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.10"
mkdocs:
configuration: mkdocs.yml
# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt

49
docs/db_server.md Normal file
View File

@ -0,0 +1,49 @@
# Setup DataBase Server for Client Instances
Either Use managed db service from [DO](https://www.digitalocean.com/products/managed-databases-postgresql)
or Setup a new VPS and install Postgres on your VPS
and dont forget to setup and alowing remote host connections
vim /etc/postgresql/14/main/postgresql.conf
Uncomment and edit the listen_addresses attribute to start listening to start listening to all available IP addresses.
!!! danger "Caution"
On production dont allow all hosts, only your desired IPs
Replace following in pg_hba.conf
listen_addresses = '*'
Now edit the PostgreSQL access policy configuration file.
vim /etc/postgresql/14/main/pg_hba.conf
Append a new connection policy (a pattern stands for [CONNECTION_TYPE][DATABASE][USER] [ADDRESS][METHOD]) in the bottom of the file.
!!! danger "Caution"
On production dont allow all hosts, only your desired IPs
Add following in pg_hba.conf
host all all 0.0.0.0/0 md5
We are allowing TCP/IP connections (host) to all databases (all) for all users (all) with any IPv4 address (0.0.0.0/0) using an MD5 encrypted password for authentication (md5).
It is now time to restart your PostgreSQL service to load your configuration changes.
systemctl restart postgresql
And make sure your system is listening to the 5432 port that is reserved for PostgreSQL.
ss -nlt | grep 5432

BIN
docs/img/img1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
docs/img/img2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

BIN
docs/img/img3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
docs/img/img4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

BIN
docs/img/img5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
docs/img/k0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
docs/img/k1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
docs/img/k2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

112
docs/index.md Normal file
View File

@ -0,0 +1,112 @@
# Welcome to Odoo SaaS on K8s documentation!
## Architecture
![Architecture](img/img2.png)
There are two main sections of the system
1. Kubernetes Cluster
2. Manager Instance
## 1. Kubernetes Cluster
In Kubernetes Cluster we will have all essential parts of K8s cluster that are required to run a cluster in production
- Load Balancer
- cluster
- Nodes
- PVs
For detailed configuration of k8s cluster on digitalocean [click here](k8s_cluster.md), for aws (will be added later)
## 2. Manager Instance
It is a separate, VPS server
On manager instance we will install Odoo and these modules, currently odoo version 14.0 is supported, i have created a task to migrate these modules for latest (v17.0) of odoo
Your Cluster should be accessible from this instance.
Once you are able to access your cluster within your saas-manager-instance using kubectl
### Step 1 (Cluster Configuration):
Click Configuration -> Cluster Configurations and create a new cluster
We can manage multiple clusters from 1 manager instance
in name field add anything you want to name your cluster
Yaml Configuration file, copy and paste the kubeconfig.yaml
domain name is the domain which is attached and pointed to your k8s cluster / LoadBalancer DNS, it should be pre configured, write it as .yourdomain.com
then click on “Check Connection” , it should list all the namespaces of your cluster , it is just a method to check if we are good to go
![Cluster1](img/img1.png)
### Step 2 (Docker Images Configuration):
You can also use your private docker images hosted on [Docker Hub](https://hub.docker.com/) or public [odoos official docker images](https://hub.docker.com/_/odoo) to deploy your Odoo instance
in “Image Name” field you have to write the image name e.g bitnami/odoo , username/odoo, etc.
other fields are self explanatory
if your docker images are on private registry then place the “.docker/config.json” file here
more info [here](https://docs.docker.com/reference/cli/docker/config/)
![Cluster1](img/img3.png)
### Step 3 (Database server):
You have to deploy a Separate VPS for and install and configure postgres on it , or can use managed DB service from DigitalOcean or AWS
read the guide [here](db_server.md)
then check connectivity if you are able to connect from “Manager Instance” to the db server,
this db server will host all the client databases
![Cluster1](img/img5.png)
### Step 4 (Create App/Instance):
1. `Unique id` is the id of instance, dont change it in any case
2. `Name`, write any name
3. choose `sub domain` as per your requirement
4. if you want to deploy this client on a specific Node of K8s cluster then check “Any Specific Node” otherwise leave it as it is
5. choose Database server
6. `Database name` will be the name of db, but `sub domain name and database name should be same`
7. if you want to use `extra addons from github`, check the box and enter url, like this “https://github.com/OCA/account-financial-tools.git“
8. if the repo is private then you have to place the `access token` also, more info [here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
9. Choose the `docker image`
10. if you want to install the `demo data` also then check the box
11. leave `Modules to Install` empty
12. Leave the `App Credentials` empty, these will be automatically populated after the instance goes live
13. Client user is the user, to whom you want to notify about this instance and creds, you should have configured smtp in your manager instance
![Cluster1](img/img4.png)
Save and click on **Deploy App**

42
docs/k8s_cluster.md Normal file
View File

@ -0,0 +1,42 @@
# Kubernetes Cluster Setup
!!! note
Following guide will be based on DigitalOcean Managed Kubernetes (DOKS)
Create a cluster and add node(s) in the cluster on DO,
![Setup and Download Config File](img/k0.png)
1. Install Nginx ingress controller in the cluster, with app installer
2. Then loadbalancer will be provisioned automatically
![Nginx Ingress Controller](img/k1.png)
After pointing the domain to LBs DNS and installing nginx ingress controller
edit the LoadBalancer service (ingress-nginx/ingress-nginx-controller) using any tool, i am using k9s
Add this
kubernetes.digitalocean.com/load-balancer-id: {id_of_lb_here}
service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: 'true'
service.beta.kubernetes.io/do-loadbalancer-hostname: yourdomain.com
![Nginx Ingress Controller Service](img/k2.png)
Install cert-manager and ssl issuer. as per following guides
[https://github.com/cert-manager/cert-manager](https://github.com/cert-manager/cert-manager)
[https://kenanbek.github.io/kubernetes-https-nginx-ingress-cert-manager-digitalocean](https://github.com/cert-manager/cert-manager)
[https://cert-manager.io/docs/installation/](https://github.com/cert-manager/cert-manager)

6
docs/manager.md Normal file
View File

@ -0,0 +1,6 @@
# Setup Manager Instance to Manage Client Instances
!!! note
To be added here.

3
docs/requirements.in Normal file
View File

@ -0,0 +1,3 @@
mkdocs
mkdocstrings[python]
markdown-include

67
docs/requirements.txt Normal file
View File

@ -0,0 +1,67 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile docs/requirements.in
#
click==8.1.3
# via mkdocs
ghp-import==2.1.0
# via mkdocs
griffe==0.22.0
# via mkdocstrings-python
importlib-metadata==4.12.0
# via mkdocs
jinja2==3.1.2
# via
# mkdocs
# mkdocstrings
markdown==3.3.7
# via
# markdown-include
# mkdocs
# mkdocs-autorefs
# mkdocstrings
# pymdown-extensions
markdown-include==0.6.0
# via -r requirements.in
markupsafe==2.1.1
# via
# jinja2
# mkdocstrings
mergedeep==1.3.4
# via mkdocs
mkdocs==1.3.0
# via
# -r requirements.in
# mkdocs-autorefs
# mkdocstrings
mkdocs-autorefs==0.4.1
# via mkdocstrings
mkdocstrings[python]==0.19.0
# via
# -r requirements.in
# mkdocstrings-python
mkdocstrings-python==0.7.1
# via mkdocstrings
packaging==21.3
# via mkdocs
pymdown-extensions==10.0
# via mkdocstrings
pyparsing==3.0.9
# via packaging
python-dateutil==2.8.2
# via ghp-import
pyyaml==6.0
# via
# mkdocs
# pymdown-extensions
# pyyaml-env-tag
pyyaml-env-tag==0.1
# via mkdocs
six==1.16.0
# via python-dateutil
watchdog==2.1.9
# via mkdocs
zipp==3.8.0
# via importlib-metadata

23
mkdocs.yml Normal file
View File

@ -0,0 +1,23 @@
site_name: Production ready Odoo SaaS based on Kubernetes
theme:
name: readthedocs
highlightjs: true
plugins:
- search
- mkdocstrings:
handlers:
# See: https://mkdocstrings.github.io/python/usage/
python:
options:
docstring_style: sphinx
markdown_extensions:
- markdown_include.include:
base_path: .
- admonition
nav:
- Home: 'index.md'
- Setup Manager Instance: 'manager.md'
- Setup K8s Cluster: 'k8s_cluster.md'
- Setup DB Server: 'db_server.md'