Skip to content

AlexGuti14/url-shortener

Repository files navigation

Web Engineering 2019-2020 / URL Shortener

Build Status codecov Coverage Status

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 parameter url.
  • 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 parameter hash.
  • Redirection service: GET /{id} redirects the request to a URL associated with the parameter id.
  • Database service: Persistence and retrieval of ShortURL and Click objects.
  • CSV service: WebSockets creates a shortened URLs from a CSV with URLs.

The application can be run as follows:

DOCKER:

  1. Create file .jar
gradle build
  1. Create docker image
docker build -t urlshortener .
  1. Up docker-compose
docker-compose up -d
  1. Copy .sql in docker master container
docker cp schema.sql mysql-url:/schema.sql
  1. 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:

  1. 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