Skip to content

News Service implemented using Spring Boot and MySQL.

Notifications You must be signed in to change notification settings

serhhatsari/news-service

Repository files navigation

Description

News Service implemented using Spring Boot and MySQL.

Installation

You can install the project using the following command:

git clone https://github.com/serhhatsari/news-service

Running with Docker Compose

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

Swagger Page

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

Running with Kubernetes

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

Swagger Page

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

Local Development

Database

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

Releases

No releases published

Packages

No packages published