This is a PHP & DevOps training and testing project. The setup is intended to gauge the knowledge of the test taker into various skills needed for PHP API development & DevOps tasks.
The stack used is:
- Mezzio-Laminas for the PHP API
- Docker, minikube & Kubernetes for DevOps tasks
- GitHub Actions for CI/CD purposes
For information about the task at hand, see the goal documentation.
Each type of container (nginx, php-fpm) has a separate directory. Each directory contains various layers:
base: this is the base layer for each image and focuses mainly on dependencies and configuration that is applicable for all environments.dev: this is an image that extendsbaseand contains additional instructions for development.production: this is an image that extendsbaseand contains additional instructions for production environments.
Setup / getting started is easy.
- Checkout the repository on your device
- Run
docker compose up -dto run the containers. - Run
bin/composer installto install Composer dependencies. - Open localhost/api/ping
Linting: bin/phpcs
Testing: bin/phpunit
The translation matrix can be found on /api/translation-matrix. The expected response body is as follows:
{
"matrix": [
{
"source": "human",
"targets": [
"labrador",
"poodle",
"parrot",
"parakeet"
]
},
{
"source": "labrador",
"targets": [
"poodle",
"parrot"
]
},
{
"source": "poodle",
"targets": [
"labrador",
"parrot"
]
},
{
"source": "parrot",
"targets": []
},
{
"source": "parakeet",
"targets": [
"parrot"
]
}
]
}To request translations for user input, make a POST call to /api/translate.
Required header: content-type: application/json
Required body:
{
"sourceLanguage": "auto",
"targetLanguage": "parrot",
"input": "Hello there!"
}The expected response body is as follows:
{
"sourceLanguage": "auto",
"targetLanguage": "parrot",
"input": "Hello there!",
"output": "Ik praat je na: Hello there!"
}To run a semi-production environment (deploy to Minikube), run the following scripts:
/scripts/start-minikube.bash> This will start a local Minikube cluster.- Request an ImagePullSecret from the repository owner and create the supplied secret in the
defaultnamespace with the namegithub-registry. /scripts/deploy-to-production.bash> This will perform a deployment to the local Minikube cluster./scripts/forward-for-production.bash> This will output the correct URL for your local device/local Minikube cluster, and show some developer information to help you perform requests against this environment.