From 76e83b4b7eebf9f448b6c8526cd5b1d7405a44b6 Mon Sep 17 00:00:00 2001 From: Ryan Hill Date: Sun, 4 Dec 2022 18:54:40 +0000 Subject: [PATCH] Working solutions needs tests and exception handling. --- solution/README.md | 39 +++++++++++++++++++++++++++++++++---- solution/docker-compose.yml | 28 ++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 solution/docker-compose.yml diff --git a/solution/README.md b/solution/README.md index 610e558..7f0a5ea 100644 --- a/solution/README.md +++ b/solution/README.md @@ -1,7 +1,38 @@ -README +Prerequisites ==== -How to run the your solution... +How to get setup +We have 3 parts to the setup. +1. A springboot application build using java 17 using maven. +2. A python web application using flask. +3. A docker container running a postgres database. -IMPORTANT +1.1. Springboot application will create the database tables and populate them with data +via the REST API endpoints. + +1.2 to set this application you will need java installed on your machine. +I'm using Java 17.0.1. I would suggest you use the same version. + +1.3 You will also need maven installed on your machine. I'm using +maven 3.8.6. I would suggest you use the same version. + +2.1 The python application will expose one REST API to get the EUR to GBP exchange rate. +the springboot application will call this API to get the exchange rate on port 5000. + +2.2 to set this application you will need python installed on your machine. +I'm using python 3.8 I would suggest you use the same version. + + +How to run the applications ==== -To avoid unconcious bias, we aim to have your submission reviewed anonymously by one of our engineering team. Please try and avoid adding personal details to this document such as your name, or using pronouns that might indicate your gender. \ No newline at end of file +Once all the above is installed run the applications. + +To run the springboot application run the following command in the root of the java project. +- run mvn clean install +- mvn spring-boot:run + +To run the python application run the following command in the root of the python project. +- export FLASK_APP=exchange_rate_service_v1.py +- flask run + +To run the docker container run the following command in the root of the solution project. +- docker-compose up diff --git a/solution/docker-compose.yml b/solution/docker-compose.yml new file mode 100644 index 0000000..9da4113 --- /dev/null +++ b/solution/docker-compose.yml @@ -0,0 +1,28 @@ +version: '3.4' + +services: + postgresql_database: + image: postgres:latest + environment: + - POSTGRES_USER=admin + - POSTGRES_PASSWORD=admin1234 + - POSTGRES_DB=productDb + ports: + - "5432:5432" + restart: always + volumes: + - database-data:/var/lib/postgresql/data/ + + pgadmin: + image: dpage/pgadmin4 + environment: + - PGADMIN_DEFAULT_EMAIL=pgadmin4@pgadmin.org + - PGADMIN_DEFAULT_PASSWORD=admin1234 + ports: + - '5050:80' + restart: always + volumes: + - pgadmin:/root/.pgadmin +volumes: + database-data: + pgadmin: