Spaces:
Running
Running
Soumik Bose commited on
Commit ·
b2770a5
1
Parent(s): b833ad1
pl
Browse files- .env.example +1 -1
- README-Docker.md +0 -183
- src/main/resources/application.yml +1 -1
- target/classes/application.yml +1 -1
.env.example
CHANGED
|
@@ -26,7 +26,7 @@ REDIS_PASSWORD=redispass
|
|
| 26 |
|
| 27 |
# Application Configuration
|
| 28 |
SPRING_PROFILES_ACTIVE=docker
|
| 29 |
-
SERVER_PORT=
|
| 30 |
|
| 31 |
# External Database Configuration (for production)
|
| 32 |
# MONGODB_URI=mongodb+srv://erp-user:password@cluster.mongodb.net/erp_datasource
|
|
|
|
| 26 |
|
| 27 |
# Application Configuration
|
| 28 |
SPRING_PROFILES_ACTIVE=docker
|
| 29 |
+
SERVER_PORT=7860
|
| 30 |
|
| 31 |
# External Database Configuration (for production)
|
| 32 |
# MONGODB_URI=mongodb+srv://erp-user:password@cluster.mongodb.net/erp_datasource
|
README-Docker.md
DELETED
|
@@ -1,183 +0,0 @@
|
|
| 1 |
-
# ERP System Docker Setup
|
| 2 |
-
|
| 3 |
-
This guide provides comprehensive Docker setup for the ERP System with MongoDB, MySQL, PostgreSQL, and Redis.
|
| 4 |
-
|
| 5 |
-
## Quick Start
|
| 6 |
-
|
| 7 |
-
### Production Environment
|
| 8 |
-
```bash
|
| 9 |
-
# Build and start all services
|
| 10 |
-
docker-compose up -d
|
| 11 |
-
|
| 12 |
-
# View logs
|
| 13 |
-
docker-compose logs -f erp-app
|
| 14 |
-
|
| 15 |
-
# Stop services
|
| 16 |
-
docker-compose down
|
| 17 |
-
```
|
| 18 |
-
|
| 19 |
-
### Development Environment
|
| 20 |
-
```bash
|
| 21 |
-
# Build and start development services
|
| 22 |
-
docker-compose -f docker-compose.dev.yml up -d
|
| 23 |
-
|
| 24 |
-
# View logs
|
| 25 |
-
docker-compose -f docker-compose.dev.yml logs -f erp-app
|
| 26 |
-
|
| 27 |
-
# Stop services
|
| 28 |
-
docker-compose -f docker-compose.dev.yml down
|
| 29 |
-
```
|
| 30 |
-
|
| 31 |
-
## Services
|
| 32 |
-
|
| 33 |
-
### ERP Application
|
| 34 |
-
- **Port**: 8080
|
| 35 |
-
- **Health Check**: http://localhost:8080/actuator/health
|
| 36 |
-
- **Profile**: docker (production) or docker,dev (development)
|
| 37 |
-
|
| 38 |
-
### MongoDB
|
| 39 |
-
- **Port**: 27017
|
| 40 |
-
- **Database**: erp_datasource
|
| 41 |
-
- **Username**: erpuser
|
| 42 |
-
- **Password**: erppass
|
| 43 |
-
|
| 44 |
-
### MySQL
|
| 45 |
-
- **Port**: 3306
|
| 46 |
-
- **Database**: erp_db
|
| 47 |
-
- **Username**: erpuser
|
| 48 |
-
- **Password**: erppass
|
| 49 |
-
|
| 50 |
-
### PostgreSQL
|
| 51 |
-
- **Port**: 5432
|
| 52 |
-
- **Database**: erp_db
|
| 53 |
-
- **Username**: erpuser
|
| 54 |
-
- **Password**: erppass
|
| 55 |
-
|
| 56 |
-
### Redis
|
| 57 |
-
- **Port**: 6379
|
| 58 |
-
- **Password**: redispass
|
| 59 |
-
|
| 60 |
-
## Environment Variables
|
| 61 |
-
|
| 62 |
-
Copy `.env.example` to `.env` and customize as needed:
|
| 63 |
-
|
| 64 |
-
```bash
|
| 65 |
-
cp .env.example .env
|
| 66 |
-
```
|
| 67 |
-
|
| 68 |
-
Key environment variables:
|
| 69 |
-
- `SPRING_PROFILES_ACTIVE`: Set to `docker` for production
|
| 70 |
-
- Database connection parameters for each service
|
| 71 |
-
- Redis configuration
|
| 72 |
-
|
| 73 |
-
## Database Initialization
|
| 74 |
-
|
| 75 |
-
Each database service includes initialization scripts:
|
| 76 |
-
|
| 77 |
-
### MongoDB
|
| 78 |
-
- Location: `docker/mongodb/init/init.js`
|
| 79 |
-
- Creates: User, collections for products, orders, customers
|
| 80 |
-
|
| 81 |
-
### MySQL
|
| 82 |
-
- Location: `docker/mysql/init/01-init.sql`
|
| 83 |
-
- Creates: Tables for products, categories, suppliers with sample data
|
| 84 |
-
|
| 85 |
-
### PostgreSQL
|
| 86 |
-
- Location: `docker/postgres/init/01-init.sql`
|
| 87 |
-
- Creates: Tables for employees, departments, projects with sample data
|
| 88 |
-
|
| 89 |
-
## Health Checks
|
| 90 |
-
|
| 91 |
-
All services include health checks:
|
| 92 |
-
- Application: `/actuator/health` endpoint
|
| 93 |
-
- MongoDB: `mongosh --eval "db.adminCommand('ping')"`
|
| 94 |
-
- MySQL: `mysqladmin ping`
|
| 95 |
-
- PostgreSQL: `pg_isready`
|
| 96 |
-
- Redis: `redis-cli ping`
|
| 97 |
-
|
| 98 |
-
## Development Features
|
| 99 |
-
|
| 100 |
-
Development compose file includes:
|
| 101 |
-
- Volume mounts for live code changes
|
| 102 |
-
- Separate database instances with `_dev` suffix
|
| 103 |
-
- Extended logging and debugging
|
| 104 |
-
|
| 105 |
-
## Common Commands
|
| 106 |
-
|
| 107 |
-
### Build Application Only
|
| 108 |
-
```bash
|
| 109 |
-
docker build -t erp-system .
|
| 110 |
-
```
|
| 111 |
-
|
| 112 |
-
### Run Application with External Services
|
| 113 |
-
```bash
|
| 114 |
-
docker run -p 8080:8080 \
|
| 115 |
-
-e SPRING_PROFILES_ACTIVE=docker \
|
| 116 |
-
-e MONGODB_HOST=your-mongodb-host \
|
| 117 |
-
-e MYSQL_HOST=your-mysql-host \
|
| 118 |
-
-e POSTGRES_HOST=your-postgres-host \
|
| 119 |
-
erp-system
|
| 120 |
-
```
|
| 121 |
-
|
| 122 |
-
### Clean Up
|
| 123 |
-
```bash
|
| 124 |
-
# Remove containers and networks
|
| 125 |
-
docker-compose down
|
| 126 |
-
|
| 127 |
-
# Remove volumes (data will be lost!)
|
| 128 |
-
docker-compose down -v
|
| 129 |
-
|
| 130 |
-
# Remove images
|
| 131 |
-
docker-compose down --rmi all
|
| 132 |
-
```
|
| 133 |
-
|
| 134 |
-
## Monitoring
|
| 135 |
-
|
| 136 |
-
### Application Logs
|
| 137 |
-
```bash
|
| 138 |
-
docker-compose logs -f erp-app
|
| 139 |
-
```
|
| 140 |
-
|
| 141 |
-
### Database Logs
|
| 142 |
-
```bash
|
| 143 |
-
# MongoDB
|
| 144 |
-
docker-compose logs -f mongodb
|
| 145 |
-
|
| 146 |
-
# MySQL
|
| 147 |
-
docker-compose logs -f mysql
|
| 148 |
-
|
| 149 |
-
# PostgreSQL
|
| 150 |
-
docker-compose logs -f postgres
|
| 151 |
-
|
| 152 |
-
# Redis
|
| 153 |
-
docker-compose logs -f redis
|
| 154 |
-
```
|
| 155 |
-
|
| 156 |
-
### Resource Usage
|
| 157 |
-
```bash
|
| 158 |
-
docker stats
|
| 159 |
-
```
|
| 160 |
-
|
| 161 |
-
## Troubleshooting
|
| 162 |
-
|
| 163 |
-
### Application Won't Start
|
| 164 |
-
1. Check database connectivity: `docker-compose logs`
|
| 165 |
-
2. Verify environment variables
|
| 166 |
-
3. Ensure all databases are healthy: `docker-compose ps`
|
| 167 |
-
|
| 168 |
-
### Database Connection Issues
|
| 169 |
-
1. Restart databases: `docker-compose restart mongodb mysql postgres`
|
| 170 |
-
2. Check credentials in `.env`
|
| 171 |
-
3. Verify network connectivity
|
| 172 |
-
|
| 173 |
-
### Port Conflicts
|
| 174 |
-
1. Change ports in `docker-compose.yml`
|
| 175 |
-
2. Stop conflicting services on host
|
| 176 |
-
|
| 177 |
-
## Production Considerations
|
| 178 |
-
|
| 179 |
-
- Use environment-specific secrets (don't commit passwords)
|
| 180 |
-
- Configure proper backup strategies for databases
|
| 181 |
-
- Set up monitoring and alerting
|
| 182 |
-
- Use proper resource limits and constraints
|
| 183 |
-
- Enable SSL/TLS for external connections
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
| 37 |
max-lifetime: 600000
|
| 38 |
|
| 39 |
server:
|
| 40 |
+
port: 7860
|
| 41 |
|
| 42 |
logging:
|
| 43 |
level:
|
target/classes/application.yml
CHANGED
|
@@ -37,7 +37,7 @@ spring:
|
|
| 37 |
max-lifetime: 600000
|
| 38 |
|
| 39 |
server:
|
| 40 |
-
port:
|
| 41 |
|
| 42 |
logging:
|
| 43 |
level:
|
|
|
|
| 37 |
max-lifetime: 600000
|
| 38 |
|
| 39 |
server:
|
| 40 |
+
port: 7860
|
| 41 |
|
| 42 |
logging:
|
| 43 |
level:
|