Your application should be a simple, small, operable web-style API or service provider.
To keep things simple, I chose to use go
with no additional third party packages for my application.
The application implements:
appaddr/
a root endpoint, which respondshello world
appaddr/healthcheck
a health endpoint, which returns http code200
if application status is healthy and500
if it is notappaddr/metadata
a metadata endpoint, which returns basic information about application
"myapplication": [
{
"version": "1.0",
"description" : "pre-interview technical test",
"lastcommitsha": "abc57858585"
}
]
- a test suite: the set of unit tests to check the correctness of the code and python script to check if the endpoints are accessible.
- a means of packaging my application as a single deployable artefact (Dockerfile)
- a pipeline that builds my application on each commit (.travis.yml)
The application has following packages:
main
(registers the endpoints and starts listener at:8080
)handlers
(functions that convert go structures to strings and write them into html responses)healthcheck
(runs health check and returns the response code)storage
(obtains and constructs the application metadata)
Deployment contains three stages:
- executing unit test
- executing api call tests
- building docker image and pushing it to the
evedel/myobtestservice
One can run the application with
docker run -rm -p12345:8080 evedel/myobtestservice
- there is no https (service might be put behind secure reverse proxy)
- there is no serving port configuration (docker port forwarding might be used for this means)
- there might be bugs