Initialize Spring Boot application with HTTPS support and add Docker configuration

This commit is contained in:
liosha84
2025-07-28 13:48:47 +03:00
parent c58dd4ac5c
commit 90b2eaa036
15 changed files with 520 additions and 0 deletions
+36
View File
@@ -108,6 +108,42 @@ docker-compose -f src/Docker/docker-compose.yml up -d
```
- For connection from pgadmin use
hostename: **host.docker.internal**
# How to run the application in Docker with HTTPS support
To run the application in Docker with HTTPS support, follow these steps:
1. **Cerbot**
- Run this command below to get certificate and store it to volume certs.
- Expanded(readable) command example:
docker run -d \
--name certbot \
-v certs:/etc/letsencrypt \
-v certs-data:/var/lib/letsencrypt \
-p 80:80 \
-p 443:443 \
certbot/certbot \
certonly --standalone --preferred-challenges http --email youremail@gmail.com -d yourdomain.com --agree-tos
- Command to run certbot with specific domain and email:
```bash
docker run -d --name certbot -v certs:/etc/letsencrypt -v certs-data:/var/lib/letsencrypt -p 8081:80 -p 8443:443 certbot/certbot certonly --standalone --preferred-challenges http --email liosha84@gmail.com -d jambotron.run.place --agree-tos
```
- Tip: You can generate certificate to local machine used next command:
```bash
docker run -it --rm -p 8081:80 --name certbot -v "C:\certbot\etc\letsencrypt:/etc/letsencrypt" -v "C:\certbot\var\lib\letsencrypt:/var/lib/letsencrypt" certbot/certbot certonly --standalone -d jambotron.run.place
```
certificate files will be stored in `C:\certbot\etc\letsencrypt` and `C:\certbot\var\lib\letsencrypt` directories.
- If you have same trouble before running certbot, run this project
`Helper_projects/spring-boot-https-main` insted of jambotron project.
- TODO: Add cron job to renew certificate automatically.
### Reference Documentation
For further reference, please consider the following sections: