├── .github └── workflows │ └── jekyll-gh-pages.yml ├── .gitignore ├── 00_DevOps Bootcamp Outline.md ├── How to submit solution.md ├── Module 01 - Introduction to DevOps └── 01_Module 1 - Introduction to DevOps.md ├── Module 02 - Linux Fundamentals ├── Module 02 - Linux Fundamentals.md ├── Solution │ ├── Ezaz_Task1.md │ ├── HarunOrRashid_Task1.md │ ├── Rahat │ │ ├── Rahat_Task.md │ │ └── SS │ │ │ ├── folders.png │ │ │ └── ifconfig.png │ ├── Sabit_Task1.md │ ├── Sajid_Task1.md │ ├── Tanvir_Task1.md │ ├── Tawfiq │ │ ├── TawfiqueHossain_Task1.md │ │ └── screenshot │ │ │ ├── 1.filesystem.png │ │ │ ├── 2.process.png │ │ │ ├── 3.network.png │ │ │ └── 4.package.png │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ └── image.png └── Task1.md ├── Module 03 - Virtual Machines └── Virtual Machines.md ├── Module 04 - A Practical Guide to Containers with Docker ├── A Practical Guide to Containers with Docker.md ├── Docker_Task_1.md ├── Solution_Docker ├── docker_solution.md └── task1_guide.md ├── Module 05 - Continuous integration (CI) and continuous delivery (CD) ├── 01 Automating Docker Image Build and Push to Docker Hub.md └── How to set up CI │ └── CD for deploying a static project to AWS S3 and CloudFront using GitHub Actions.md └── README.md /.github/workflows/jekyll-gh-pages.yml: -------------------------------------------------------------------------------- 1 | # Sample workflow for building and deploying a Jekyll site to GitHub Pages 2 | name: Deploy Jekyll with GitHub Pages dependencies preinstalled 3 | 4 | on: 5 | # Runs on pushes targeting the default branch 6 | push: 7 | branches: ["master"] 8 | 9 | # Allows you to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 13 | permissions: 14 | contents: read 15 | pages: write 16 | id-token: write 17 | 18 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. 19 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. 20 | concurrency: 21 | group: "pages" 22 | cancel-in-progress: false 23 | 24 | jobs: 25 | # Build job 26 | build: 27 | runs-on: ubuntu-latest 28 | steps: 29 | - name: Checkout 30 | uses: actions/checkout@v4 31 | - name: Setup Pages 32 | uses: actions/configure-pages@v5 33 | - name: Build with Jekyll 34 | uses: actions/jekyll-build-pages@v1 35 | with: 36 | source: ./ 37 | destination: ./_site 38 | - name: Upload artifact 39 | uses: actions/upload-pages-artifact@v3 40 | 41 | # Deployment job 42 | deploy: 43 | environment: 44 | name: github-pages 45 | url: ${{ steps.deployment.outputs.page_url }} 46 | runs-on: ubuntu-latest 47 | needs: build 48 | steps: 49 | - name: Deploy to GitHub Pages 50 | id: deployment 51 | uses: actions/deploy-pages@v4 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm.fming.dev/#use-with-ide 110 | .pdm.toml 111 | 112 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 113 | __pypackages__/ 114 | 115 | # Celery stuff 116 | celerybeat-schedule 117 | celerybeat.pid 118 | 119 | # SageMath parsed files 120 | *.sage.py 121 | 122 | # Environments 123 | .env 124 | .venv 125 | env/ 126 | venv/ 127 | ENV/ 128 | env.bak/ 129 | venv.bak/ 130 | 131 | # Spyder project settings 132 | .spyderproject 133 | .spyproject 134 | 135 | # Rope project settings 136 | .ropeproject 137 | 138 | # mkdocs documentation 139 | /site 140 | 141 | # mypy 142 | .mypy_cache/ 143 | .dmypy.json 144 | dmypy.json 145 | 146 | # Pyre type checker 147 | .pyre/ 148 | 149 | # pytype static type analyzer 150 | .pytype/ 151 | 152 | # Cython debug symbols 153 | cython_debug/ 154 | 155 | # PyCharm 156 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 157 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 158 | # and can be added to the global gitignore or merged into this file. For a more nuclear 159 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 160 | #.idea/ 161 | -------------------------------------------------------------------------------- /00_DevOps Bootcamp Outline.md: -------------------------------------------------------------------------------- 1 | # DevOps Bootcamp - Outline 2 | 3 | **Module 1: Introduction to DevOps** 4 | 5 | *Module Overview:* This module serves as an introduction to DevOps, exploring its definition, historical evolution, core principles, and the importance of fostering a DevOps culture. 6 | 7 | *Module Content:* 8 | 9 | 1. **What is DevOps?** 10 | - Definition and scope 11 | - Objectives and benefits 12 | - Need for DevOps in modern software development 13 | 2. **History and Evolution of DevOps** 14 | - Origins and challenges addressed 15 | - Evolution of DevOps practices 16 | - Case studies and success stories 17 | 3. **Core Principles of DevOps** 18 | - Continuous Integration (CI), Continuous Deployment (CD), and Continuous Delivery (CD) 19 | - Infrastructure as Code (IaC) and Automation 20 | 4. **DevOps Culture** 21 | - Importance of culture in DevOps success 22 | - Building a collaborative environment 23 | - Implementing DevOps principles in teams and organizations 24 | 5. **Hands-On Workshop** 25 | - Setting up a simple CI/CD pipeline 26 | - Group discussions on real-world DevOps culture implementation 27 | 28 | **Module 2: Linux Fundamentals** 29 | 30 | *Module Overview:* This module covers essential Linux skills for DevOps beginners, including basic commands, file system navigation, text editing, process management, networking, and package management. 31 | 32 | *Module Content:* 33 | 34 | 1. **Basic Commands** 35 | - Introduction to commonly used commands 36 | 2. **File System** 37 | - Understanding Linux file system hierarchy 38 | - Permissions management 39 | - Special files (/dev, /proc, /sys) 40 | 3. **Text Editors** 41 | - Proficiency with command-line text editors 42 | 4. **Processes** 43 | - Managing processes and system resources 44 | 5. **Networking** 45 | - Basic networking commands and configuration 46 | 6. **Package Management** 47 | - Introduction to package managers 48 | 49 | **Module 3: Building and Deploying Applications** 50 | 51 | *Module Overview:* This module focuses on building and deploying applications, covering software development basics, version control with Git, containerization with Docker, and application architectures. 52 | 53 | *Module Content:* 54 | 55 | 1. **Software Development and Version Control** 56 | - Basics of software development and Git 57 | 2. **Introduction to Docker and Containerization** 58 | - Understanding containers and Docker basics 59 | 3. **Understanding Application Architectures** 60 | - Introduction to 2-Tier and 3-Tier applications 61 | - Hands-On Workshop: Deploying applications 62 | 63 | **Module 4: Introduction to Virtualization and Containerization** 64 | 65 | *Module Overview:* This module introduces virtualization and containerization concepts, including Docker fundamentals and an overview of Kubernetes. 66 | 67 | *Module Content:* 68 | 69 | 1. **Virtualization Concepts** 70 | - Understanding virtualization and hypervisors 71 | 2. **Containerization Basics** 72 | - Introduction to Docker and container concepts 73 | 3. **Docker Fundamentals** 74 | - Core Docker tools and container management 75 | 4. **Kubernetes Overview** 76 | - Introduction to Kubernetes and container orchestration 77 | 78 | **Module 5: CI/CD and Infrastructure as Code** 79 | 80 | *Module Overview:* This module covers CI/CD, cloud computing fundamentals, and infrastructure as code. 81 | 82 | *Module Content:* 83 | 84 | 1. **Continuous Integration and Continuous Deployment (CI/CD)** 85 | - Setting up CI/CD pipelines 86 | - Introduction to cloud computing 87 | 2. **Infrastructure as Code (IaC)** 88 | - Introduction to IaC tools like Terraform and Ansible 89 | 90 | **Module 6: Introduction to Cloud Computing with AWS** 91 | 92 | *Module Overview:* This module introduces cloud computing fundamentals with a focus on AWS. 93 | 94 | *Module Content:* 95 | 96 | 1. **Basics of Cloud Computing** 97 | - Overview of cloud computing concepts 98 | - Advantages over on-premises infrastructure 99 | - Cloud service models: IaaS, PaaS, SaaS 100 | 2. **Compute, Networking, Storage, Databases** 101 | - Hands-on demonstrations with AWS EC2, VPC, S3, RDS 102 | 3. **Hands-On Demo Session** 103 | 104 | **Module 7: Scripting and Automation with Python** 105 | 106 | *Module Overview:* This module introduces Python scripting for automation. 107 | 108 | *Module Content:* 109 | 110 | 1. **Introduction to Python** 111 | - Basic syntax and concepts 112 | 2. **Scripting and Automation** 113 | - Writing scripts to automate tasks 114 | 3. **Group Project: Building a Scripting Toolbox** 115 | - Collaborative script development 116 | 117 | **Module 8: Advanced Linux** 118 | 119 | *Module Overview:* This module covers advanced Linux administration and management topics. 120 | 121 | *Module Content:* 122 | 123 | 1. **System Monitoring and Management** 124 | - Utilizing system monitoring tools 125 | 2. **Disk Management** 126 | - Managing disk partitions and storage 127 | 3. **System Security** 128 | - Implementing basic security practices 129 | 130 | **Module 9: Shell Scripting** 131 | 132 | *Module Overview:* This module focuses on shell scripting fundamentals. 133 | 134 | *Module Content:* 135 | 136 | 1. **Basic Scripting** 137 | - Writing and executing basic shell scripts 138 | 2. **Variables, Control Structures** 139 | - Working with variables and control structures 140 | 3. **Automation** 141 | - Automating repetitive tasks with scripts 142 | 143 | **Module 10: Advanced Containerization and Orchestration** 144 | 145 | *Module Overview:* This module covers advanced topics in containerization and orchestration. 146 | 147 | *Module Content:* 148 | 149 | 1. **Advanced Docker Concepts** 150 | - Container runtimes and custom images 151 | - Docker registry management 152 | 2. **Kubernetes Deployment and Management** 153 | - Kubernetes architecture and deployment strategies 154 | 3. **Container Security and Monitoring** 155 | - Implementing security best practices 156 | - Monitoring containerized environments 157 | 158 | **Module 11: Monitoring and Observability** 159 | 160 | *Module Overview:* This module focuses on monitoring and observability practices essential for DevOps, covering the principles, tools, and techniques for effectively monitoring systems and applications. 161 | 162 | *Module Content:* 163 | 164 | 1. **Introduction to Monitoring and Observability** 165 | - Understanding monitoring vs. observability 166 | - Importance in DevOps practices 167 | 2. **Monitoring Tools and Metrics** 168 | - Overview of tools like Prometheus, Grafana 169 | - Configuring monitoring agents 170 | 3. **Logging and Log Management** 171 | - Importance of logs 172 | - Introduction to log management tools 173 | 4. **Alerting and Notification Systems** 174 | - Setting up alerts 175 | - Integrating with monitoring tools 176 | 5. **Tracing and Distributed Systems Observability** 177 | - Understanding distributed tracing 178 | - Tools like Jaeger and Zipkin 179 | 6. **Infrastructure Monitoring** 180 | - Monitoring server health and performance 181 | - Tools like Zabbix, Nagios 182 | 7. **Application Performance Monitoring (APM)** 183 | - APM tools like New Relic, AppDynamics 184 | 8. **Hands-On Workshop: Setting Up Monitoring and Observability** 185 | - Guided setup of monitoring tools 186 | - Practice monitoring real-world applications 187 | 188 | This module provides participants with practical skills to implement effective monitoring and observability practices in DevOps environments, ensuring proactive system management and rapid issue resolution. 189 | -------------------------------------------------------------------------------- /How to submit solution.md: -------------------------------------------------------------------------------- 1 | # How to submit solution 2 | 3 | Here's the process for submitting your solution to a GitHub repository. Follow these steps: 4 | 5 | ### Step-by-Step Submission Process 6 | 7 | ### Prerequisites: 8 | 9 | 1. Ensure you have a GitHub account. 10 | 2. Install Git on your local machine if it's not already installed. You can download it from [git-scm.com](https://git-scm.com/). 11 | 12 | ### Fork the Repository: 13 | 14 | 1. Go to the GitHub repository where you need to submit your solution. 15 | 2. Click on the `Fork` button at the top right corner of the repository page. This creates a copy of the repository under your GitHub account. 16 | 17 | ### Clone the Forked Repository: 18 | 19 | 1. Open a terminal on your local machine. 20 | 2. Clone the forked repository to your local machine using the following command (replace `your-username` with your GitHub username): 21 | 22 | ```bash 23 | git clone 24 | 25 | ``` 26 | 27 | 3. Navigate into the cloned repository directory: 28 | 29 | ```bash 30 | cd repository-name 31 | 32 | ``` 33 | 34 | 35 | ### Create a New Branch: 36 | 37 | 1. Create a new branch for your solution: 38 | 39 | ```bash 40 | git checkout -b solution-branch 41 | 42 | ``` 43 | 44 | 45 | ### Add Your Solution: 46 | 47 | 1. Create a directory named `solution` if it doesn't already exist: 48 | 49 | ```bash 50 | mkdir solution 51 | 52 | ``` 53 | 54 | 2. Copy your solution files into the `solution` directory. 55 | 56 | ### Commit Your Changes: 57 | 58 | 1. Add the new files to the staging area: 59 | 60 | ```bash 61 | git add solution/* 62 | 63 | ``` 64 | 65 | 2. Commit the changes with a meaningful message: 66 | 67 | ```bash 68 | git commit -m "Add Linux Fundamentals practice solutions" 69 | 70 | ``` 71 | 72 | 73 | ### Push Your Changes: 74 | 75 | 1. Push your changes to the new branch on your forked repository: 76 | 77 | ```bash 78 | git push origin solution-branch 79 | 80 | ``` 81 | 82 | 83 | ### Create a Pull Request: 84 | 85 | 1. Go to your forked repository on GitHub. 86 | 2. You should see a notification suggesting you create a pull request for the branch you just pushed. Click on the `Compare & pull request` button. 87 | 3. Fill in the pull request form with a meaningful title and description of the changes. 88 | 4. Click on the `Create pull request` button to submit your pull request. 89 | 90 | ### Example Commands 91 | 92 | Here's a summary of the Git commands you will use: 93 | 94 | ```bash 95 | # Clone the forked repository 96 | git clone 97 | 98 | # Navigate into the repository directory 99 | cd repository-name 100 | 101 | # Create a new branch for the solution 102 | git checkout -b solution-branch 103 | 104 | # Create a solution directory if not exist 105 | mkdir solution 106 | 107 | # Add your solution files to the solution directory 108 | cp /path/to/your/solution/* solution/ 109 | 110 | # Stage the new files 111 | git add solution/* 112 | 113 | # Commit the changes 114 | git commit -m "Add Linux Fundamentals practice solutions" 115 | 116 | # Push the changes to the solution branch 117 | git push origin solution-branch 118 | 119 | ``` 120 | 121 | ### Submission Checklist 122 | 123 | 1. Fork the repository on GitHub. 124 | 2. Clone the forked repository to your local machine. 125 | 3. Create a new branch for your solution. 126 | 4. Add your solution files to the `solution` directory. 127 | 5. Commit and push your changes. 128 | 6. Create a pull request on GitHub. 129 | 130 | This process ensures that your solution is submitted correctly via GitHub, allowing the instructor to review your work efficiently. -------------------------------------------------------------------------------- /Module 01 - Introduction to DevOps/01_Module 1 - Introduction to DevOps.md: -------------------------------------------------------------------------------- 1 | # Module 1: Introduction to DevOps 2 | 3 | Owner: Tanvir Ahmed 4 | 5 | --- 6 | 7 | Module Overview: 8 | 9 | This module serves as an introduction to DevOps, exploring its definition, historical evolution, core principles, and the importance of fostering a DevOps culture. 10 | 11 | --- 12 | 13 | ### 1. What is DevOps? 14 | 15 | ### Definition and Scope: 16 | 17 | DevOps is the combination of cultural philosophies, practices, and tools that helps companies/organizations deliver applications and services faster & efficiently. 18 | 19 | In a Simple sense "DevOps" represents "Dev" and "Ops" which stands for "Development Team" & "Operations Team" 20 | 21 | DevOps is a set of practices that combine software development (Dev) and IT operations (Ops). Its goal is to shorten the development lifecycle and deliver high-quality software continuously. By integrating these disciplines, DevOps aims to improve collaboration, enhance deployment frequency, and ensure faster time to market. 22 | 23 | Amazon [https://aws.amazon.com/devops/what-is-devops/](https://aws.amazon.com/devops/what-is-devops/) 24 | 25 | 26 | ### Objectives and Benefits: 27 | 28 | - **Objectives:** 29 | - Automate and streamline the software delivery process. 30 | 31 | **Redhat:** 32 | **DevOps automation** is the addition of technology that performs tasks with reduced human assistance to processes that facilitate feedback loops between operations and development teams so that iterative updates can be deployed faster to applications in production. 33 | - Enhance communication and collaboration between development and operations teams. 34 | - Ensure rapid and reliable software releases. 35 | 36 | - **Benefits:** 37 | - Increased deployment frequency. 38 | - Shorter lead time for changes. 39 | - Lower failure rate of new releases. 40 | - Faster recovery time in case of failure. 41 | - Improved quality and reliability of software. 42 | 43 | ### Need for DevOps in Modern Software Development: 44 | 45 | In the fast-paced world of software development, traditional methods often result in siloed teams, slow release cycles, and high failure rates. DevOps addresses these challenges by promoting a culture of collaboration and continuous improvement, enabling teams to respond swiftly to changes and deliver robust software efficiently. 46 | 47 | --- 48 | 49 | ### 2. History and Evolution of DevOps 50 | 51 | ### Origins and Challenges Addressed: 52 | 53 | DevOps emerged as a response to the growing complexity of modern software systems and the need for faster, more reliable delivery. Key challenges included: 54 | 55 | - Fragmented development and operations teams. 56 | - Inefficient and manual processes. 57 | - Slow and unreliable release cycles. 58 | - Lack of communication and collaboration. 59 | 60 | ### Evolution of DevOps Practices: 61 | 62 | DevOps has evolved through several phases: 63 | 64 | - **Early Days:** The concept gained traction in the mid-2000s with the rise of Agile methodologies. 65 | - **Tooling and Automation:** The introduction of tools like Jenkins, Docker, and Kubernetes facilitated automation and continuous integration. 66 | - **Cloud Computing:** The advent of cloud services (AWS, Azure, Google Cloud) allowed for scalable and flexible infrastructure. 67 | - **Modern DevOps:** Today, DevOps incorporates practices like Infrastructure as Code (IaC), Continuous Deployment (CD), GitOps and site reliability engineering (SRE). 68 | 69 | ### Case Studies and Success Stories: 70 | 71 | - **Netflix:** Pioneered the use of microservices and continuous delivery, enabling rapid scaling and reliable service delivery. 72 | - **Etsy:** Overhauled its release process to achieve faster deployments and improved site stability. 73 | - **Amazon:** Implemented a "you build it, you run it" philosophy, resulting in faster innovation and enhanced service reliability. 74 | 75 | --- 76 | 77 | ### 3. Core Principles of DevOps 78 | 79 | ### Continuous Integration (CI), Continuous Deployment (CD), and Continuous Delivery (CD): 80 | 81 | - **Continuous Integration (CI):** Developers frequently integrate code into a shared repository, where automated builds and tests are run to detect issues early. 82 | - **Continuous Deployment (CD):** Every change that passes automated tests is automatically deployed to production, ensuring quick and reliable updates. 83 | - **Continuous Delivery (CD):** Extends CI by automating the release process, allowing for deployments at any time with minimal manual intervention. 84 | 85 | ### Infrastructure as Code (IaC) and Automation: 86 | 87 | - **Infrastructure as Code (IaC):** Managing and provisioning computing infrastructure through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools. Tools like Terraform and AWS CloudFormation are commonly used. 88 | - **Automation:** Key to DevOps success, automation reduces manual errors, speeds up processes, and allows teams to focus on higher-value tasks. Examples include automated testing, deployment pipelines, and configuration management. 89 | 90 | --- 91 | 92 | ### 4. DevOps Culture 93 | 94 | ### Importance of Culture in DevOps Success: 95 | 96 | A successful DevOps implementation relies heavily on fostering a culture of collaboration, trust, and shared responsibility. The cultural shift is often the most challenging aspect of adopting DevOps, but it is crucial for achieving the full benefits. 97 | 98 | ### Building a Collaborative Environment: 99 | 100 | - **Communication:** Encourage open communication across all teams. 101 | - **Collaboration:** Break down silos between development, operations, and other stakeholders. 102 | - **Feedback:** Implement continuous feedback loops to improve processes and products. 103 | 104 | ### Implementing DevOps Principles in Teams and Organizations: 105 | 106 | - **Training and Education:** Provide ongoing training to ensure everyone understands DevOps practices and tools. 107 | - **Leadership Support:** Secure buy-in from leadership to drive cultural change and allocate resources. 108 | - **Incremental Adoption:** Start small with pilot projects and gradually expand DevOps practices across the organization. 109 | 110 | --- 111 | 112 | This comprehensive overview should help you cover the essential aspects of DevOps in Module 1. Each section can be expanded with specific examples, case studies, and practical exercises to reinforce learning. 113 | -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Module 02 - Linux Fundamentals.md: -------------------------------------------------------------------------------- 1 | ### Module Overview: 2 | 3 | This module covers essential Linux skills for DevOps beginners, including basic commands, file system navigation, text editing, process management, networking, and package management. 4 | 5 | --- 6 | 7 | ### 1. Basic Commands 8 | 9 | ### Introduction to Commonly Used Commands: 10 | 11 | - **Navigation and Directory Management:** 12 | - `pwd`: Print working directory. 13 | - `ls`: List directory contents. 14 | - `cd`: Change directory. 15 | - `mkdir`: Create a new directory. 16 | - `rmdir`: Remove a directory. 17 | - `cp`: Copy files or directories. 18 | - `mv`: Move or rename files or directories. 19 | - `rm`: Remove files or directories. 20 | - **File Management:** 21 | - `touch`: Create an empty file or update the timestamp of a file. 22 | - `cat`: Concatenate and display file content. 23 | - `more`, `less`: View file content one page at a time. 24 | - `head`, `tail`: Display the beginning or end of a file. 25 | - `nano`, `vim`: Text editors for editing file content. 26 | - **File Search and Permissions:** 27 | - `find`: Search for files in a directory hierarchy. 28 | - `grep`: Search for patterns within files. 29 | - `chmod`: Change file modes or access permissions. 30 | - `chown`: Change file owner and group. 31 | 32 | --- 33 | 34 | ### 2. File System 35 | 36 | ### Understanding Linux File System Hierarchy: 37 | 38 | - **Root Directory (`/`):** The base of the Linux file system. 39 | - **Common Directories:** 40 | - `/bin`: Essential command binaries. 41 | - `/sbin`: System binaries. 42 | - `/etc`: Configuration files. 43 | - `/home`: User home directories. 44 | - `/var`: Variable files like logs. 45 | - `/usr`: User binaries and program data. 46 | - `/tmp`: Temporary files. 47 | 48 | ### Permissions Management: 49 | 50 | - **File Permissions:** 51 | - **Types:** Read (`r`), Write (`w`), Execute (`x`). 52 | - **User Classes:** Owner, group, others. 53 | - **Command:** `chmod` (e.g., `chmod 755 filename`). 54 | 55 | ### Special Files (/dev, /proc, /sys): 56 | 57 | - **/dev:** Device files representing hardware devices. 58 | - **/proc:** Virtual filesystem providing process and system information. 59 | - **/sys:** Interface to kernel data structures. 60 | 61 | --- 62 | 63 | ### 3. Text Editors 64 | 65 | ### Proficiency with Command-Line Text Editors: 66 | 67 | - **Nano:** 68 | - Easy-to-use text editor. 69 | - Basic commands: `Ctrl+O` (write out/save), `Ctrl+X` (exit). 70 | - **Vim:** 71 | - More powerful but complex editor. 72 | - Modes: Normal, Insert, Visual, Command-line. 73 | - Basic commands: `i` (insert mode), `:w` (write/save), `:q` (quit). 74 | 75 | --- 76 | 77 | ### 4. Processes 78 | 79 | ### Managing Processes and System Resources: 80 | 81 | - **Process Commands:** 82 | - `ps`: Display current processes. 83 | - `top`: Display live system processes. 84 | - `htop`: Enhanced version of `top`. 85 | - `kill`: Terminate a process by PID. 86 | - `pkill`: Terminate processes by name. 87 | - `nice`/`renice`: Change process priority. 88 | - **Background and Foreground Processes:** 89 | - `&`: Run a command in the background. 90 | - `fg`: Bring a background process to the foreground. 91 | - `bg`: Resume a stopped background process. 92 | 93 | --- 94 | 95 | ### 5. Networking 96 | 97 | ### Basic Networking Commands and Configuration: 98 | 99 | - **Network Configuration:** 100 | - `ifconfig`: Configure a network interface. 101 | - `ip`: Show/manipulate routing, devices, policy routing, and tunnels. 102 | - `ping`: Test network connectivity. 103 | - `netstat`: Display network connections, routing tables, interface statistics. 104 | - `ss`: Another utility to investigate sockets. 105 | - **Network Management:** 106 | - `scp`: Secure copy files between hosts. 107 | - `ssh`: Securely connect to remote machines. 108 | - `ftp`, `sftp`: Transfer files over network. 109 | 110 | --- 111 | 112 | ### 6. Package Management 113 | 114 | ### Introduction to Package Managers: 115 | 116 | - **Debian-based Systems (e.g., Ubuntu):** 117 | - `apt-get`, `apt`: Install, update, and remove packages (e.g., `apt-get update`, `apt-get install package_name`). 118 | - `dpkg`: Install, remove, and provide information about .deb packages. 119 | - **Red Hat-based Systems (e.g., CentOS, Fedora):** 120 | - `yum`, `dnf`: Install, update, and remove packages (e.g., `yum install package_name`). 121 | - `rpm`: Install, remove, and provide information about .rpm packages. 122 | - **Common Commands:** 123 | - `install`: Install a package. 124 | - `update`: Update package lists or upgrade installed packages. 125 | - `remove` or `uninstall`: Remove a package. 126 | - `search`: Search for a package. 127 | 128 | --- 129 | 130 | This detailed content should provide a comprehensive foundation for beginners to understand and start using Linux in a DevOps context. Each section can be supplemented with hands-on exercises and practical examples to reinforce learning. -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/Ezaz_Task1.md: -------------------------------------------------------------------------------- 1 | # Solution 1: File System Navigation and File Management 2 | 3 | 1. **Navigate to the /var/log directory:** 4 | 5 | ``` 6 | cd /var/log 7 | ``` 8 | 9 | 2. **List all files and directories in the /var/log directory:** 10 | 11 | ``` 12 | ls -ls 13 | ``` 14 | 15 | 3. **Create a new directory named `test_logs` within /var/log:** 16 | 17 | ``` 18 | sudo mkdir test_logs 19 | ``` 20 | 21 | 4. **Navigate into the `test_logs` directory:** 22 | 23 | ``` 24 | cd test_logs 25 | ``` 26 | 27 | 5. **Create an empty file named `test.log`:** 28 | 29 | ``` 30 | sudo touch test.log 31 | ``` 32 | 33 | 6. **Display the contents of the `test.log` file:** 34 | 35 | ``` 36 | cat test.log 37 | ``` 38 | 39 | 7. **Edit the `test.log` file and add a new line of text:** 40 | ``` 41 | sudo vi test.log 42 | ``` 43 | Screenshot: 44 | 45 | ![Screenshot of Solution 1](https://i.ibb.co/JtP3x8y/Screenshot-2024-05-26-170509.png) 46 | 47 | # Solution 2: Process Management 48 | 49 | 1. **Display a list of currently running processes:** 50 | 51 | ``` 52 | ps aux 53 | ``` 54 | 55 | 2. **Identify the PID of the process named nginx:** 56 | 57 | ``` 58 | pgrep nginx 59 | ``` 60 | 61 | 3. **Terminate the nginx process using its PID:** 62 | 63 | ``` 64 | sudo pkill nginx 65 | ``` 66 | 67 | 4. **Start the nginx process again:** 68 | ``` 69 | sudo systemctl start nginx 70 | ``` 71 | Screenshot: 72 | 73 | ![Screenshot of Solution 2](https://i.ibb.co/xs3Sp87/process.png) 74 | 75 | # Solution 3: Networking 76 | 77 | 1. **To Check Network configuration:** 78 | 79 | ``` 80 | ifconfig 81 | ``` 82 | 83 | 2. **To test connectivity:** 84 | ``` 85 | ping 8.8.8.8 86 | ``` 87 | Screenshot: 88 | 89 | ![Screenshot of Solution 3](https://i.ibb.co/zNXQXyG/network-1.png) 90 | 91 | # Solution 4: Package Management 92 | 93 | 1. **To Update package list of system:** 94 | 95 | ``` 96 | sudo apt update 97 | ``` 98 | 99 | 2. **To Install htop package:** 100 | 101 | ``` 102 | sudo apt install htop 103 | ``` 104 | 105 | 3. **To Uninstall htop package:** 106 | ``` 107 | sudo apt remove htop 108 | ``` 109 | Screenshot: 110 | 111 | ![Screenshot of Solution 4](https://i.ibb.co/PCDmXGP/package-management.png) 112 | -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/HarunOrRashid_Task1.md: -------------------------------------------------------------------------------- 1 | ### Exercise 1: File System Navigation and File Management 2 | 3 | 1. Navigate to the `/var/log` directory. 4 | > cd /var/log 5 | 2. List all files and directories in the `/var/log` directory. 6 | > ls 7 | 3. Create a new directory named `test_logs` within `/var/log`. 8 | > mkdir test_logs 9 | 4. Navigate into the `test_logs` directory. 10 | > cd test_logs 11 | 5. Create an empty file named `test.log`. 12 | > touch test.log 13 | 6. Display the contents of the `test.log` file. 14 | > cat test.log 15 | 7. Edit the `test.log` file and add a new line of text. 16 | > vi test.log 17 | > i 18 | > Enter 19 | 8. Save and exit the text editor. 20 | > Esc 21 | > :wq 22 | > Enter 23 | 24 | 25 | ### Exercise 2: Process Management 26 | 27 | 1. Display a list of currently running processes. 28 | > ps 29 | 2. Identify the PID of the process named `nginx` (assuming it's installed and running). 30 | > pidof nginx 31 | 3. Terminate the `nginx` process using its PID. 32 | > kill PID 33 | 4. Start the `nginx` process again. 34 | > sudo systemctl start nginx 35 | 36 | 37 | 38 | ### Exercise 3: Networking 39 | 40 | 1. Check the network configuration of your system. 41 | > ifconfig 42 | 2. Test the connectivity to a remote server by pinging its IP address. 43 | > ping 44 | 45 | 46 | ### Exercise 4: Package Management 47 | 48 | 1. Update the package lists on your system. 49 | > sudo apt-get update 50 | 2. Install the `htop` package using the appropriate package manager for your Linux distribution. 51 | > sudo apt-get install htop 52 | 3. Remove the `htop` package from your system. 53 | > sudo apt-get remove htop -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/Rahat/Rahat_Task.md: -------------------------------------------------------------------------------- 1 | ### Task: Linux Fundamentals Practice 2 | 3 | Folder Stucture: 4 | 5 | Screenshot: 6 | ![alt text](SS/folder.png) 7 | 8 | Check the network configuration of your system. 9 | ``` 10 | ifconfig 11 | ``` 12 | Screenshot: 13 | ![alt text](SS/ifconfig.png) -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/Rahat/SS/folders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudwithtanvir/DevOps-bootcamp/7c63c65d84c6b72981588f4d04f0abfc55b2c64f/Module 02 - Linux Fundamentals/Solution/Rahat/SS/folders.png -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/Rahat/SS/ifconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudwithtanvir/DevOps-bootcamp/7c63c65d84c6b72981588f4d04f0abfc55b2c64f/Module 02 - Linux Fundamentals/Solution/Rahat/SS/ifconfig.png -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/Sabit_Task1.md: -------------------------------------------------------------------------------- 1 | ### Exercise 1: File System Navigation and File Management 2 | 3 | 1. Navigate to the `/var/log` directory. 4 | ```bash 5 | cd /var/log 6 | ``` 7 | 2. List all files and directories in the `/var/log` directory. 8 | ```bash 9 | ls -la 10 | ``` 11 | 3. Create a new directory named `test_logs` within `/var/log`. 12 | ```bash 13 | sudo mkdir test_logs 14 | ``` 15 | 4. Navigate into the `test_logs` directory. 16 | ```bash 17 | cd test_logs 18 | ``` 19 | 5. Create an empty file named `test.log`. 20 | ```bash 21 | sudo touch test.log 22 | ``` 23 | 6. Display the contents of the `test.log` file. 24 | ```bash 25 | cat test.log 26 | ``` 27 | 7. Edit the `test.log` file and add a new line of text. 28 | ```bash 29 | sudo nano test.log 30 | ``` 31 | *(Add a new line of text in the nano editor)* 32 | 8. Save and exit the text editor. 33 | ```bash 34 | # In nano, press Ctrl+O to save, then Ctrl+X to exit. 35 | ``` 36 | [![Solution GIF](https://i.ibb.co/dcJnjWY/output1.gif)](https://ibb.co/LPh4Yk7) 37 | 38 | ### Exercise 2: Process Management 39 | 40 | 1. Display a list of currently running processes. 41 | ```bash 42 | ps aux 43 | ``` 44 | 2. Identify the PID of the process named `nginx` (assuming it's installed and running). 45 | ```bash 46 | ps aux | grep nginx 47 | ``` 48 | 3. Terminate the `nginx` process using its PID. 49 | ```bash 50 | sudo kill 51 | ``` 52 | 4. Start the `nginx` process again. 53 | ```bash 54 | sudo systemctl start nginx 55 | ``` 56 | [![Solution GIF](https://i.ibb.co/pPhfRx6/output2.gif)](https://ibb.co/vBX3QHC) 57 | 58 | ### Exercise 3: Networking 59 | 60 | 1. Check the network configuration of your system. 61 | ```bash 62 | ifconfig 63 | ``` 64 | 2. Test the connectivity to a remote server by pinging its IP address. 65 | ```bash 66 | ping 67 | ``` 68 | 3. Use `ssh` to securely connect to a remote machine (replace `remote_user` and `remote_host` with appropriate values). 69 | ```bash 70 | ssh remote_user@remote_host 71 | ``` 72 | 4. Transfer a file from your local machine to the remote machine using `scp`. 73 | ```bash 74 | scp /path/to/local/file remote_user@remote_host:/path/to/destination 75 | ``` 76 | [![Solution GIF](https://i.ibb.co/rdYCFPW/output3.gif)](https://ibb.co/2ZxDW2b) 77 | 78 | ### Exercise 4: Package Management 79 | 80 | 1. Update the package lists on your system. 81 | ```bash 82 | sudo apt update 83 | ``` 84 | 2. Install the `htop` package using the appropriate package manager for your Linux distribution. 85 | ```bash 86 | sudo apt install htop 87 | ``` 88 | 3. Remove the `htop` package from your system. 89 | ```bash 90 | sudo apt remove htop 91 | ``` 92 | [![Solution GIF](https://i.ibb.co/Fww1X9v/output4.gif)](https://ibb.co/7WWDQHc) -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/Sajid_Task1.md: -------------------------------------------------------------------------------- 1 | ### Task: Linux Fundamentals Practice 2 | 3 | ### Exercise 1: File System Navigation and File Management 4 | 5 | 1. Navigate to the `/var/log` directory. 6 | ``` 7 | sudo su 8 | cd /var/log 9 | ``` 10 | 2. List all files and directories in the `/var/log` directory. 11 | ``` 12 | ls 13 | ``` 14 | 3. Create a new directory named `test_logs` within `/var/log`. 15 | ``` 16 | mkdir test_logs 17 | ``` 18 | 4. Navigate into the `test_logs` directory. 19 | ``` 20 | cd test_logs 21 | ``` 22 | 5. Create an empty file named `test.log`. 23 | ``` 24 | touch test.log 25 | ``` 26 | 6. Display the contents of the `test.log` file. 27 | ``` 28 | cat test.log 29 | ``` 30 | 7. Edit the `test.log` file and add a new line of text. 31 | ``` 32 | nano test.log 33 | ``` 34 | 8. Save and exit the text editor. 35 | > `ctrl + x` then `Y` 36 | 37 | 9. Screenshot: 38 | ![alt text](image.png) 39 | 40 | ### Exercise 2: Process Management 41 | 1. Display a list of currently running processes. 42 | ``` 43 | ps 44 | ``` 45 | 2. Identify the PID of the process named `nginx` (assuming it's installed and running). 46 | ``` 47 | pgrep nginx 48 | ``` 49 | 3. Terminate the `nginx` process using its PID. 50 | ``` 51 | kill 3716 3717 3718 3719 3720 52 | ``` 53 | 4. Start the `nginx` process again. 54 | ``` 55 | systemctl start nginx 56 | ``` 57 | Screenshot: 58 | ![alt text](image-1.png) 59 | 60 | ### Exercise 3: Networking 61 | 1. Check the network configuration of your system. 62 | ``` 63 | ifconfig 64 | ``` 65 | 2. Test the connectivity to a remote server by pinging its IP address. 66 | ``` 67 | ping 8.8.8.8 68 | ``` 69 | 70 | Screenshot: 71 | ![alt text](image-2.png) 72 | 73 | ### Exercise 4: Package Management 74 | 1. Update the package lists on your system. 75 | ``` 76 | sudo apt-get update 77 | ``` 78 | 2. Install the `htop` package using the appropriate package manager for your Linux distribution. 79 | ``` 80 | sudo apt-get htop 81 | ``` 82 | 3. Remove the `htop` package from your system. 83 | ``` 84 | sudo apt-get remove htop 85 | ``` 86 | 87 | Screenshots: 88 | ![alt text](image-3.png) 89 | ![alt text](image-4.png) -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/Tanvir_Task1.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudwithtanvir/DevOps-bootcamp/7c63c65d84c6b72981588f4d04f0abfc55b2c64f/Module 02 - Linux Fundamentals/Solution/Tanvir_Task1.md -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/Tawfiq/TawfiqueHossain_Task1.md: -------------------------------------------------------------------------------- 1 | ### Exercise 1: File System Navigation and File Management 2 | 3 | 1. Navigate to the `/var/log` directory. 4 | > cd /var/log 5 | 2. List all files and directories in the `/var/log` directory. 6 | > ls 7 | 3. Create a new directory named `test_logs` within `/var/log`. 8 | > mkdir test_logs 9 | 4. Navigate into the `test_logs` directory. 10 | > cd test_logs 11 | 5. Create an empty file named `test.log`. 12 | > touch test.log 13 | 6. Display the contents of the `test.log` file. 14 | > cat test.log 15 | 7. Edit the `test.log` file and add a new line of text. 16 | > vi test.log 17 | > i 18 | > Enter 19 | 8. Save and exit the text editor. 20 | > Esc 21 | > :wq 22 | > Enter 23 | 24 | ### Exercise 2: Process Management 25 | 26 | 1. Display a list of currently running processes. 27 | > ps 28 | 2. Identify the PID of the process named `nginx` (assuming it's installed and running). 29 | > pidof nginx 30 | 3. Terminate the `nginx` process using its PID. 31 | > kill PID 32 | 4. Start the `nginx` process again. 33 | > sudo systemctl start nginx 34 | 35 | 36 | ### Exercise 3: Networking 37 | 38 | 1. Check the network configuration of your system. 39 | > ifconfig 40 | 2. Test the connectivity to a remote server by pinging its IP address. 41 | > ping 42 | 43 | ### Exercise 4: Package Management 44 | 45 | 1. Update the package lists on your system. 46 | > sudo apt-get update 47 | 2. Install the `htop` package using the appropriate package manager for your Linux distribution. 48 | > sudo apt-get install htop 49 | 3. Remove the `htop` package from your system. 50 | > sudo apt-get remove htop 51 | -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/Tawfiq/screenshot/1.filesystem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudwithtanvir/DevOps-bootcamp/7c63c65d84c6b72981588f4d04f0abfc55b2c64f/Module 02 - Linux Fundamentals/Solution/Tawfiq/screenshot/1.filesystem.png -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/Tawfiq/screenshot/2.process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudwithtanvir/DevOps-bootcamp/7c63c65d84c6b72981588f4d04f0abfc55b2c64f/Module 02 - Linux Fundamentals/Solution/Tawfiq/screenshot/2.process.png -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/Tawfiq/screenshot/3.network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudwithtanvir/DevOps-bootcamp/7c63c65d84c6b72981588f4d04f0abfc55b2c64f/Module 02 - Linux Fundamentals/Solution/Tawfiq/screenshot/3.network.png -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/Tawfiq/screenshot/4.package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudwithtanvir/DevOps-bootcamp/7c63c65d84c6b72981588f4d04f0abfc55b2c64f/Module 02 - Linux Fundamentals/Solution/Tawfiq/screenshot/4.package.png -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudwithtanvir/DevOps-bootcamp/7c63c65d84c6b72981588f4d04f0abfc55b2c64f/Module 02 - Linux Fundamentals/Solution/image-1.png -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudwithtanvir/DevOps-bootcamp/7c63c65d84c6b72981588f4d04f0abfc55b2c64f/Module 02 - Linux Fundamentals/Solution/image-2.png -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudwithtanvir/DevOps-bootcamp/7c63c65d84c6b72981588f4d04f0abfc55b2c64f/Module 02 - Linux Fundamentals/Solution/image-3.png -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudwithtanvir/DevOps-bootcamp/7c63c65d84c6b72981588f4d04f0abfc55b2c64f/Module 02 - Linux Fundamentals/Solution/image-4.png -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Solution/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudwithtanvir/DevOps-bootcamp/7c63c65d84c6b72981588f4d04f0abfc55b2c64f/Module 02 - Linux Fundamentals/Solution/image.png -------------------------------------------------------------------------------- /Module 02 - Linux Fundamentals/Task1.md: -------------------------------------------------------------------------------- 1 | ### Task: Linux Fundamentals Practice 2 | 3 | ### Objective: 4 | 5 | The objective of this task is to reinforce the understanding of essential Linux commands, file system navigation, text editing, process management, networking, and package management covered in Module 2: Linux Fundamentals. 6 | 7 | ### Task Description: 8 | 9 | You will be given a series of practical exercises to complete. These exercises are designed to simulate real-world scenarios encountered in a DevOps environment. Follow the instructions provided for each exercise and use the Linux commands and concepts learned in the module to complete the tasks. 10 | 11 | ### Exercise 1: File System Navigation and File Management 12 | 13 | 1. Navigate to the `/var/log` directory. 14 | 2. List all files and directories in the `/var/log` directory. 15 | 3. Create a new directory named `test_logs` within `/var/log`. 16 | 4. Navigate into the `test_logs` directory. 17 | 5. Create an empty file named `test.log`. 18 | 6. Display the contents of the `test.log` file. 19 | 7. Edit the `test.log` file and add a new line of text. 20 | 8. Save and exit the text editor. 21 | 22 | ### Exercise 2: Process Management 23 | 24 | 1. Display a list of currently running processes. 25 | 2. Identify the PID of the process named `nginx` (assuming it's installed and running). 26 | 3. Terminate the `nginx` process using its PID. 27 | 4. Start the `nginx` process again. 28 | 29 | ### Exercise 3: Networking 30 | 31 | 1. Check the network configuration of your system. 32 | 2. Test the connectivity to a remote server by pinging its IP address. 33 | 3. Use `ssh` to securely connect to a remote machine (replace `remote_user` and `remote_host` with appropriate values). 34 | 35 | ``` 36 | ssh remote_user@remote_host 37 | 38 | ``` 39 | 40 | 4. Transfer a file from your local machine to the remote machine using `scp`. 41 | 42 | ``` 43 | scp /path/to/local/file remote_user@remote_host:/path/to/destination 44 | 45 | ``` 46 | 47 | 48 | ### Exercise 4: Package Management 49 | 50 | 1. Update the package lists on your system. 51 | 2. Install the `htop` package using the appropriate package manager for your Linux distribution. 52 | 3. Remove the `htop` package from your system. 53 | 54 | ### Submission: 55 | 56 | Once you have completed all the exercises, write a summary of your experience and any challenges you encountered during the task. Include screenshots or logs where necessary to demonstrate your solutions. 57 | 58 | -------------------------------------------------------------------------------- /Module 03 - Virtual Machines/Virtual Machines.md: -------------------------------------------------------------------------------- 1 | # Module 3 Virtual Machines 2 | 3 | Owner: Tanvir Ahmed 4 | 5 | ### What is a Server? 6 | 7 | A server is a computer or system that provides resources, data, services, or programs to other computers, known as clients, over a network. There are different types of servers, such as web servers, database servers, application servers, and file servers. Servers are designed to handle and manage network resources efficiently and are often more powerful and robust than typical client computers. 8 | 9 | ### What is a VM? 10 | 11 | A Virtual Machine (VM) is a software-based emulation of a physical computer. It runs an operating system and applications just like a physical computer. VMs are created using virtualization software and can be run on physical hardware (host machine) alongside other VMs. Each VM has its own virtualized hardware, including CPUs, memory, disk storage, and network interfaces. 12 | 13 | ### What is a Hypervisor? 14 | 15 | A hypervisor, also known as a virtual machine manager (VMM), is software that creates and manages virtual machines. It allows multiple VMs to run on a single physical host by abstracting the hardware resources and allocating them to the VMs. There are two main types of hypervisors: 16 | 17 | 1. **Type 1 (Bare-Metal) Hypervisors**: These run directly on the host's hardware and manage guest operating systems, such as VMware ESXi, Microsoft Hyper-V, and Xen. 18 | 2. **Type 2 (Hosted) Hypervisors**: These run on a conventional operating system and then manage guest operating systems, such as VMware Workstation, Oracle VirtualBox, and Parallels Desktop. 19 | 20 | ### Difference Between Physical and Virtual Machines 21 | 22 | - **Physical Machines**: 23 | - **Definition**: Actual hardware devices. 24 | - **Resource Allocation**: Direct and static allocation of resources like CPU, memory, and storage. 25 | - **Isolation**: Limited; processes can interfere with each other if not managed properly. 26 | - **Flexibility**: Less flexible, as hardware upgrades or changes are needed for scaling. 27 | - **Cost**: Higher upfront cost for purchasing and maintaining hardware. 28 | - **Virtual Machines**: 29 | - **Definition**: Software-based emulations of physical computers. 30 | - **Resource Allocation**: Dynamic and managed by the hypervisor, allowing for efficient use of resources. 31 | - **Isolation**: High; each VM operates independently with its own OS and applications. 32 | - **Flexibility**: Highly flexible; easy to create, modify, clone, and migrate. 33 | - **Cost**: Lower cost due to shared hardware resources and reduced need for physical infrastructure. 34 | 35 | ### Advantages of Virtual Machines 36 | 37 | 1. **Efficient Resource Utilization**: 38 | - VMs can share the physical resources of a single host, maximizing the use of CPU, memory, and storage. 39 | 2. **Isolation and Security**: 40 | - Each VM is isolated from others, reducing the risk of one VM affecting another and improving security. 41 | 3. **Scalability**: 42 | - VMs can be easily scaled up or down by adjusting allocated resources or adding more VMs. 43 | 4. **Flexibility and Portability**: 44 | - VMs can be moved between different physical machines, allowing for easier maintenance and disaster recovery. 45 | 5. **Cost Savings**: 46 | - Reduced need for physical hardware leads to lower capital and operational expenses. 47 | 6. **Environment Consistency**: 48 | - VMs provide consistent environments for development, testing, and production, minimizing discrepancies. 49 | 7. **Snapshot and Backup**: 50 | - VMs support snapshots and backups, allowing for easy rollback and data recovery. 51 | 52 | ### Detailed Overview of Virtual Machines 53 | 54 | ### 1. **Creation and Management** 55 | 56 | Virtual machines are created through a process called virtualization, which is managed by a hypervisor. The hypervisor allocates resources like CPU, memory, and storage to each VM, which operates as if it were running on a physical machine. Users can create multiple VMs on a single physical host, each with its own operating system and applications. 57 | 58 | ### 2. **Types of Virtual Machines** 59 | 60 | - **System VMs**: These VMs provide a complete system platform that supports the execution of a complete operating system (e.g., Windows, Linux). 61 | - **Process VMs**: These VMs run a single application or process, providing an environment that abstracts the underlying hardware (e.g., Java Virtual Machine). 62 | 63 | ### 3. **Use Cases** 64 | 65 | - **Server Consolidation**: Running multiple server instances on a single physical machine to reduce hardware costs. 66 | - **Development and Testing**: Developers use VMs to create isolated environments for testing software without affecting the main system. 67 | - **Disaster Recovery**: VMs can be backed up and replicated, making it easier to recover from hardware failures. 68 | - **Cloud Computing**: Cloud providers offer VMs as a service, allowing users to deploy applications without worrying about underlying hardware. 69 | 70 | ### 4. **Performance Considerations** 71 | 72 | While VMs offer many benefits, there are performance considerations due to the overhead of virtualization. Hypervisors manage this overhead by optimizing resource allocation and using techniques like paravirtualization, which allows the guest OS to be aware of the hypervisor, improving efficiency. 73 | 74 | ### 5. **Future Trends** 75 | 76 | - **Containerization**: Containers provide an alternative to VMs by offering a lighter-weight form of virtualization, sharing the host OS kernel while isolating applications. 77 | - **Edge Computing**: VMs are increasingly used in edge computing to provide processing power closer to data sources, reducing latency. 78 | - **Hybrid Cloud**: Combining on-premises and cloud resources using VMs to provide flexible and scalable computing environments. 79 | 80 | In summary, virtual machines play a crucial role in modern IT infrastructure by providing flexible, efficient, and cost-effective solutions for resource management, application deployment, and disaster recovery. 81 | 82 | What are the differences between Virtualization (VMware) and Containerization (Docker)? 83 | 84 | The diagram below illustrates the layered architecture of virtualization and containerization. 85 | 86 | “Virtualization is a technology that allows you to create multiple simulated environments or dedicated resources from a single, physical hardware system” [1]. 87 | 88 | “Containerization is the packaging together of software code with all its necessary components like libraries, frameworks, and other dependencies so that they are isolated in their own "container" [2]. 89 | 90 | The major differences are: 91 | 92 | 🔹 In virtualization, the hypervisor creates an abstraction layer over hardware, so that multiple operating systems can run alongside each other. This technique is considered to be the first generation of cloud computing. 93 | 94 | ![https://substackcdn.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F14409324-6525-49f9-85b5-ea416d4efffb_2556x1383.jpeg](https://substackcdn.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F14409324-6525-49f9-85b5-ea416d4efffb_2556x1383.jpeg) 95 | 96 | 🔹Containerization is considered to be a lightweight version of virtualization, which virtualizes the operating system instead of hardware. Without the hypervisor, the containers enjoy faster resource provisioning. All the resources (including code, dependencies) that are needed to run the application or microservice are packaged together, so that the applications can run anywhere. 97 | 98 | Question: how much performance differences have you observed in production between virtualization, containerization, and bare-metal? -------------------------------------------------------------------------------- /Module 04 - A Practical Guide to Containers with Docker/A Practical Guide to Containers with Docker.md: -------------------------------------------------------------------------------- 1 | ## A Practical Guide to Containers with Docker 2 | 3 | ### By Tanvir Ahmed 4 | 5 | --- 6 | 7 | ### Contents 8 | 9 | 1. **Understanding Containers and Docker** 10 | 2. **From Bare Metal to Docker: The Evolution of Backend Infrastructure** 11 | 3. **Exploring Docker Components and Architecture** 12 | 4. **Docker vs. Virtual Machines: A Comparison** 13 | 5. **Advantages for Developers: Why Use Docker?** 14 | 6. **Installing Docker: Step-by-Step Guide** 15 | 7. **Essential Docker Commands Every Developer Should Know** 16 | 8. **Building Images with Dockerfile: A Practical Guide** 17 | 9. **Running and Managing Docker Containers** 18 | 10. **Demo Project Overview - Docker in Practice (Node.js App / Django App)** 19 | 11. **Introduction to Docker Swarm and Kubernetes** 20 | 12. **Using a Private Docker Repository** 21 | 13. **Deploying Containerized Applications** 22 | 14. **Docker Networking: Effective Utilization** 23 | 15. **Docker Volumes: Persisting Data** 24 | 16. **Volumes Demo: Persistence for Demo Project** 25 | 17. **Docker Best Practices** 26 | 18. **Additional Learning Resources** 27 | 19. **Contact for Assistance** 28 | 29 | --- 30 | 31 | ### 1. Understanding Containers and Docker 32 | 33 | ### What is a Container? 34 | 35 | A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. Containers enable the packaging and isolation of applications with their entire runtime environment, making it easy to move applications between environments (development, testing, production, etc.). 36 | 37 | **Sources:** 38 | 39 | - Red Hat: "Containers allow the packaging and isolation of applications with their entire runtime environment—all of the files necessary to run." 40 | - Docker: "A container is a standard unit of software that packages up code and all its dependencies." 41 | 42 | ### What is Docker? 43 | 44 | Docker is a tool designed to simplify the creation, deployment, and running of applications by using containers. Containers package an application with all necessary parts such as libraries and dependencies, ensuring the application runs consistently across different environments. 45 | 46 | **Source:** 47 | 48 | - [Opensource.com](http://opensource.com/): "Docker allows a developer to package up an application with all parts it needs, such as libraries and other dependencies, and ship it all out as one package." 49 | 50 | --- 51 | 52 | ### 2. From Bare Metal to Docker: The Evolution of Backend Infrastructure 53 | 54 | In the early days, deploying applications was slow and cumbersome. Developers often faced "dependency hell," where code worked in one environment but failed in another. This changed dramatically in 2013 with the introduction of Docker, a game-changing container technology. 55 | 56 | In this section, we’ll trace the history of container technology, the innovations behind Docker's rise, and the Linux fundamentals that enable its functionality. We’ll explain Docker images, how they differ from virtual machines (VMs), and whether Kubernetes is necessary for using Docker effectively. By the end, you’ll understand why Docker is the standard for cloud application deployment. 57 | 58 | ### The Journey from Physical Servers to Docker 59 | 60 | ![The Journey from Physical Servers to Docker](https://prod-files-secure.s3.us-west-2.amazonaws.com/cb47695b-6ab7-49db-ac6d-62a20dd3f4af/9fbe20f6-9c44-4965-a8cf-9fc65eff8c5f/Untitled.png) 61 | 62 | 1. **Bare Metal Servers**: 63 | - **Setup**: Applications ran directly on physical servers. 64 | - **Drawback**: Time-consuming to purchase, set up, and configure new machines. 65 | 2. **Hardware Virtualization**: 66 | - **Innovation**: Multiple VMs run on a single physical server. 67 | - **Drawback**: Provisioning and managing VMs was still a heavy task. 68 | 3. **Infrastructure-as-a-Service (IaaS)**: 69 | - **Innovation**: Platforms like Amazon EC2 provided on-demand virtual resources. 70 | - **Drawback**: Developers still manually configured VMs with libraries and dependencies. 71 | 4. **Platform-as-a-Service (PaaS)**: 72 | - **Innovation**: Managed development platforms like Cloud Foundry and Heroku simplified deployment. 73 | - **Drawback**: Inconsistencies across environments led to "works on my machine" issues. 74 | 5. **Docker (2013)**: 75 | - **Innovation**: Solved deployment issues with lightweight containerization and application packaging. 76 | 77 | ### Docker’s Key Innovations 78 | 79 | ### Lightweight Containerization 80 | 81 | Containers and VMs are often compared, but they operate differently: 82 | 83 | - **Virtual Machines**: 84 | - **Hypervisor**: Emulates server hardware to run multiple VMs on one physical server. 85 | - **Isolation**: Guest OS runs on virtualized hardware, separate from host resources. 86 | - **Docker Containers**: 87 | - **Engine**: Shares the host OS kernel using Linux namespaces and control groups (cgroups) for isolation. 88 | - **Efficiency**: Containers start quickly and share host resources without a full OS boot. 89 | 90 | This makes containers more lightweight and portable than VMs, as they leverage OS-level isolation rather than hardware virtualization. 91 | 92 | ### Application Packaging 93 | 94 | Before Docker, Cloud Foundry was a popular PaaS platform, providing isolated environments using Linux containers. However, Docker innovated by externalizing this container technology, solving two major PaaS packaging issues: 95 | 96 | 1. **Comprehensive Bundling**: Packages the app, configurations, dependencies, and OS into a single deployable image. 97 | 2. **Environment Consistency**: Ensures the local development environment mirrors the cloud runtime. 98 | 99 | These innovations eliminated the dependency and compatibility issues common in traditional PaaS environments, allowing Docker images to become widely adopted in cloud computing. 100 | 101 | ### From Docker to Kubernetes 102 | 103 | Docker’s initial success came from its novel approach to packaging and deploying applications in lightweight containers. As its popularity grew, Docker expanded its offerings: 104 | 105 | - **Docker Swarm**: For cluster management. 106 | - **Docker Compose**: For application orchestration (acquired from Fig). 107 | 108 | Tech giants like Google and RedHat recognized Docker's potential and joined the container revolution. However, Kubernetes soon emerged as the leading orchestration tool for managing containerized applications at scale. 109 | 110 | ### Conclusion 111 | 112 | Docker revolutionized application deployment with its lightweight containers and innovative packaging solutions. Understanding its history and technology helps appreciate why it became the cloud standard. While Kubernetes offers powerful orchestration, Docker remains essential for packaging and distributing applications efficiently. 113 | 114 | --- 115 | 116 | ### 3. Exploring Docker Components and Architecture 117 | 118 | Docker architecture consists of the following components: 119 | 120 | ![Docker architecture consists of the following components](https://prod-files-secure.s3.us-west-2.amazonaws.com/cb47695b-6ab7-49db-ac6d-62a20dd3f4af/0172568c-98e8-45d4-aefd-1d847e4c1a13/Untitled.png) 121 | 122 | - **Docker Client**: The interface through which users interact with Docker. 123 | - **Docker Daemon**: A background service that manages Docker images, containers, networks, and storage volumes. 124 | - **Docker Image**: A read-only template used to create Docker containers. 125 | - **Docker Container**: A runnable instance of a Docker image. 126 | - **Docker Registry**: A storage and distribution system for Docker images. 127 | 128 | --- 129 | 130 | ### 4. Docker vs. Virtual Machines: A Comparison 131 | 132 | Docker and Virtual Machines (VMs) both provide ways to deploy isolated applications, but they have key differences: 133 | 134 | - **Resource Efficiency**: Docker containers share the host OS kernel, making them more lightweight and faster to start compared to VMs, which require a full OS per instance. 135 | - **Isolation**: VMs offer complete isolation with their own OS, while Docker containers share the host OS but provide process-level isolation. 136 | - **Performance**: Docker containers typically have lower overhead and better performance than VMs. 137 | 138 | **Reference:** [ByteByteGo Blog on Docker vs. VMs](https://blog.bytebytego.com/p/what-are-the-differences-between) 139 | 140 | --- 141 | 142 | ### 5. Advantages for Developers: Why Use Docker? 143 | 144 | - **Cross-Platform Development**: Docker ensures that applications run consistently across different environments. 145 | - **Efficient Dependency Management**: Containers encapsulate all dependencies, leading to faster startup times and streamlined workflows. 146 | - **Simplified Distribution**: Docker simplifies the sharing and distribution of applications through platforms like Docker Hub. 147 | - **Easy Application Deployment**: Docker images standardize the deployment process, making it consistent and reliable across different environments. 148 | 149 | --- 150 | 151 | ### 6. Installing Docker: Step-by-Step Guide 152 | 153 | Docker can be installed on various operating systems. Below are links to detailed installation guides: 154 | 155 | - [Docker for Mac](https://docs.docker.com/docker-for-mac/install/) 156 | - [Docker for Windows](https://docs.docker.com/v17.12/docker-for-windows/install/) 157 | - [Docker for Ubuntu](https://docs.docker.com/v17.12/install/linux/docker-ce/ubuntu/) 158 | - [Docker for Debian](https://docs.docker.com/v17.12/install/linux/docker-ce/debian/) 159 | - [Docker for CentOS](https://docs.docker.com/v17.12/install/linux/docker-ce/centos/) 160 | - [Docker Binaries](https://docs.docker.com/v17.12/install/linux/docker-ce/binaries/) 161 | 162 | --- 163 | 164 | ### 7. Essential Docker Commands Every Developer Should Know 165 | 166 | 1. **docker pull**: Pull an image from a registry. 167 | 168 | ```bash 169 | docker pull image_name:tag 170 | 171 | ``` 172 | 173 | 2. **docker build**: Build an image from a Dockerfile. 174 | 175 | ```bash 176 | docker build -t image_name . 177 | 178 | ``` 179 | 180 | 3. **docker run**: Create and start a container from an image. 181 | 182 | ```bash 183 | docker run -d -p 8080:80 image_name 184 | 185 | ``` 186 | 187 | 4. **docker ps**: List running containers. 188 | 189 | ```bash 190 | docker ps 191 | 192 | ``` 193 | 194 | 5. **docker stop**: Stop a running container. 195 | 196 | ```bash 197 | docker stop container_id 198 | 199 | ``` 200 | 201 | 6. **docker rm**: Remove one or more containers. 202 | 203 | ```bash 204 | docker rm container_id 205 | 206 | ``` 207 | 208 | 7. **docker rmi**: Remove one or more images. 209 | 210 | ```bash 211 | docker rmi image_id 212 | 213 | ``` 214 | 215 | 8. **docker exec**: Execute a command inside a running container. 216 | 217 | ```bash 218 | docker exec -it container_id bash 219 | 220 | ``` 221 | 222 | 9. **docker logs**: Fetch the logs of a container. 223 | 224 | ```bash 225 | docker logs container_id 226 | 227 | ``` 228 | 229 | 10. **docker images**: List all locally stored Docker images. 230 | 231 | ```bash 232 | docker images 233 | 234 | ``` 235 | 236 | 11. **docker-compose**: Define and run multi-container Docker applications using a YAML file. 237 | 238 | ```bash 239 | docker-compose up 240 | 241 | ``` 242 | 243 | 244 | --- 245 | 246 | ### 247 | 248 | 1. Building Images with Dockerfile: A Practical Guide 249 | 250 | Refer to the [Guide to Containers with Docker](https://github.com/cloudwithtanvir/Guide-to-Containers-with-Docker) for detailed steps on creating Dockerfiles and building images. 251 | 252 | --- 253 | 254 | ### 9. Running and Managing Docker Containers 255 | 256 | After building a Docker image, you can run containers using the `docker run` command. This section will cover advanced container management, including: 257 | 258 | - Starting, stopping, and restarting containers 259 | - Inspecting container logs and processes 260 | - Connecting containers to networks 261 | - Using volumes for data persistence 262 | 263 | --- 264 | 265 | ### 10. Demo Project Overview - Docker in Practice (Node.js App / Django App) 266 | 267 | This section provides a hands-on demo of Docker with a sample Node.js or Django application. It includes: 268 | 269 | - Creating a Dockerfile for the app 270 | - Building and running the Docker container 271 | - Accessing the app in a web browser 272 | - Making modifications and rebuilding the image 273 | 274 | --- 275 | 276 | ### 11. Introduction to Docker Swarm and Kubernetes 277 | 278 | An overview of container orchestration tools: 279 | 280 | - **Docker Swarm**: Native clustering and orchestration tool for Docker. 281 | - **Kubernetes**: A robust open-source platform for automating deployment, scaling, and operations of application containers. 282 | 283 | --- 284 | 285 | ### 12. Using a Private Docker Repository 286 | 287 | Steps to push Docker images to a private registry on AWS: 288 | 289 | - Setting up an Amazon ECR (Elastic Container Registry) 290 | - Authenticating Docker to AWS 291 | - Tagging and pushing images to ECR 292 | 293 | --- 294 | 295 | ### 13. Deploying Containerized Applications 296 | 297 | Strategies for deploying Docker containers to various environments: 298 | 299 | - Local servers 300 | - Cloud providers (AWS, Azure, Google Cloud) 301 | - Container orchestration platforms (Kubernetes) 302 | 303 | --- 304 | 305 | ### 14. Docker Networking: Effective Utilization 306 | 307 | Understanding Docker networking options: 308 | 309 | - Bridge networks 310 | - Host networks 311 | - Overlay networks 312 | - Configuring network settings for containers 313 | 314 | --- 315 | 316 | ### 15. Docker Volumes: Persisting Data 317 | 318 | Docker volumes provide a way to persist data generated by and used by Docker containers. This section covers: 319 | 320 | - Creating and managing volumes 321 | - Mounting volumes in containers 322 | - Use cases for data persistence 323 | 324 | --- 325 | 326 | ### 16. Volumes Demo: Persistence for Demo Project 327 | 328 | A practical demo of configuring persistence for the demo project: 329 | 330 | - Defining volumes in Docker Compose 331 | - Ensuring data survives container restarts 332 | - Best practices for data management 333 | 334 | --- 335 | 336 | ### 17. Docker Best Practices 337 | 338 | To maximize the benefits of using Docker, follow these best practices: 339 | 340 | - Keep Docker images small by using multi-stage builds. 341 | - Regularly update base images and dependencies. 342 | - Use .dockerignore to exclude unnecessary files. 343 | - Apply security best practices for Docker. 344 | - Regularly remove unused images, containers, and volumes. 345 | 346 | --- 347 | 348 | ### 18. Additional Learning Resources 349 | 350 | For further learning and mastering Docker, consider exploring the following resources: 351 | 352 | - [Docker Documentation](https://docs.docker.com/) 353 | - [Docker Tutorials on YouTube](https://www.youtube.com/results?search_query=docker+tutorials) 354 | - [Online Courses on Docker](https://www.udemy.com/topic/docker/) 355 | 356 | --- 357 | 358 | ### 19. Contact for Assistance 359 | 360 | If you encounter any issues or have any questions, feel free to reach out for assistance. 361 | 362 | --- 363 | 364 | This guide provides a comprehensive overview and practical insights into using Docker for containerization. By following the steps and best practices outlined, you can effectively manage and deploy containerized applications, enhancing your development workflow. -------------------------------------------------------------------------------- /Module 04 - A Practical Guide to Containers with Docker/Docker_Task_1.md: -------------------------------------------------------------------------------- 1 | **Task: Dockerize an Application** 2 | 3 | **Objective:** Dockerize an application based on your preferred stack to demonstrate containerization and deployment using Docker. 4 | 5 | **Steps:** 6 | 7 | 1. **Choose Your Stack:** Select the programming language, framework, and any additional tools or libraries you prefer for your application. 8 | 9 | 2. **Develop Your Application:** Create a simple application using your chosen stack. It could be a web application, a REST API, or any other type of application you're comfortable with. 10 | 11 | 3. **Write a Dockerfile:** Create a Dockerfile to define the environment and dependencies needed to run your application within a Docker container. Ensure that you include all necessary configurations and instructions for building the image. 12 | 13 | 4. **Build the Docker Image:** Use the Dockerfile to build a Docker image for your application. Test the image locally to ensure it runs as expected within a container. 14 | 15 | 5. **Containerize Your Application:** Run your application as a Docker container using the Docker image you built. Verify that the containerized application behaves as expected and can be accessed from a web browser or any other client if applicable. 16 | 17 | 6. **Optimize Docker Configuration (Optional):** Fine-tune your Docker configuration for better performance, security, or scalability if needed. This could involve adjusting container resource limits, optimizing Dockerfile instructions, or implementing best practices for Docker deployment. 18 | 19 | 7. **Push to a Git Repository:** Once you're satisfied with your Dockerized application, push the Dockerfile and any other necessary files to a Git repository of your choice. Make sure to include clear instructions for building and running the Docker image in the repository's README file. 20 | 21 | 8. **Share the Repository Link:** Share the link to your Git repository containing the Dockerized application under the "solution" folder in a Markdown (.md) file named "repo_link.md". 22 | 23 | **Deliverables:** 24 | 25 | - Dockerfile: Defines the Docker image for your application. 26 | - Source Code: Includes all the files and code necessary to build and run your application. 27 | - README.md: Provides instructions for building and running the Docker image, as well as any other relevant information about your application. 28 | - repo_link.md: Contains the link to your Git repository under the "solution" folder. 29 | 30 | Feel free to reach out if you have any questions or need further assistance! 31 | -------------------------------------------------------------------------------- /Module 04 - A Practical Guide to Containers with Docker/Solution_Docker: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Module 04 - A Practical Guide to Containers with Docker/docker_solution.md: -------------------------------------------------------------------------------- 1 | ## Harun 2 | 3 | https://github.com/harun77/angular-docker 4 | 5 | ## Sabit 6 | 7 | https://github.com/MS-Jahan/django-docker 8 | -------------------------------------------------------------------------------- /Module 04 - A Practical Guide to Containers with Docker/task1_guide.md: -------------------------------------------------------------------------------- 1 | ### Task: Create and Dockerize Your Favorite Tech Stack Project 2 | 3 | #### Prerequisites: 4 | 1. Ensure Docker is installed on your machine. 5 | 2. Ensure you have any other necessary prerequisites installed for your chosen stack (e.g., Node.js, Python, etc.). 6 | 3. Ensure you have a GitHub account. 7 | 8 | #### Steps: 9 | 10 | 1. **Install Docker**: 11 | - **For Windows**: 12 | 1. Download Docker Desktop from [Docker's official website](https://www.docker.com/products/docker-desktop). 13 | 2. Run the installer and follow the installation instructions. 14 | - **For macOS**: 15 | 1. Download Docker Desktop from [Docker's official website](https://www.docker.com/products/docker-desktop). 16 | 2. Drag Docker to your Applications folder and launch it. 17 | - **For Linux**: 18 | 1. Follow the official installation guide for your specific distribution from the [Docker documentation](https://docs.docker.com/engine/install/). 19 | 20 | 2. **Choose Your Stack**: 21 | - Decide on the tech stack you want to use (e.g., Node.js, Django, Flask, Ruby on Rails, etc.). 22 | 23 | 3. **Set Up Your Project**: 24 | - Follow the setup instructions for your chosen stack. Here are examples for two popular stacks: 25 | 26 | **Example 1: Node.js with Express** 27 | - Create a project directory and navigate into it: 28 | ```bash 29 | mkdir my-nodejs-app 30 | cd my-nodejs-app 31 | ``` 32 | - Initialize a new Node.js project: 33 | ```bash 34 | npm init -y 35 | ``` 36 | - Install Express.js: 37 | ```bash 38 | npm install express 39 | ``` 40 | - Create an `index.js` file and add the following code: 41 | ```javascript 42 | const express = require('express'); 43 | const app = express(); 44 | const PORT = 3000; 45 | 46 | app.get('/', (req, res) => { 47 | res.send('Hello World!'); 48 | }); 49 | 50 | app.listen(PORT, () => { 51 | console.log(`Server is running on http://localhost:${PORT}`); 52 | }); 53 | ``` 54 | - Update `package.json` to include a start script: 55 | ```json 56 | "scripts": { 57 | "start": "node index.js" 58 | } 59 | ``` 60 | 61 | **Example 2: Django** 62 | - Create a project directory and navigate into it: 63 | ```bash 64 | mkdir my-django-app 65 | cd my-django-app 66 | ``` 67 | - Create a virtual environment and activate it: 68 | ```bash 69 | python3 -m venv venv 70 | source venv/bin/activate 71 | ``` 72 | - Install Django: 73 | ```bash 74 | pip install django 75 | ``` 76 | - Start a new Django project: 77 | ```bash 78 | django-admin startproject myproject . 79 | ``` 80 | - Run the development server to ensure it's working: 81 | ```bash 82 | python manage.py runserver 83 | ``` 84 | 85 | 4. **Create a Dockerfile**: 86 | - In the root of your project directory, create a `Dockerfile` and add the appropriate content based on your stack. 87 | 88 | **Example Dockerfile for Node.js**: 89 | ```dockerfile 90 | # Use the official Node.js image 91 | FROM node:14 92 | 93 | # Create and change to the app directory 94 | WORKDIR /usr/src/app 95 | 96 | # Copy application dependency manifests to the container image 97 | COPY package*.json ./ 98 | 99 | # Install dependencies 100 | RUN npm install 101 | 102 | # Copy the local code to the container image 103 | COPY . . 104 | 105 | # Expose the port the app runs on 106 | EXPOSE 3000 107 | 108 | # Run the web service on container startup 109 | CMD [ "npm", "start" ] 110 | ``` 111 | 112 | **Example Dockerfile for Django**: 113 | ```dockerfile 114 | # Use the official Python image 115 | FROM python:3.9 116 | 117 | # Set environment variables 118 | ENV PYTHONDONTWRITEBYTECODE 1 119 | ENV PYTHONUNBUFFERED 1 120 | 121 | # Create and change to the app directory 122 | WORKDIR /usr/src/app 123 | 124 | # Install dependencies 125 | COPY requirements.txt . 126 | RUN pip install -r requirements.txt 127 | 128 | # Copy the local code to the container image 129 | COPY . . 130 | 131 | # Expose the port the app runs on 132 | EXPOSE 8000 133 | 134 | # Run the web service on container startup 135 | CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] 136 | ``` 137 | 138 | 5. **Create a `.dockerignore` File**: 139 | - In the root of your project directory, create a `.dockerignore` file and add the appropriate content. 140 | 141 | **Example `.dockerignore` for Node.js**: 142 | ```plaintext 143 | node_modules 144 | npm-debug.log 145 | ``` 146 | 147 | **Example `.dockerignore` for Django**: 148 | ```plaintext 149 | __pycache__ 150 | *.pyc 151 | .env 152 | venv 153 | ``` 154 | 155 | 6. **Add a README.md File**: 156 | - In the root of your project directory, create a `README.md` file and add the following content: 157 | ```markdown 158 | # Project Name 159 | 160 | This is a simple application running inside a Docker container. 161 | 162 | ## Prerequisites 163 | 164 | - Docker installed on your machine. 165 | 166 | ## Running the application 167 | 168 | 1. Build the Docker image: 169 | ```bash 170 | docker build -t my-app . 171 | ``` 172 | 173 | 2. Run the Docker container: 174 | ```bash 175 | docker run -p 3000:3000 my-app 176 | ``` 177 | 178 | 3. Open your browser and go to `http://localhost:3000` (or the appropriate port) to see the application running. 179 | ``` 180 | 181 | 7. **Push the Project to GitHub**: 182 | - Create a new repository on GitHub named appropriately for your project. 183 | - Initialize a git repository, add files, commit, and push to GitHub: 184 | ```bash 185 | git init 186 | git add . 187 | git commit -m "Initial commit" 188 | git branch -M main 189 | git remote add origin https://github.com/your-username/my-project.git 190 | git push -u origin main 191 | ``` 192 | 193 | 8. **Build and Run the Docker Container**: 194 | - Build the Docker image: 195 | ```bash 196 | docker build -t my-app . 197 | ``` 198 | - Run the Docker container: 199 | ```bash 200 | docker run -p 3000:3000 my-app 201 | ``` 202 | - Open your browser and navigate to `http://localhost:3000` (or the appropriate port) to see the application running. 203 | 204 | ### Example: 205 | To provide a complete example, here's a summary of the steps with a Node.js application. 206 | 207 | 1. **Create a Node.js Project**: 208 | ```bash 209 | mkdir my-nodejs-app 210 | cd my-nodejs-app 211 | npm init -y 212 | npm install express 213 | ``` 214 | 215 | 2. **Create `index.js`**: 216 | ```javascript 217 | const express = require('express'); 218 | const app = express(); 219 | const PORT = 3000; 220 | 221 | app.get('/', (req, res) => { 222 | res.send('Hello World!'); 223 | }); 224 | 225 | app.listen(PORT, () => { 226 | console.log(`Server is running on http://localhost:${PORT}`); 227 | }); 228 | ``` 229 | 230 | 3. **Update `package.json`**: 231 | ```json 232 | "scripts": { 233 | "start": "node index.js" 234 | } 235 | ``` 236 | 237 | 4. **Create Dockerfile**: 238 | ```dockerfile 239 | FROM node:14 240 | WORKDIR /usr/src/app 241 | COPY package*.json ./ 242 | RUN npm install 243 | COPY . . 244 | EXPOSE 3000 245 | CMD [ "npm", "start" ] 246 | ``` 247 | 248 | 5. **Create `.dockerignore`**: 249 | ```plaintext 250 | node_modules 251 | npm-debug.log 252 | ``` 253 | 254 | 6. **Create `README.md`**: 255 | ```markdown 256 | # My Node.js App 257 | 258 | This is a simple Node.js application running inside a Docker container. 259 | 260 | ## Prerequisites 261 | 262 | - Docker installed on your machine. 263 | 264 | ## Running the application 265 | 266 | 1. Build the Docker image: 267 | ```bash 268 | docker build -t my-nodejs-app . 269 | ``` 270 | 271 | 2. Run the Docker container: 272 | ```bash 273 | docker run -p 3000:3000 my-nodejs-app 274 | ``` 275 | 276 | 3. Open your browser and go to `http://localhost:3000` to see the application running. 277 | ``` 278 | 279 | 7. **Push to GitHub**: 280 | ```bash 281 | git init 282 | git add . 283 | git commit -m "Initial commit" 284 | git branch -M main 285 | git remote add origin https://github.com/your-username/my-nodejs-app.git 286 | git push -u origin main 287 | ``` 288 | 289 | 8. **Build and Run Docker Container**: 290 | ```bash 291 | docker build -t my-nodejs-app . 292 | docker run -p 3000:3000 my-nodejs-app 293 | ``` 294 | 295 | By following these instructions, you can pick any stack you love, Dockerize it, and push the project to GitHub. The provided Node.js example illustrates the general steps you would follow for any tech stack. 296 | -------------------------------------------------------------------------------- /Module 05 - Continuous integration (CI) and continuous delivery (CD)/01 Automating Docker Image Build and Push to Docker Hub.md: -------------------------------------------------------------------------------- 1 | # Streamlining Development with CI/CD: Automating Docker Image Build and Push to Docker Hub 2 | 3 | In modern software development, speed, efficiency, and reliability are paramount. Continuous Integration and Continuous Deployment (CI/CD) practices have emerged as essential methodologies to meet these demands. By automating the integration, testing, and deployment of code, CI/CD pipelines help developers catch bugs early, deploy faster, and ensure consistent quality. This article explores the benefits of CI/CD, introduces popular CI/CD platforms, explains GitHub Actions, and provides a step-by-step guide on using GitHub Actions to build and push Docker images to Docker Hub. 4 | 5 | ## What is CI/CD? 6 | 7 | **Continuous Integration (CI)** is the practice of automatically integrating code changes from multiple contributors into a shared repository. CI involves automated building and testing to ensure that code changes do not introduce new bugs. 8 | 9 | **Continuous Deployment (CD)** extends CI by automating the deployment of code changes to production environments. CD ensures that validated changes are automatically deployed to users, enabling rapid iteration and feedback. 10 | 11 | ### Benefits of CI/CD 12 | 13 | 1. **Faster Development Cycles**: Automating the build, test, and deployment process speeds up the development cycle, allowing for more frequent releases. 14 | 2. **Improved Code Quality**: Automated testing catches bugs early in the development process, reducing the likelihood of issues in production. 15 | 3. **Reduced Manual Errors**: Automation minimizes the risk of human error during the build and deployment process. 16 | 4. **Consistent Releases**: Automated pipelines ensure that every deployment follows the same steps, resulting in consistent and reliable releases. 17 | 5. **Enhanced Collaboration**: CI/CD facilitates collaboration among team members by providing real-time feedback on code changes and reducing integration conflicts. 18 | 19 | ## Popular CI/CD Platforms 20 | 21 | Several CI/CD platforms are widely used in the industry, each offering unique features and integrations. Here are some of the most popular ones: 22 | 23 | ### 1. GitHub Actions 24 | - **Integration**: Seamlessly integrates with GitHub repositories. 25 | - **Customization**: Supports custom workflows using YAML configuration. 26 | - **Marketplace**: Access to pre-built actions and workflows. 27 | - **Example Use Case**: Automating tests and deployments for a web application. 28 | 29 | ### 2. Jenkins 30 | - **Open Source**: Widely used open-source automation server. 31 | - **Plugins**: Extensive plugin ecosystem for various integrations. 32 | - **Pipeline as Code**: Define build pipelines using Jenkinsfile. 33 | - **Example Use Case**: Complex build pipelines for large-scale enterprise applications. 34 | 35 | ### 3. GitLab CI/CD 36 | - **Integration**: Native CI/CD solution within GitLab. 37 | - **Pipeline as Code**: Define CI/CD pipelines using `.gitlab-ci.yml`. 38 | - **Built-in Features**: Includes code review, issue tracking, and CI/CD in a single platform. 39 | - **Example Use Case**: End-to-end DevOps lifecycle management. 40 | 41 | ### 4. CircleCI 42 | - **Cloud and On-Premises**: Offers both cloud-hosted and on-premises solutions. 43 | - **Customization**: Highly configurable build environments. 44 | - **Performance**: Optimized for fast builds and parallelism. 45 | - **Example Use Case**: Rapidly iterating on mobile application development. 46 | 47 | ### 5. Travis CI 48 | - **Ease of Use**: Simple setup with `.travis.yml` configuration. 49 | - **Integration**: Supports GitHub, Bitbucket, and more. 50 | - **Free for Open Source**: Popular among open-source projects. 51 | - **Example Use Case**: Automating tests and deployments for open-source libraries. 52 | 53 | ### 6. Azure Pipelines 54 | - **Integration**: Part of Azure DevOps services. 55 | - **Multi-Platform**: Supports Windows, Linux, and macOS. 56 | - **Scalability**: Highly scalable for large enterprise projects. 57 | - **Example Use Case**: CI/CD for applications deployed on Azure. 58 | 59 | ### 7. Bitbucket Pipelines 60 | - **Integration**: Native CI/CD for Bitbucket repositories. 61 | - **Ease of Use**: Simple YAML configuration. 62 | - **Built-in Features**: Integrated with Bitbucket’s code review and issue tracking. 63 | - **Example Use Case**: CI/CD for small to medium-sized teams using Bitbucket. 64 | 65 | ### 8. AWS CodePipeline 66 | - **Integration**: Part of AWS suite of DevOps tools. 67 | - **Automation**: Automates build, test, and deploy phases. 68 | - **Scalability**: Seamlessly scales with AWS infrastructure. 69 | - **Example Use Case**: Automating deployments for AWS-hosted applications. 70 | 71 | ## Introduction to GitHub Actions 72 | 73 | GitHub Actions is a powerful CI/CD tool that integrates seamlessly with GitHub repositories. It allows you to automate workflows, including building and pushing Docker images. 74 | 75 | ### Key Features of GitHub Actions 76 | 77 | 1. **Integration**: Directly integrated with GitHub repositories, making it easy to trigger workflows based on GitHub events such as pushes and pull requests. 78 | 2. **Customization**: Supports custom workflows defined using YAML configuration files, enabling flexible and powerful CI/CD pipelines. 79 | 3. **Marketplace**: Provides access to a marketplace of pre-built actions and workflows, allowing you to easily incorporate common tasks and integrations into your pipelines. 80 | 4. **Scalability**: Capable of scaling with your projects, handling everything from small scripts to complex multi-step workflows. 81 | 82 | ## Automating Docker Image Build and Push with GitHub Actions 83 | 84 | This section provides a step-by-step guide to creating a GitHub Actions workflow for building and pushing Docker images to a private Docker Hub repository using Docker Compose. 85 | 86 | ### Prerequisites 87 | 88 | - A GitHub repository. 89 | - A Docker Hub account. 90 | - Docker installed on your local machine. 91 | - A `docker-compose.yml` file to define your Docker services. 92 | 93 | ### Step 1: Create a Docker Compose File 94 | 95 | First, define your Docker services in a `docker-compose.yml` file. Here’s an example: 96 | 97 | ```yaml 98 | version: '3.8' 99 | 100 | services: 101 | server: 102 | build: 103 | context: . 104 | ports: 105 | - 8000:8000 106 | ``` 107 | 108 | This file defines a service named `server` that builds its image from the current directory and maps port 8000 on the host to port 8000 in the container. 109 | 110 | ### Step 2: Create a GitHub Actions Workflow 111 | 112 | Create a new directory called `.github/workflows` in your repository and add a YAML file (e.g., `docker-compose-publish.yml`) with the following content: 113 | 114 | ```yaml 115 | name: Build and Push Docker Image using Docker Compose 116 | 117 | on: 118 | push: 119 | branches: 120 | - main 121 | 122 | jobs: 123 | build: 124 | runs-on: ubuntu-latest 125 | 126 | steps: 127 | - name: Checkout code 128 | uses: actions/checkout@v2 129 | 130 | - name: Set up Docker Buildx 131 | uses: docker/setup-buildx-action@v2 132 | 133 | - name: Log in to Docker Hub 134 | uses: docker/login-action@v2 135 | with: 136 | username: ${{ secrets.DOCKER_HUB_USERNAME }} 137 | password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} 138 | 139 | - name: Set up Docker Compose 140 | run: sudo apt-get update && sudo apt-get install -y docker-compose 141 | 142 | - name: Build Docker image 143 | run: docker-compose build 144 | 145 | - name: Tag Docker image 146 | run: docker tag server:latest ${{ secrets.DOCKER_HUB_USERNAME }}/my-private-repo:latest 147 | 148 | - name: Push Docker image 149 | run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/my-private-repo:latest 150 | ``` 151 | 152 | ### Step 3: Configure Secrets 153 | 154 | To securely store your Docker Hub credentials, add the following secrets to your GitHub repository: 155 | 156 | 1. `DOCKER_HUB_USERNAME`: Your Docker Hub username. 157 | 2. `DOCKER_HUB_ACCESS_TOKEN`: Your Docker Hub access token. 158 | 159 | To add secrets, navigate to your repository on GitHub, go to `Settings` > `Secrets and variables` > `Actions`, and click `New repository secret`. 160 | 161 | ### Step 4: Push Changes and Trigger Workflow 162 | 163 | Push your changes to the `main` branch of your repository. The GitHub Actions workflow will trigger automatically, performing the following steps: 164 | 165 | 1. **Checkout Code**: Uses `actions/checkout` to check out the repository code. 166 | 2. **Set Up Docker Buildx**: Uses `docker/setup-buildx-action` to set up Docker Buildx. 167 | 3. **Log In to Docker Hub**: Uses `docker/login-action` to log into Docker Hub using the provided credentials. 168 | 4. **Set Up Docker Compose**: Installs Docker Compose on the runner. 169 | 5. **Build Docker Image**: Runs `docker-compose build` to build the Docker image. 170 | 6. **Tag Docker Image**: Tags the built image with the specified tag. 171 | 7. **Push Docker Image**: Pushes the tagged image to Docker Hub. 172 | 173 | ## Conclusion 174 | 175 | CI/CD practices are essential for modern software development, providing faster development cycles, improved code quality, and reduced manual errors. By using GitHub Actions to automate the build and push of Docker images to Docker Hub, you can streamline your development workflow and ensure consistent, reliable deployments. 176 | 177 | Implementing CI/CD with GitHub Actions and Docker Compose not only enhances productivity but also fosters a culture of collaboration and continuous improvement. Embrace CI/CD to accelerate your development process and deliver high-quality software with confidence. -------------------------------------------------------------------------------- /Module 05 - Continuous integration (CI) and continuous delivery (CD)/How to set up CI/CD for deploying a static project to AWS S3 and CloudFront using GitHub Actions.md: -------------------------------------------------------------------------------- 1 | Here's a complete step-by-step guide on how to set up CI/CD for deploying a React project to AWS S3 and CloudFront using GitHub Actions. This guide will cover creating the necessary AWS resources and configuring the GitHub Actions workflow. 2 | 3 | ### Prerequisites 4 | 5 | 1. **AWS Account**: Make sure you have an AWS account. 6 | 2. **GitHub Repository**: Ensure your React project is hosted in a GitHub repository. 7 | 3. **AWS CLI**: Install the AWS CLI on your local machine for initial setup. 8 | 9 | ### Step 1: Create S3 Bucket 10 | 11 | 1. **Login to AWS Management Console**. 12 | 2. **Navigate to S3 Service**: 13 | - Open the AWS Management Console. 14 | - Search for "S3" and select it. 15 | 16 | 3. **Create a Bucket**: 17 | - Click on "Create bucket". 18 | - Enter a unique bucket name (e.g., `my-react-app-bucket`). 19 | - Choose a region. 20 | - Uncheck "Block all public access". 21 | - Click "Create bucket". 22 | 23 | 4. **Bucket Policy**: 24 | - Go to the "Permissions" tab of your bucket. 25 | - Add the following bucket policy to allow public read access: 26 | ```json 27 | { 28 | "Version": "2012-10-17", 29 | "Statement": [ 30 | { 31 | "Sid": "PublicReadGetObject", 32 | "Effect": "Allow", 33 | "Principal": "*", 34 | "Action": "s3:GetObject", 35 | "Resource": "arn:aws:s3:::my-react-app-bucket/*" 36 | } 37 | ] 38 | } 39 | ``` 40 | - Replace `my-react-app-bucket` with your bucket name. 41 | 42 | ### Step 2: Create CloudFront Distribution 43 | 44 | 1. **Navigate to CloudFront Service**: 45 | - In the AWS Management Console, search for "CloudFront" and select it. 46 | 47 | 2. **Create a Distribution**: 48 | - Click on "Create Distribution". 49 | - Under "Origin Domain", enter your S3 bucket endpoint (e.g., `my-react-app-bucket.s3.amazonaws.com`). 50 | - Leave other settings as default or adjust as needed. 51 | - Click "Create Distribution". 52 | 53 | 3. **Get Distribution ID**: 54 | - Once created, note down the CloudFront Distribution ID from the distribution list. 55 | 56 | ### Step 3: Configure AWS IAM User for GitHub Actions 57 | 58 | 1. **Navigate to IAM Service**: 59 | - In the AWS Management Console, search for "IAM" and select it. 60 | 61 | 2. **Create a User**: 62 | - Click on "Users" and then "Add user". 63 | - Enter a username (e.g., `github-actions-user`). 64 | - Select "Programmatic access". 65 | - Click "Next: Permissions". 66 | 67 | 3. **Attach Policies**: 68 | - Attach the following policies: 69 | - `AmazonS3FullAccess` 70 | - `CloudFrontFullAccess` 71 | - Click "Next: Tags", then "Next: Review", and finally "Create user". 72 | 73 | 4. **Save Credentials**: 74 | - Save the `Access Key ID` and `Secret Access Key`. You will need these for GitHub secrets. 75 | 76 | ### Step 4: Add GitHub Secrets 77 | 78 | 1. **Navigate to Your GitHub Repository**. 79 | 2. **Add Secrets**: 80 | - Go to "Settings" > "Secrets and variables" > "Actions". 81 | - Add the following secrets: 82 | - `AWS_ACCESS_KEY_ID`: Your IAM user Access Key ID. 83 | - `AWS_SECRET_ACCESS_KEY`: Your IAM user Secret Access Key. 84 | - `AWS_S3_BUCKET`: Your S3 bucket name. 85 | - `CLOUDFRONT_DISTRIBUTION_ID`: Your CloudFront distribution ID. 86 | 87 | ### Step 5: Create GitHub Actions Workflow 88 | 89 | 1. **Create Workflow File**: 90 | - In your repository, create a `.github/workflows/deploy.yml` file. 91 | 92 | 2. **Add the Following Workflow Configuration**: 93 | 94 | ```yaml 95 | name: Deploy React App to AWS S3 and CloudFront 96 | 97 | on: 98 | push: 99 | branches: 100 | - main # Change this to your main branch if different 101 | 102 | jobs: 103 | build-and-deploy: 104 | runs-on: ubuntu-latest 105 | 106 | steps: 107 | - name: Checkout code 108 | uses: actions/checkout@v3 109 | 110 | - name: Set up Node.js 111 | uses: actions/setup-node@v3 112 | with: 113 | node-version: '16' # Use the Node.js version required by your project 114 | 115 | - name: Install dependencies 116 | run: npm install --legacy-peer-deps 117 | 118 | - name: Build project 119 | run: npm run build 120 | 121 | - name: Deploy to S3 122 | run: | 123 | aws s3 sync build s3://${{ secrets.AWS_S3_BUCKET }} --delete 124 | env: 125 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 126 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 127 | AWS_REGION: us-east-1 # Change this to your S3 bucket region 128 | 129 | - name: Invalidate CloudFront cache 130 | run: | 131 | aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" 132 | env: 133 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 134 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 135 | AWS_REGION: us-east-1 # Change this to your CloudFront distribution region 136 | 137 | 138 | ``` 139 | 140 | ### Step 6: Test the Workflow 141 | 142 | 1. **Push Changes**: 143 | - Commit and push the changes to your GitHub repository. 144 | - The workflow will trigger on push to the `main` branch. 145 | 146 | 2. **Verify Deployment**: 147 | - Check the GitHub Actions tab to ensure the workflow completes successfully. 148 | - Visit your CloudFront URL to see your deployed React application. 149 | 150 | ### Conclusion 151 | 152 | By following these steps, you have set up a CI/CD pipeline that deploys your React application to AWS S3 and CloudFront using GitHub Actions. This ensures that every time you push changes to your main branch, your application is automatically built and deployed, providing a seamless and automated deployment process. 153 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DevOps-bootcamp 2 | Welcome to the DevOps Bootcamp by Level Up with Tech! This repository contains resources, code samples, assignments, and notes curated by Tanvir to help you master DevOps. Subscribe for updates and elevate your skills with us! 3 | 4 | 5 | 6 | [DevOps Bootcamp - Outline](https://github.com/cloudwithtanvir/DevOps-bootcamp/blob/85bb44a780323c390ebf24c30fb1b7ecb39e3f2c/00_DevOps%20Bootcamp%20Outline.md) 7 | 8 | [How to submit solution](How%20to%20submit%20solution.md) 9 | 10 | [Module 1: Introduction to DevOps](Module%2001:%20Introduction%20to%20DevOps/01_Module%201:%20Introduction%20to%20DevOps.md) 11 | 12 | 13 | [Module 02: Linux Fundamentals](Module%2002:%20Linux%20Fundamentals/Module%2002:%20Linux%20Fundamentals.md) 14 | 15 | 16 | 17 | 18 | --------------------------------------------------------------------------------