nn-Gitlab-Projects

·

2 min read

Note:

1. Gitlab CI-CD for Terraform [ to create EC2 with Ansible-Jenkins ]
    Create IAM User (Admin Access) with secret access keys
    Create Gitlab A/c and clone to Laptop to push Terraform files (main.tf, provider.tf, install_jenkins.sh, backend.tf)
    Adding all secrets (AWS access & secret access keys) in Gitlab CI-CD Variable (secrets) section
    prepare .gitlab-ci.yml file and write all relevant pipeline script to run Jobs (Terraform init, validate, plan, apply, destroy)
    After Terraform apply, check foe EC2 and Ansible Playbook and Jenkins accessing
    Next destroy with manual approval
2. Gitlab (Maven-Sonar) CI-CD project
    Import the Github Repo into Gitlab A/c
    Create EC2(ubuntu 20.04, t2.medium) and install docker, sonar container and access sonar in browser 9000 port
    Create New project manually in sonar dashboard and choose Maven add the shown code into repo's pom.xml file (under properties)
    Next add Sonar Token, sonar server url into Gitlab CICD variable secrets.
    Next copy shown code from sonar dashboard and copied into .gitlab-ci.yml config file
    Next create specific(self-host) Runner in Gitlab and setup on above EC2 with all commands provided at Gitlab Runner place
    For Sonar stage used Gitlab Managed Runner, but adding two more stages with mkdir, pwd, echo commands with self-host runner
    we can add docker container(2048 game image) run command also into above self-host stage
3. Gitlab (Youtube Clone) CI-CD Project
    Import the Github Repo into Gitlab A/c and Create RAPID API key
    Create EC2(ubuntu 20.04, t2.medium) and install docker, sonar container and access sonar in browser 9000 port
    Create New project manually in sonar dashboard and choose other add the shown code into repo's pom.xml file (under properties)
    Next add Sonar Token, sonar server url into Gitlab CICD variable secrets.
    Next copy shown code from sonar dashboard and copied into .gitlab-ci.yml config file
    Next add npm code also into .gitlab-ci.yml file before sonar Job script, next add Trivy file scan code after sonar script in .gitlab-ci.yml file
    Next add docker creds into Gitlab CICD variable secrets and next add docker build & push, trivy image scan script after trivy file scan Job in .gitlab-ci.yml file
    Next Install Gitlab self-host runner(on EC2 with commands shown in Gitlab Runner place) for deploy purpose & Enable this runner in Gitlab to make it Green colour
    Next add the deploy stage to .gitlab-ci.yml file and access the desired Youtube App in browser with public IP of EC2 with specified port of docker container

Note: