Skip to content

Commit 2f4a4cb

Browse files
Refactor deployment instructions for clarity and completeness, including critical file checks and updated configuration settings
1 parent dc41476 commit 2f4a4cb

File tree

1 file changed

+85
-34
lines changed

1 file changed

+85
-34
lines changed

BUILD_AND_DEPLOY.md

Lines changed: 85 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -45,35 +45,57 @@ mvn clean package -DskipTests
4545

4646
## 📦 **Deployment Package Creation**
4747

48-
### **Step 3: Verify Deploy Folder Structure** ⚠️
49-
50-
**CRITICAL:** Before creating the deployment package, ensure the `deploy/` folder contains ALL required files:
51-
52-
```bash
53-
ls -la deploy/
54-
```
55-
56-
**Required files checklist:**
57-
58-
-`Procfile` - **ESSENTIAL** - Sets production profile and port
59-
-`.ebextensions/` directory with `app-config.config` - **ESSENTIAL** - Environment configuration
60-
- ✅ Previous JAR file (will be replaced in next step)
61-
62-
**If missing, copy from working template:**
63-
64-
```bash
65-
# If Procfile is missing
66-
cp deploy-AUTO-TABLE-CREATION/Procfile deploy/
67-
68-
# If .ebextensions is missing
69-
cp -r deploy-AUTO-TABLE-CREATION/.ebextensions deploy/
70-
```
71-
72-
### **Step 4: Copy Updated JAR to Deploy Folder**
48+
### **Step 3: Create Deploy Folder and Configuration Files**
49+
50+
**Create the deployment folder structure and required configuration files:**
51+
52+
````bash
53+
# Create deploy directory
54+
mkdir -p deploy
55+
56+
# Create Procfile
57+
echo "web: java -Dspring.profiles.active=production -Dserver.port=\$PORT -jar relational-data-access-complete-0.0.1-SNAPSHOT.jar" > deploy/Procfile
58+
59+
# Create .ebextensions directory and configuration
60+
mkdir -p deploy/.ebextensions
61+
cat > deploy/.ebextensions/app-config.config << 'EOF'
62+
option_settings:
63+
aws:elasticbeanstalk:application:environment:
64+
# Spring Boot Configuration
65+
SPRING_PROFILES_ACTIVE: production
66+
67+
# Port Configuration for Elastic Beanstalk
68+
PORT: 5000
69+
70+
# AWS RDS Database configuration (set these in EB Console)
71+
# RDS_HOSTNAME: your-rds-endpoint.amazonaws.com
72+
# RDS_PORT: 5432
73+
# RDS_DB_NAME: customerdb
74+
# RDS_USERNAME: your-username
75+
# RDS_PASSWORD: your-password
76+
77+
# Application Configuration
78+
JPA_DDL_AUTO: validate
79+
JPA_SHOW_SQL: false
80+
LOG_LEVEL: INFO
81+
SPRING_LOG_LEVEL: INFO
82+
83+
# CORS Configuration - AWS Amplify URL
84+
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:${FRONTEND_URL:*}}
85+
86+
aws:elasticbeanstalk:environment:process:default:
87+
Port: '5000'
88+
Protocol: HTTP
89+
HealthCheckPath: /api/health
90+
HealthCheckTimeout: 15
91+
HealthyThresholdCount: 3
92+
UnhealthyThresholdCount: 5
93+
EOF
94+
```### **Step 4: Copy Updated JAR to Deploy Folder**
7395
7496
```bash
7597
cp target/relational-data-access-complete-0.0.1-SNAPSHOT.jar deploy/
76-
```
98+
````
7799

78100
### **Step 5: Verify Complete Package**
79101

@@ -279,21 +301,50 @@ deploy/
279301
unzip -l deploy.zip
280302
```
281303

282-
2. If missing files, recreate deploy folder from template:
304+
2. If missing files, recreate deploy folder with required files:
283305

284306
```bash
307+
# Remove corrupted deploy folder
285308
rm -rf deploy/*
286-
cp -r deploy-AUTO-TABLE-CREATION/* deploy/
287-
cp target/relational-data-access-complete-0.0.1-SNAPSHOT.jar deploy/
288-
cd deploy && zip -r ../deploy.zip .
309+
310+
# Recreate Procfile
311+
echo "web: java -Dspring.profiles.active=production -Dserver.port=\$PORT -jar relational-data-access-complete-0.0.1-SNAPSHOT.jar" > deploy/Procfile
312+
313+
# Recreate .ebextensions configuration
314+
mkdir -p deploy/.ebextensions
315+
cat > deploy/.ebextensions/app-config.config << 'EOF'
316+
option_settings:
317+
aws:elasticbeanstalk:application:environment:
318+
SPRING_PROFILES_ACTIVE: production
319+
PORT: 5000
320+
289321
```
290322
323+
aws:elasticbeanstalk:environment:process:default:
324+
Port: '5000'
325+
Protocol: HTTP
326+
HealthCheckPath: /api/health
327+
HealthCheckTimeout: 15
328+
HealthyThresholdCount: 3
329+
UnhealthyThresholdCount: 5
330+
EOF
331+
332+
# Copy the JAR file
333+
334+
cp target/relational-data-access-complete-0.0.1-SNAPSHOT.jar deploy/
335+
336+
# Create deployment package
337+
338+
cd deploy && zip -r ../deploy.zip .
339+
340+
````
341+
291342
3. Verify fixed package:
292343

293-
```bash
294-
unzip -l deploy.zip
295-
# Must show: Procfile, .ebextensions/, and .jar file
296-
```
344+
```bash
345+
unzip -l deploy.zip
346+
# Must show: Procfile, .ebextensions/, and .jar file
347+
````
297348
298349
4. **Re-deploy immediately** - Upload the fixed deploy.zip to Elastic Beanstalk
299350

0 commit comments

Comments
 (0)