Skip to main content

Experiment No. 10 Title: Create the GitHub Account to demonstrate CI/CD pipeline using Cloud Platform.

 Experiment No. 10

Title: Create the GitHub Account to demonstrate CI/CD pipeline using Cloud Platform.


Objective:

The objective of this experiment is to help you create a GitHub account and set up a basic CI/CD pipeline on GCP. You will learn how to connect your GitHub repository to GCP, configure CI/CD using Cloud Build, and automatically deploy web pages to an Apache web server when code is pushed to your repository.


Introduction:

Continuous Integration and Continuous Deployment (CI/CD) pipelines are essential for automating the deployment of web applications. In this experiment, we will guide you through creating a GitHub account and setting up a basic CI/CD pipeline using Google Cloud Platform (GCP) to copy web pages for an Apache HTTP web application.


Continuous Integration and Continuous Deployment (CI/CD) is a crucial practice in modern software development. It involves automating the processes of code integration, testing, and deployment to ensure that software changes are consistently and reliably delivered to production. GitHub, Google Cloud Platform (GCP), and Amazon Web Services (AWS) are popular tools and platforms that, when combined, enable a powerful CI/CD pipeline.


Key Components:


  • GitHub: GitHub is a web-based platform for version control and collaboration. It allows developers to host and manage their source code repositories, track changes, collaborate with others, and automate workflows.

  • Google Cloud Platform (GCP): GCP is a cloud computing platform that provides a wide range of cloud services, including computing, storage, databases, machine learning, and more. It can be used to host applications and services.

  • Amazon Web Services (AWS): AWS is another cloud computing platform that offers a comprehensive set of cloud services. It is often used for hosting infrastructure, containers, databases, and more.


Basic CI/CD Workflow:


A basic CI/CD workflow using GitHub, GCP, and AWS typically includes the following steps:


  1. Code Development: Developers work on code changes and commit them to a GitHub repository.

  2. Continuous Integration (CI):

    1. GitHub Actions or a CI tool like Jenkins is used to automatically build, test, and package the application whenever code changes are pushed to the repository.

    2. Automated tests are executed to ensure code quality.

  3. Continuous Deployment (CD):

    1. Once code changes pass CI, the application can be automatically deployed to a staging environment.

    2. Integration and acceptance tests are performed in the staging environment.

  4. Deployment to Production:

    1. If all tests in the staging environment pass, the application can be automatically deployed to the production environment in GCP or AWS.

  5. Monitoring and Logging:

    1. Monitoring tools are used to track the application's performance and detect issues.

    2. Logging and analytics tools are used to gain insights into application behavior.

  6. Feedback Loop:

    1. Any issues or failures detected in production are reported back to the development team for further improvements.

    2. The cycle repeats as new code changes are developed and deployed.


Benefits of Basic CI/CD with GitHub, GCP, and AWS:

  1. Automation: CI/CD automates repetitive tasks, reducing the risk of human error and speeding up the delivery process.

  2. Consistency: CI/CD ensures that all code changes go through the same testing and deployment processes, leading to consistent and reliable results.

  3. Faster Time to Market: Automated deployments enable faster delivery of new features and bug fixes to users.

  4. Improved Collaboration: GitHub's collaboration features enable teams to work together seamlessly, and CI/CD pipelines keep everyone on the same page.

  5. Scalability: Cloud platforms like GCP and AWS provide scalable infrastructure to handle varying workloads.

  6. Efficiency: Developers can focus on writing code while CI/CD pipelines take care of building, testing, and deploying applications.


