News Service implemented using Spring Boot and MySQL.
You can install the project using the following command:
git clone https://github.com/serhhatsari/news-service
In order to run the server with docker compose, create an API KEY
at https://mediastack.com,
then add your API KEY
to the docker compose file:
NEWS_API_KEY=<your-api-key>
Then, can start the server using the following command:
docker compose up --build -d
Server is now accessible at the
localhost:8080
You can delete the containers using the following command:
docker compose down
Any endpoint that is exposed by the server can be accessible at the /swagger-ui/index.html endpoint.
eg: http://localhost:8080/swagger-ui/index.html
In order to deploy the server to k8s, create an API KEY
at https://mediastack.com,
then add your API KEY
to the deployment file:
- name: NEWS_API_KEY
value: <your-api-key>
After that, you can deploy the server to the k8s using the following command:
kubectl apply -f deployment.yml
If you are using minikube, then run the following command to generate a URL to access the server:
minikube service blog-service --url
Server is now accessible at the URL given by minikube.
You can delete the server from k8s using the following command:
kubectl delete -f deployment.yml
Any endpoint that is exposed by the server can be accessible at the /swagger-ui/index.html endpoint.
eg: http://localhost:8080/swagger-ui/index.html
First, you need to create MySQL container using the following command:
docker container run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=news-db -e MYSQL_USER=dev -e MYSQL_PASSWORD=dev -d --name mysql mysql
- After finishing development, you can delete the database using the following command:
docker container rm mysql -f