simplilearn-projects Assessment
-
Step 1: Chk Terraform
-
Step 2: Go to AWS cloud and Create Access key and ID
-
Step 3: Setup AWS profile
aws s3 ls ````
-
Step 4: Write the TF Script.
-
Step 5: Chk on AWS console. VM is provisioned or not?
-
Security group
-
INBOUND RULES
-
OUTBOUND RULES
-
Key pair
-
VM AWS AMI ami-0cff7528ff583bf9a
# Type of connection to be established
connection {
type = "ssh"
user = "ubuntu"
private_key = file("./deployer")
host = self.public_ip
}
# Remotely execute commands to install Java, Python, Jenkins
provisioner "remote-exec" {
inline = [
"sudo apt update && upgrade",
"sudo apt install -y python3.8",
"wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -",
"sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'",
"sudo apt-get update",
"sudo apt-get install -y openjdk-8-jre",
"sudo apt-get install -y jenkins",
"sudo apt-get install -y docker docker.io",
"sudo chmod 777 /var/run/docker.sock",
"sudo cat /var/lib/jenkins/secrets/initialAdminPassword",
]
}
ssh -i deployer [email protected]
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
apt install docker
apt install docker.io
docker run hello-world
- Goto repo setting
- click on Webhook
- add your payload URL
http://3.89.81.9:8080/github-webhook/
- Update the webhook.
- Source Code Management
https://github.com/manikcloud/simplilearn-projects.git
*/main
* * * * *
docker run hello-world
docker rm `docker ps -aq` -f
docker build -t demo .
docker tag demo varunmanik/httpd:cicd
docker run -d -p 80:80 varunmanik/httpd:cicd
docker ps
- Hit the URL on port 80 you will see the website
http://35.172.250.157/
/var/run/docker.sock: connect: permission denied
sudo chmod 777 /var/run/docker.sock
docker build -t demo .
vim index.html
docker build -t demo .
chmod 777 /var/run/docker.sock
docker tag demo varunmanik/httpd:cicd
docker build -t demo .
docker tag demo varunmanik/httpd:cicd
docker run -d -p 80:80 varunmanik/httpd:cicd