|
| 1 | +# How to deploy a new service |
| 2 | + |
| 3 | +Open Food Facts is made of several components and tools for the community or to manage the innfrastructure. |
| 4 | + |
| 5 | +Each of those service will cost resources and have certain requirements to run. |
| 6 | +It's important to keep those things in mind when deploying a new service. |
| 7 | + |
| 8 | +## Decide where to deploy |
| 9 | + |
| 10 | +First you have to decide the way you will deploy your service: |
| 11 | + |
| 12 | +* using [docker-compose](./docker_architecture.md) is the preferred way to deploy a service that have developments. |
| 13 | + It enables an easy updgrade of main components, a good reproducibility of the environment, |
| 14 | + and a good integration in [CI/CD tools](./cicd.md) |
| 15 | + |
| 16 | + Docker compose are to be deployed in a VM. We are also experimenting deploying them in containers, but there is no official support for that. |
| 17 | + |
| 18 | +* using a [proxmox container](./proxmox.md#how-to-create-a-new-container) is the second best option. |
| 19 | + Use this if you deploy a service that is packaged in debian, |
| 20 | + or that updates easily in such environment (eg. a PHP software). |
| 21 | + |
| 22 | +That decided you have to choose the best server to deploy your service. |
| 23 | +This is done in coordination with the infrastructure team. |
| 24 | + |
| 25 | +Factors to consider: |
| 26 | +* resources needed by the service |
| 27 | +* latency needed to access other services (or the other way around) |
| 28 | +* how critical the service is |
| 29 | + |
| 30 | + |
| 31 | +## Separating data from the system |
| 32 | + |
| 33 | +It's important to try to separate data from the system. |
| 34 | + |
| 35 | +You have different types of data: |
| 36 | +* Primary source Data |
| 37 | +* Indexes (that can be rebuilt) |
| 38 | +* Caches and temporary data |
| 39 | +* Logs |
| 40 | +* Configurations data |
| 41 | + |
| 42 | +Separating Data has a lot of benefits: |
| 43 | +* It enables updating the system without putting data at risk and enabling a roll-back without loosing data |
| 44 | +* It's enables putting data on faster disks if needed. |
| 45 | + |
| 46 | +Of course if your service is not very important, does not have much data, and you can afford loosing some data, it might not be worth the effort. |
| 47 | + |
| 48 | +## Watch for performance after deployment |
| 49 | + |
| 50 | +If your service is heavy duty, try to do some performance check in staging. |
| 51 | + |
| 52 | +After deployment you should also check |
| 53 | +how the new service impacts the performance of the whole system. |
| 54 | + |
| 55 | +[Munin](./munin.md) offers a good way to check that, |
| 56 | +as you can compare performances before and after deployment. |
| 57 | + |
| 58 | +Some key indicators to monitor: |
| 59 | +* CPU usage (also look at I/O wait time) |
| 60 | +* RAM usage |
| 61 | +* disk Usage (utilization per device) |
| 62 | +* Pressure stall information, gives you indication on the bottleneck between CPU, disk and RAM |
0 commit comments