This repository stores all the code for the MarkDock API.
- Development Guide
- Testing Guide
- Migration Guide
- Single Instance Deployment Guide (Previous Strategy)
- Multiple Instance Deployment Guide (Current Strategy)
- Infrastructure Setup Guide
- Docker Guide
- GitHub Workflows
- Spring Boot application
- MySQL database
- Flyway for database migrations
- Docker setup for both development and production environments
- GitHub Actions for running tests and deployment to a server
- Docker and Docker Compose
- Git
-
Clone this repository:
git clone git@github.com:mark-dock/mark-dock-api.git
-
Copy the
.env.example
file to.env
. This file contains the environment variables for the application with default values. You can adjust these values if you want to change the application's configuration.cp .env.example .env
-
Start the development environment:
docker compose up
-
Access the application at
http://127.0.0.1:8080
(Port 8080 will be replaced by the value specified in the environment variable {SPRING_APP_PORT}." -
To check the server's health, visit:
http://127.0.0.1:8080/api/health
-
(Optional) To enable automatic reloading of changes in Spring Boot, the configuration is already set up in the project. However, you'll need to adjust some permissions in your editor. For IntelliJ, follow these steps:
- Go to Settings > Build, Execution, Deployment > Compiler and enable Build project automatically.
- Then, go to Advanced Settings and check Allow auto-make to start even if the developed application is currently running.
For local development, use the compose.yaml
file:
docker compose up
This will start both the MySQL database and the Spring Boot application in development mode.
If you want to reset the development environment, you can run the following command:
./scripts/dev_reset.sh
This script will remove the backend containers, remove the volumes, fix the .env
file, and start the development environment again.
The main project structure is as follows:
.github/
- GitHub Actions workflowsdocker/
- Dockerfiles and Docker Compose files (Except the compose.yaml file which is in the root directory)docs/
- Documentation filesmigrations/
- Flyway database migrationsscripts/
- Shell scripts for development and deploymentsrc/
- Source code.env.example
- Example environment variablescompose.yaml
- Docker Compose file for developmentmvnw
- Maven wrapperpom.xml
- Maven dependencies
Run tests using Maven:
./mvnw test
Tests will automatically run on pull requests.