An open API service indexing awesome lists of open source software.

https://github.com/sarakhild/springboot-thymeleaf-crud-db-deployment

This project manages an employee database with CRUD operations and is deployed on Alibaba Cloud using Terraform for scalable infrastructure management
https://github.com/sarakhild/springboot-thymeleaf-crud-db-deployment

alibabacloud dockerfile dokcer-compose mysql spring-boot spring-jpa terraform thymeleaf

Last synced: 3 months ago
JSON representation

This project manages an employee database with CRUD operations and is deployed on Alibaba Cloud using Terraform for scalable infrastructure management

Awesome Lists containing this project

README

        

# Spring Boot & Thymeleaf: CRUD Operations with Database Integration and Deployment on Alibaba Cloud


## Overview
This project focuses on managing an employee database through a user-friendly interface. It includes functionalities to:
* Display a list of employees.
* Add new employees to the database.
* Update existing employee information.
* Delete employees from the database.


The project also incorporates cloud deployment using Alibaba Cloud. Infrastructure is provisioned and managed using Terraform, enabling scalable and efficient deployment of the application.


## Usages
- SpringBoot
- SpringJPA
- Thymeleaf
- MySQL
- Terraform
- Dockerfile
- Docekr Compose

## Architecture of the Project

### 1- deployment folders
- provider.tf
- vpc.tf
- key.tf
- bastion-sg.t
- bastion.tf
- employee-sg.tf
- employee.tf
- employee.tpl
- mysql-sg.tf
- mysql.tf
- mysql.tpl
- load-balancer.tf

### 2- src folders
#### 2.1 main
- Controllers folder
- Entities folder
- DAO folder
- Services folder
#### 2.2 resources
##### 2.2.1 templates
- employee-form.html
- list-employees.html

### 2-Maven pom.xml

```



org.springframework.boot
spring-boot-starter-thymeleaf



org.springframework.boot
spring-boot-starter-web



org.springframework.boot
spring-boot-devtools
runtime
true



mysql
mysql-connector-java
runtime


org.springframework.boot
spring-boot-starter-test
test


org.springframework.boot
spring-boot-starter-data-jpa



org.hibernate
hibernate-core
${hibernate.version}

```

### 3-Application.properties.yml

```
spring.datasource.url=jdbc:mysql://mydb:3306/demo
spring.datasource.username=demouser
spring.datasource.password=demopass

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.ddl-auto=update

```
### 4- Dockerfile
```
FROM openjdk:17
WORKDIR /
ADD target/spring-boot-thymeleaf-crud-db-project-0.0.1-SNAPSHOT.jar /
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/spring-boot-thymeleaf-crud-db-project-0.0.1-SNAPSHOT.jar"]

```
### 5- Docker-compose.yml
```
version: "3"
services:
server:
container_name: app-container
image: app-image
build: .
restart: always
ports:
- 9091:8080
depends_on:
- mydb

mydb:
container_name: mydb
platform: linux/arm64/v8
image: mysql:latest
restart: always
ports:
- 3313:3306
environment:
MYSQL_DATABASE: demo
MYSQL_USER: demouser
MYSQL_PASSWORD: demopass
MYSQL_ROOT_PASSWORD: demopass
```

## Let's Start :mechanical_arm:
### • Display Empoyees Table


display-employee

### • Add new Employee


add-employee
add-employee

### • Update Empoyee:


update-employee
update-employee

### • Delete Employee:


delete-employee
delete-employee

---

### Good Luck