Repository navigation
Expand file tree
/
Copy pathssh_steps.py
More file actions
118 lines (98 loc) · 3.08 KB
/
Copy pathssh_steps.py
File metadata and controls
118 lines (98 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# AUTOMATED SONARQUBE SETUP
# These steps are now automated via user_data script in Terraform
# The EC2 instance will automatically run sonarqube_setup.sh on boot
# Manual steps are no longer needed - they are handled automatically:
# ✅ System updates
# ✅ Docker installation and configuration
# ✅ Docker Compose installation
# ✅ SonarQube + PostgreSQL setup with docker-compose
# ✅ Service startup
# ORIGINAL MANUAL STEPS (for reference):
# Note: ECR steps (#14-19) have been removed - using public Docker images instead
#1
"sudo apt update"
#2
"sudo apt update -y"
#3 install docker
"sudo apt install docker.io -y"
#4 start docker
"sudo systemctl start docker"
#5 enable docker
"sudo systemctl enable docker"
#6 add user to docker group
"sudo usermod -aG docker $USER"
#7 refresh group membership
"newgrp docker"
#8 check docker acess
"docker ps"
#9 install cli - REMOVED (not needed for local setup)
# "sudo apt install unzip -y"
# "curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip""
# "unzip awscliv2.zip"
# "sudo ./aws/install"
#10 download command
# "sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose"
#11 make executable
# "sudo chmod +x /usr/local/bin/docker-compose"
#12 make docker file
# "sudo nano docker-compose.yaml"
#13 add content to docker file - NOW AUTOMATED
# Docker compose file is automatically created with this content:
# version: "3"
# services:
# sonarqube:
# image: sonarqube:latest
# container_name: sonarqube
# ports:
# - "9000:9000"
# networks:
# - sonarnet
# environment:
# - SONARQUBE_JDBC_URL=jdbc:postgresql://postgres:5432/sonar
# - SONARQUBE_JDBC_USERNAME=sonar
# - SONARQUBE_JDBC_PASSWORD=sonar
# depends_on:
# - postgres
# volumes:
# - sonarqube_data:/opt/sonarqube/data
# - sonarqube_logs:/opt/sonarqube/logs
# - sonarqube_extensions:/opt/sonarqube/extensions
#
# postgres:
# image: postgres:latest
# container_name: postgres
# environment:
# - POSTGRES_USER=sonar
# - POSTGRES_PASSWORD=sonar
# - POSTGRES_DB=sonar
# networks:
# - sonarnet
# volumes:
# - postgres_data:/var/lib/postgresql/data
#
# networks:
# sonarnet:
# driver: bridge
#
# volumes:
# postgres_data:
# sonarqube_data:
# sonarqube_logs:
# sonarqube_extensions:
# ECR STEPS REMOVED - Using public Docker images instead:
# #14 login in to ecr - REMOVED
# #15 tag sonerqube image - REMOVED
# #16 tag postgres image - REMOVED
# #18 push sonerqube image - REMOVED
# #19 push postgres image - REMOVED
# AUTOMATED STEPS:
# #20 run docker compose - AUTOMATED
# "docker-compose up -d"
# #21 to monitor logs - AUTOMATED (helper script created)
# "docker-compose logs -f sonarqube"
# AFTER DEPLOYMENT:
# ✅ SonarQube will be available at: http://YOUR_EC2_PUBLIC_IP:9000
# ✅ Default credentials: admin/admin
# ✅ Use helper scripts on EC2:
# - /home/ubuntu/sonarqube-status.sh (check status)
# - /home/ubuntu/sonarqube-logs.sh (view logs)