Skip to content

Commit b914ae4

Browse files
committed
Minor Improvements
1 parent c793f73 commit b914ae4

File tree

7 files changed

+859
-844
lines changed

7 files changed

+859
-844
lines changed

mylogs/app/my-app.log

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88

99
:: Spring Boot :: (v3.4.6)
1010

11-
2025-07-02T17:49:01.816Z INFO 4364 --- [techeazy-devops] [ main] c.t.devops.TecheazyDevopsApplication : Starting TecheazyDevopsApplication v0.0.1-SNAPSHOT using Java 21.0.7 with PID 4364 (/home/ubuntu/app/target/techeazy-devops-0.0.1-SNAPSHOT.jar started by root in /home/ubuntu/app)
12-
2025-07-02T17:49:01.821Z INFO 4364 --- [techeazy-devops] [ main] c.t.devops.TecheazyDevopsApplication : No active profile set, falling back to 1 default profile: "default"
13-
2025-07-02T17:49:04.140Z INFO 4364 --- [techeazy-devops] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 80 (http)
14-
2025-07-02T17:49:04.185Z INFO 4364 --- [techeazy-devops] [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
15-
2025-07-02T17:49:04.186Z INFO 4364 --- [techeazy-devops] [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.41]
16-
2025-07-02T17:49:04.491Z INFO 4364 --- [techeazy-devops] [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
17-
2025-07-02T17:49:04.495Z INFO 4364 --- [techeazy-devops] [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2567 ms
11+
2025-07-08T23:23:28.441Z INFO 4086 --- [techeazy-devops] [ main] c.t.devops.TecheazyDevopsApplication : Starting TecheazyDevopsApplication v0.0.1-SNAPSHOT using Java 21.0.7 with PID 4086 (/home/ubuntu/app/target/techeazy-devops-0.0.1-SNAPSHOT.jar started by root in /home/ubuntu/app)
12+
2025-07-08T23:23:28.445Z INFO 4086 --- [techeazy-devops] [ main] c.t.devops.TecheazyDevopsApplication : No active profile set, falling back to 1 default profile: "default"
13+
2025-07-08T23:23:30.381Z INFO 4086 --- [techeazy-devops] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 80 (http)
14+
2025-07-08T23:23:30.411Z INFO 4086 --- [techeazy-devops] [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
15+
2025-07-08T23:23:30.411Z INFO 4086 --- [techeazy-devops] [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.41]
16+
2025-07-08T23:23:30.612Z INFO 4086 --- [techeazy-devops] [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
17+
2025-07-08T23:23:30.615Z INFO 4086 --- [techeazy-devops] [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2078 ms
18+
2025-07-08T23:23:31.650Z INFO 4086 --- [techeazy-devops] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 80 (http) with context path '/'
19+
2025-07-08T23:23:31.676Z INFO 4086 --- [techeazy-devops] [ main] c.t.devops.TecheazyDevopsApplication : Started TecheazyDevopsApplication in 4.078 seconds (process running for 4.942)

mylogs/system/cloud-init.log

Lines changed: 832 additions & 827 deletions
Large diffs are not rendered by default.

scripts/deploy.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,18 @@ echo "Verified Public IP: $VERIFIER_IP"
5555
# cd .. # to save logs at root level
5656
# PRIVATE_KEY_PATH="/Users/default/CS/DevOps/AWS/ssh-key-ec2.pem" #change this to your ssh private key path, also make sure to use `chmod 400` on your key before using
5757
# echo "trying to scp logs to local"
58-
# scp -r -i "$PRIVATE_KEY_PATH" ubuntu@$VERIFIER_IP:/mylogs/ . #to pull logs from readonly ec2 to your local directory /mylogs/
58+
# scp -r -i "$PRIVATE_KEY_PATH" -o StrictHostKeyChecking=no ubuntu@$VERIFIER_IP:/mylogs/ . #to pull logs from readonly ec2 to your local directory /mylogs/
5959
# cd $TERRAFORM_DIR # to run destroy need to go to terraform directory
6060

61-
echo "Terraform destroy will run after 10minutes..."
61+
echo -e "\n"
62+
echo "[+] Using curl on app at http://$RAW_INSTANCE_IP:80"
63+
echo -e "\n"
64+
curl "http://$RAW_INSTANCE_IP:80"
65+
echo -e "\n"
66+
echo -e "\n"
67+
68+
echo "Terraform destroy will run after 2 minutes..."
6269
echo "You can press ctrl+c and do it earlier as well"
63-
sleep 650
70+
sleep 120
6471

6572
terraform destroy -var-file="$CONFIG_FILE" -auto-approve

scripts/dev_script.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Update system and install dependencies
55
apt-get update -y
6-
apt-get install -y unzip curl git openjdk-21-jdk maven
6+
apt-get install -y unzip git openjdk-21-jdk maven
77

88
# Install AWS CLI v2
99
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
@@ -26,11 +26,13 @@ mvn clean package
2626
# Run the Java app
2727
nohup java -jar target/*.jar --server.port=80 > /var/log/my-app.log 2>&1 &
2828

29+
# Wait for app to run
30+
sleep 5
2931

3032
# Upload Logs to S3
3133
sudo aws s3 cp /var/log/cloud-init.log s3://${s3_bucket_name}/system/
3234
sudo aws s3 cp /var/log/my-app.log s3://${s3_bucket_name}/app/
3335

3436
# Shutdown after timeout
35-
# sudo shutdown -h +${shutdown_minutes}
37+
sudo shutdown -h +${shutdown_minutes}
3638

scripts/prod_script.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/bin/bash
2-
set -e
32

43
# Update system and install dependencies
54
apt-get update -y
6-
apt-get install -y unzip curl git openjdk-21-jdk maven
5+
apt-get install -y unzip git openjdk-21-jdk maven
76

87
# Install AWS CLI v2
98
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
@@ -27,7 +26,7 @@ mvn clean package
2726
nohup java -jar target/*.jar --server.port=80 > /var/log/my-app.log 2>&1 &
2827

2928
# Wait for the app to start
30-
sleep 30
29+
sleep 5
3130

3231
# Upload Logs to S3
3332
aws s3 cp /var/log/cloud-init.log s3://${s3_bucket_name}/system/

scripts/verify_logs_script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ echo "Fetching logs from S3 Bucket: ${s3_bucket_name}"
2121
# sudo aws s3 sync s3://techeazy-logs-dev-unique123ss /mylogs
2222
# sudo aws s3 sync s3://${s3_bucket_name} /mylogs/
2323

24-
echo "Waiting for logs to appear in S3 bucket: techeazy-logs-dev-unique123ss"
24+
echo "Waiting for logs to appear in S3 bucket: ${s3_bucket_name}"
2525
sleep 100
2626
MAX_RETRIES=20
2727
RETRY_DELAY=30 # seconds

terraform/prod_config.tfvars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ instance_type = "t2.micro"
22
key_name = "ssh-key-ec2" #change this to your key-pair name
33
ami_id = "ami-0f918f7e67a3323f0"
44
stage = "prod"
5-
shutdown_minutes = 15
5+
shutdown_minutes = 25
66
s3_bucket_name = "techeazy-logs-dev-unique123ss" # Change this!
77
aws_region = "ap-south-1"
88
repo_url = "https://github.com/techeazy-consulting/techeazy-devops"

0 commit comments

Comments
 (0)