Materials:

  • A computer with internet access

  • A Google Cloud Platform account (https://cloud.google.com/)

  • A GitHub account (https://github.com/)


Experiment Steps:

Step 1: Create a GitHub Account

  • Visit the GitHub website (https://github.com/).

  • Click on the "Sign Up" button and follow the instructions to create your GitHub account.


Step 2: Create a Sample GitHub Repository

  • Log in to your GitHub account.

  • Click the "+" icon in the top-right corner and select "New Repository."

  • Give your repository a name (e.g., "my-web-pages") and provide an optional description.

  • Choose the repository visibility (public or private).

  • Click the "Create repository" button.


Step 3: Set Up a Google Cloud Platform Project

  • Log in to your Google Cloud Platform account.

  • Create a new GCP project by clicking on the project drop-down in the GCP Console (https://console.cloud.google.com/).

  • Click on "New Project" and follow the prompts to create a project.


Step 4: Connect GitHub to Google Cloud Build

  • In your GCP Console, navigate to "Cloud Build" under the "Tools" section.

  • Click on "Triggers" in the left sidebar.

  • Click the "Connect Repository" button.

  • Select "GitHub (Cloud Build GitHub App)" as the source provider.

  • Authorise Google Cloud Build to access your GitHub account.

  • Choose your GitHub repository ("my-web-pages" in this case) and branch.

  • Click "Create."


Step 5: Create a CI/CD Configuration File

  • In your GitHub repository, create a configuration file named cloudbuild.yaml. This file defines the CI/CD pipeline steps.

  • Add a simple example configuration to copy web pages to an Apache web server. Here's an example:

steps:

- name: 'gcr.io/cloud-builders/gsutil'

  args: ['-m', 'rsync', '-r', 'web-pages/', 'gs://your-bucket-name']

  • Replace 'gs://your-bucket-name' with the actual Google Cloud Storage bucket where your Apache web server serves web pages.

  • Commit and push this file to your GitHub repository.


Step 6: Trigger the CI/CD Pipeline

  • Make changes to your web pages or configuration.

  • Push the changes to your GitHub repository.

  • Go to your GCP Console and navigate to "Cloud Build" > "Triggers."

  • You should see an automatic trigger for your repository. Click the trigger to see details.

  • Click "Run Trigger" to manually trigger the CI/CD pipeline.


Step 7: Monitor the CI/CD Pipeline

  • In the GCP Console, navigate to "Cloud Build" to monitor the progress of your build and deployment.

  • Once the pipeline is complete, your web pages will be copied to the specified Google Cloud Storage bucket.


Step 8: Access Your Deployed Web Pages

  • Configure your Apache web server to serve web pages from the Google Cloud Storage bucket.

  • Access your deployed web pages by visiting the appropriate URL.


Conclusion:

In this experiment, you created a GitHub account, set up a basic CI/CD pipeline on Google Cloud Platform, and deployed web pages to an Apache web server. This demonstrates how CI/CD can automate the deployment of web content, making it easier to manage and update web applications efficiently.


Exercise / Questions:


  1. What is the primary purpose of Continuous Integration and Continuous Deployment (CI/CD) in software development, and how does it benefit development teams using GitHub, GCP, and AWS?

  2. Explain the role of GitHub in a CI/CD pipeline. How does GitHub facilitate version control and collaboration in software development?

  3. What are the key services and offerings provided by Google Cloud Platform (GCP) that are commonly used in CI/CD pipelines, and how do they contribute to the automation and deployment of applications?

  4. Similarly, describe the essential services and tools offered by Amazon Web Services (AWS) that are typically integrated into a CI/CD workflow.

  5. Walk through the basic steps of a CI/CD pipeline from code development to production deployment, highlighting the responsibilities of each stage.

  6. How does Continuous Integration (CI) differ from Continuous Deployment (CD)? Explain how GitHub Actions or a similar CI tool can be configured to build and test code automatically.

  7. In the context of CI/CD, what is a staging environment, and why is it important in the deployment process? How does it differ from a production environment?

  8. What are the primary benefits of using automation for deployment in a CI/CD pipeline, and how does this automation contribute to consistency and reliability in software releases?

  9. Discuss the significance of monitoring, logging, and feedback loops in a CI/CD workflow. How do these components help in maintaining and improving application quality and performance?

  10. In terms of scalability and flexibility, explain how cloud platforms like GCP and AWS enhance the CI/CD process, especially when dealing with variable workloads and resource demands.

Comments

Popular posts from this blog

Experiment No. 5 Title: Applying CI/CD Principles to Web Development Using Jenkins, Git, and Local HTTP Server

  Experiment No. 5 Title: Applying CI/CD Principles to Web Development Using Jenkins, Git, and Local HTTP Server  Objective: The objective of this experiment is to set up a CI/CD pipeline for a web development project using Jenkins, Git, and webhooks, without the need for a Jenkinsfile. You will learn how to automatically build and deploy a web application to a local HTTP server whenever changes are pushed to the Git repository, using Jenkins' "Execute Shell" build step. Introduction: Continuous Integration and Continuous Deployment (CI/CD) is a critical practice in modern software development, allowing teams to automate the building, testing, and deployment of applications. This process ensures that software updates are consistently and reliably delivered to end-users, leading to improved development efficiency and product quality. In this context, this introduction sets the stage for an exploration of how to apply CI/CD principles specifically to web development using J

Experiment No. 6 Title: Exploring Containerization and Application Deployment with Docker

  Experiment No. 6 Title: Exploring Containerization and Application Deployment with Docker  Objective: The objective of this experiment is to provide hands-on experience with Docker containerization and application deployment by deploying an Apache web server in a Docker container. By the end of this experiment, you will understand the basics of Docker, how to create Docker containers, and how to deploy a simple web server application. Introduction Containerization is a technology that has revolutionised the way applications are developed, deployed, and managed in the modern IT landscape. It provides a standardised and efficient way to package, distribute, and run software applications and their dependencies in isolated environments called containers. Containerization technology has gained immense popularity, with Docker being one of the most well-known containerization platforms. This introduction explores the fundamental concepts of containerization, its benefits, and how it differs