Common requirements π₯
Microservice manifestoβ
- Small disposable components with single responsibility both in backend and frontend
- Extensibility through addition of components as opposed to modifying existing ones, Composition vs. inheritance
- Do not refactor legacy application code, gradually replace with new better designed components
- Streaming oriented, event driven, interaction via event propagation
- Automated delivery pipelines, easy to add and remove components
- Component status visibility via monitoring and alerting
Metricsβ
All service must expose metrics endpoint for prometheus
Route (private aceess):β
/metrics
Responseβ
# HELP php_info Information about the PHP environment.
# TYPE php_info gauge
php_info{version="8.0.8"} 1
...
Healhcheckβ
All service must expose healthcheck endpoint
Route (private aceess):β
/_health
Response:β
{
"status": "UP",
"version": "v0.0.1-master",
}
Loggingβ
We use two main tools to log our system: ELK Stack + Sentry.
ELK is used to cover all services with logsβ
Sentry collects critical project errorsβ
Server portβ
The standard ports for all our services are described here.
For http serviceβ
3000
For grpc serviceβ
3030
Note: PHP + FPM configβ
All services must be accessible through standard interfaces (http/grpc/etc).
This means that the container cannot be started with only php-fpm.
All php-fpm service must have nginx around and expose 3000 port.
Dockerβ
Default environment variables:β
SERVICE_NAME
Example: SERVICE_NAME=Service Name
SERVICE_VERSION
Example: SERVICE_VERSION=v0.0.1-master
ENVIRONMENT
Example: ENVIRONMENT=dev
ENVIRONMENT_NAME
Example: ENVIRONMENT_NAME=dev01
Kubernetesβ
Helm filesβ
Configurationβ
Config path in dockerβ
Template: /{SERVICE_NAME}/configs/{}.yml
Secretsβ
Template: /{SERVICE_NAME}/secrets/{}.yml
Service Discoveryβ
Databasesβ
Database nameβ
Template: {ENVIRONMENT_NAME}_{SERVICE_NAME}_{TOPIC NAME}