RESTful API Orchestrator created for the U Society project.
This microservice has the function of the resource server, so, if it’s the head of the whole ecosystem.
- Spring boot (Open source microservice-based Java web framework)
- Docker (Used for package the application in containers)
- Docker compose (Tool for defining and running multi-container applications)
- MVN (Maven manager dependency, used to build and manage the entire project)
- MySQL (Relational database management system)
- OAUTH2 (Open standard for access delegation)
- JWT (Java Web Tokens, open standard for creating signed and encrypted data)
- Spring Security (It provides the authentication and authorization mechanisms)
- Webflux (Reactive REST client used to interconnect all the microservices ecosystem)
- SpringDoc OpenAPI (Used for automating the generation of API documentation)
- Spring mail (Mails support)
- Gmail SMTP (Email provider used to send emails)
- Apache tomcat (Web server container)
- Jackson databind (High-performance JSON processor)
- Apache commons lang (Reusable static utility methods)
- JUnit + Mockito (Unit testing stuff)
- JaCoCo (Code coverage report generator)
- Redis (In-memory key-value data structure store)
- Lettuce client (Fully non-blocking Redis client)
- Slugify (Uniques identifying part address generator)
- Clone repository:
git clone [email protected]:renderjaviii/u-society-api.git
- Recreate database:
docker-compose -f src/main/resources/docker-db.yml up --build
- Recreate in-memory store (cache):
docker-compose -f src/main/resources/docker-cache.yml up --build
- Compile Spring project and generate deployable file:
mvn clean install
- Build docker image:
docker build -t u-society/manager .
- Run docker container:
docker-compose up --build -d
- Additional utilities:
- Show container logs:
docker-compose logs -f
- Stop container:
docker-compose down -v
- Run tests and check code coverage:
mvn clean test
- Clean Redis cache:
docker exec company-redis redis-cli flushall
ProTips:
- If you need to change some server configuration locally (like port), update the environment variables located in file
src/main/resources/development.env
.- When you run the database's docker container, it will be populated using the seeders files:
src/main/resources/data.sql
andsrc/main/resources/import.sql
(to avoid it, remove the entry points).
Refer to the Swagger documentation: https://localhost:8443/manager/swagger-ui/index.html
.
If you want to interact with the API, please download Postman (or whatever API client that you prefer), this tool will help us to consume the endpoints, e.g., when the user's bearer token is required.
Please, have in mind that a self-signed SSL certificate was configured to fit out HTTPS security communication, so, you may need to add it into the CA store (or ignore the security warning).
There are different Spring profiles (application versions) in order to have the suitable application's behaviors.
Stage | Profile | Features |
---|---|---|
Development | dev |
Development tasks: local machine's resources (complete logging) |
Testing | qa |
E2E check: cloud resources (limited logging) |
Live | prod |
Production deployment: cloud instances (optimal perfomarnce) |