This is the start repository for the project developed in this course.
The project is a Spring Boot application that offers a minimum set of functionalities shared by all subprojects.
- Short URL creation service:
POST /
creates a shortened URL from a URL in the request parameterurl
. - Short URL list service:
GET /list
return a list of shortened URLs in db. - Short URL QR service:
GET /qr
return a qr of shortened URL associated with the parameterhash
. - Redirection service:
GET /{id}
redirects the request to a URL associated with the parameterid
. - Database service: Persistence and retrieval of
ShortURL
andClick
objects. - CSV service:
WebSockets
creates a shortened URLs from a CSV with URLs.
The application can be run as follows:
- Create file .jar
gradle build
- Create docker image
docker build -t urlshortener .
- Up docker-compose
docker-compose up -d
- Copy .sql in docker master container
docker cp schema.sql mysql-url:/schema.sql
- Create tables in Master db. Automatically this db is copied in Slave container
docker exec -i -t mysql-url /bin/bash
mysql -uroot -proot url < schema.sql
DOWN DOCKER:
- Down docker-compose
docker-compose down -v
OTHER DOCKER COMMANDS:
docker images: view docker images
docker ps: list of execute container
docker rm: remove container
docker rmi: remove image
docker search: search image
docker pull: download image