Java - Spring + MySQL
Spring is a framework for Java, ideal for web applications as it is optimized to run multiple services in parallel and securely in a RESTful manner. It is also compatible with other Java frameworks.
MySQL is a widely used open-source relational database management system that allows storing, organizing, and retrieving data efficiently. Developed by Oracle, MySQL offers high speed and reliability, facilitating data management through SQL queries. Its scalability, support for multiple platforms, and ability to integrate with numerous programming languages make it a popular choice for web and enterprise applications. MySQL is highly customizable and has an active developer community that contributes to its continuous improvement.
Project structure
.
βββ app
βΒ Β βββ pom.xml
βΒ Β βββ src
βΒ Β βΒ Β βββ main
βΒ Β βΒ Β βββ java
βΒ Β βΒ Β βΒ Β βββ com
βΒ Β βΒ Β βΒ Β βββ company
βΒ Β βΒ Β βΒ Β βββ project
βΒ Β βΒ Β βΒ Β βββ Application.java
βΒ Β βΒ Β βΒ Β βββ configuration
βΒ Β βΒ Β βΒ Β βΒ Β βββ DockerSecretsProcessor.java
βΒ Β βΒ Β βΒ Β βββ controllers
βΒ Β βΒ Β βΒ Β βΒ Β βββ HomeController.java
βΒ Β βΒ Β βΒ Β βββ entity
βΒ Β βΒ Β βΒ Β βΒ Β βββ Greeting.java
βΒ Β βΒ Β βΒ Β βββ repository
βΒ Β βΒ Β βΒ Β βββ GreetingRepository.java
βΒ Β βΒ Β βββ resources
βΒ Β βΒ Β βββ application.properties
βΒ Β βΒ Β βββ data.sql
βΒ Β βΒ Β βββ META-INF
βΒ Β βΒ Β βΒ Β βββ spring.factories
βΒ Β βΒ Β βββ schema.sql
βΒ Β βββ target
βΒ Β βββ classes
βΒ Β βββ application.properties
βΒ Β βββ com
βΒ Β βΒ Β βββ company
βΒ Β βΒ Β βββ project
βΒ Β βΒ Β βββ Application.class
βΒ Β βΒ Β βββ configuration
βΒ Β βΒ Β βΒ Β βββ DockerSecretsProcessor.class
βΒ Β βΒ Β βββ controllers
βΒ Β βΒ Β βΒ Β βββ HomeController.class
βΒ Β βΒ Β βββ entity
βΒ Β βΒ Β βΒ Β βββ Greeting.class
βΒ Β βΒ Β βββ repository
βΒ Β βΒ Β βββ GreetingRepository.class
βΒ Β βββ data.sql
βΒ Β βββ META-INF
βΒ Β βΒ Β βββ spring.factories
βΒ Β βββ schema.sql
βββ app.Dockerfile
βββ compose.yaml
βββ nginx
βΒ Β βββ default.conf
βββ backup
βΒ Β βββ backup-runner.sh
βββ .env
βββ .env.example
Application deployment:
We navigate to the directory that contains the files needed to build the container:
cd /root/stack/python/nextjs
And bring the application up:
docker compose up -d
Useful commands:
View running containers:
docker compose ps
Stop and remove the application:
docker compose down
Rebuild the application after making code changes:
docker compose up -d --build