From c3f35a16f290b87312e637dcfa3f6768f2f65348 Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Tue, 3 Sep 2024 13:24:52 +0530 Subject: [PATCH 01/18] fix: Docker scanner workflow --- .github/workflows/docker-scanner.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-scanner.yaml b/.github/workflows/docker-scanner.yaml index 5c4c9c8..25cacd4 100644 --- a/.github/workflows/docker-scanner.yaml +++ b/.github/workflows/docker-scanner.yaml @@ -7,12 +7,12 @@ permissions: statuses: write on: - workflow_dispatch: + pull_request: jobs: docker-scanner: uses: clouddrove/github-shared-workflows/.github/workflows/docker-scanner.yml@1.2.7 with: severity: "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" - dockerfile-path: "./docker/Dockerfile" + dockerfile-path: "./.docker/Dockerfile" security-upload: "true" From 4711041b950b00c0da273446fd80189555a53752 Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Tue, 3 Sep 2024 13:37:32 +0530 Subject: [PATCH 02/18] fix: Update working directory for docker scanner workflow --- .github/workflows/docker-scanner.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-scanner.yaml b/.github/workflows/docker-scanner.yaml index 25cacd4..4dc88ce 100644 --- a/.github/workflows/docker-scanner.yaml +++ b/.github/workflows/docker-scanner.yaml @@ -14,5 +14,8 @@ jobs: uses: clouddrove/github-shared-workflows/.github/workflows/docker-scanner.yml@1.2.7 with: severity: "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" - dockerfile-path: "./.docker/Dockerfile" + dockerfile-path: "Dockerfile" security-upload: "true" + defaults: + run: + working-directory: ./.docker \ No newline at end of file From 14a09f9b6d2446a281082a157ed1937ad92206a7 Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Tue, 3 Sep 2024 13:40:48 +0530 Subject: [PATCH 03/18] fix: Update workflow triggers --- .github/workflows/docker-scanner.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/docker-scanner.yaml b/.github/workflows/docker-scanner.yaml index 4dc88ce..155e458 100644 --- a/.github/workflows/docker-scanner.yaml +++ b/.github/workflows/docker-scanner.yaml @@ -8,6 +8,10 @@ permissions: on: pull_request: + types: + - opened + - synchronize + - reopened jobs: docker-scanner: From 3bc87aeaf81ba869262e419d76d6ccbcde7d30a0 Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Tue, 3 Sep 2024 13:45:36 +0530 Subject: [PATCH 04/18] fix: fixed directory --- .github/workflows/docker-scanner.yaml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-scanner.yaml b/.github/workflows/docker-scanner.yaml index 155e458..25cccab 100644 --- a/.github/workflows/docker-scanner.yaml +++ b/.github/workflows/docker-scanner.yaml @@ -15,11 +15,16 @@ on: jobs: docker-scanner: - uses: clouddrove/github-shared-workflows/.github/workflows/docker-scanner.yml@1.2.7 - with: - severity: "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" - dockerfile-path: "Dockerfile" - security-upload: "true" - defaults: - run: - working-directory: ./.docker \ No newline at end of file + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Change directory to ./.docker and run docker-scanner + run: | + cd ./.docker + dockerfile-path="Dockerfile" + uses: clouddrove/github-shared-workflows/.github/workflows/docker-scanner.yml@1.2.7 + with: + severity: "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" + dockerfile-path: "./Dockerfile" + security-upload: "true" \ No newline at end of file From 22ad2f4f0999559ccb598c74a731250cade0b5fd Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Tue, 3 Sep 2024 13:59:43 +0530 Subject: [PATCH 05/18] fix: fix docker file path --- .github/workflows/docker-scanner.yaml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docker-scanner.yaml b/.github/workflows/docker-scanner.yaml index 25cccab..c713709 100644 --- a/.github/workflows/docker-scanner.yaml +++ b/.github/workflows/docker-scanner.yaml @@ -15,16 +15,8 @@ on: jobs: docker-scanner: - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Change directory to ./.docker and run docker-scanner - run: | - cd ./.docker - dockerfile-path="Dockerfile" - uses: clouddrove/github-shared-workflows/.github/workflows/docker-scanner.yml@1.2.7 - with: - severity: "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" - dockerfile-path: "./Dockerfile" - security-upload: "true" \ No newline at end of file + uses: clouddrove/github-shared-workflows/.github/workflows/docker-scanner.yml@1.2.7 + with: + severity: "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" + dockerfile-path: "./.docker/." + security-upload: "true" \ No newline at end of file From 133d65e1aa690ce4def588a38a36cc32ba506193 Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Tue, 3 Sep 2024 14:05:45 +0530 Subject: [PATCH 06/18] fix: Update dockerfile --- .docker/Dockerfile | 4 ++-- .github/workflows/docker-scanner.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 8f8d0db..10e1036 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -76,8 +76,8 @@ RUN apt install -y \ # ZSH -ADD ./etc/install-zsh.sh /root/install-zsh.sh -ADD ./etc/install-zsh.sh /home/ubuntu/install-zsh.sh +COPY ./etc/install-zsh.sh /root/install-zsh.sh +COPY ./etc/install-zsh.sh /home/ubuntu/install-zsh.sh RUN chmod +x /root/install-zsh.sh RUN chmod +x /home/ubuntu/install-zsh.sh diff --git a/.github/workflows/docker-scanner.yaml b/.github/workflows/docker-scanner.yaml index c713709..2b76c5a 100644 --- a/.github/workflows/docker-scanner.yaml +++ b/.github/workflows/docker-scanner.yaml @@ -18,5 +18,5 @@ jobs: uses: clouddrove/github-shared-workflows/.github/workflows/docker-scanner.yml@1.2.7 with: severity: "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" - dockerfile-path: "./.docker/." + dockerfile-path: "./.docker/Dockerfile" security-upload: "true" \ No newline at end of file From 28684ef0a91ca900f9e23074bf39f0f1eed71225 Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Tue, 3 Sep 2024 14:08:11 +0530 Subject: [PATCH 07/18] fix: revert COPY to ADD --- .docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 10e1036..8f8d0db 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -76,8 +76,8 @@ RUN apt install -y \ # ZSH -COPY ./etc/install-zsh.sh /root/install-zsh.sh -COPY ./etc/install-zsh.sh /home/ubuntu/install-zsh.sh +ADD ./etc/install-zsh.sh /root/install-zsh.sh +ADD ./etc/install-zsh.sh /home/ubuntu/install-zsh.sh RUN chmod +x /root/install-zsh.sh RUN chmod +x /home/ubuntu/install-zsh.sh From ece0d1254091ff4193d2b4707fa93a1682339b0e Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Tue, 3 Sep 2024 14:18:30 +0530 Subject: [PATCH 08/18] feat: Added sanity checks workflow --- .github/workflows/sanity-check.yaml | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/sanity-check.yaml diff --git a/.github/workflows/sanity-check.yaml b/.github/workflows/sanity-check.yaml new file mode 100644 index 0000000..13ebfc2 --- /dev/null +++ b/.github/workflows/sanity-check.yaml @@ -0,0 +1,42 @@ +name: Build and Test + +on: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ~/devops-machine + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build the application image + run: docker build -t clouddrove/devops:0.0.${{ github.run_number }} ./docker-image/. + + - name: Bring container up and running + run: docker run --name devops -d clouddrove/devops:0.0.${{ github.run_number }} + + - name: Wait for container to boot up + run: sleep 10 + + - name: Sanity check + run: | + # Get the latest versions + LATEST_TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version) + + # Get the installed versions + INSTALLED_TERRAFORM_VERSION=$(docker exec devops terraform version -json | jq -r .terraform_version) + + # Compare versions + + if [ "$LATEST_TERRAFORM_VERSION" != "$INSTALLED_TERRAFORM_VERSION" ]; then + echo "Terraform version mismatch: expected $LATEST_TERRAFORM_VERSION, got $INSTALLED_TERRAFORM_VERSION" + exit 1 + fi \ No newline at end of file From d52b137a6a5430fafb08e2c34a9f1c3c0443997d Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Tue, 3 Sep 2024 14:20:37 +0530 Subject: [PATCH 09/18] fix: Working directory for sanity check workflow --- .github/workflows/sanity-check.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/sanity-check.yaml b/.github/workflows/sanity-check.yaml index 13ebfc2..c62c2a3 100644 --- a/.github/workflows/sanity-check.yaml +++ b/.github/workflows/sanity-check.yaml @@ -1,4 +1,4 @@ -name: Build and Test +name: Sanity_Checks on: pull_request: @@ -6,9 +6,6 @@ on: jobs: build: runs-on: ubuntu-latest - defaults: - run: - working-directory: ~/devops-machine steps: - name: Checkout code From 030f5f5b3e0267666f648031644c7946bcea793e Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Tue, 3 Sep 2024 14:37:35 +0530 Subject: [PATCH 10/18] fix: fixed sanity checks workflow --- .github/workflows/sanity-check.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sanity-check.yaml b/.github/workflows/sanity-check.yaml index c62c2a3..50cfe4e 100644 --- a/.github/workflows/sanity-check.yaml +++ b/.github/workflows/sanity-check.yaml @@ -9,13 +9,13 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3.6.1 - name: Build the application image - run: docker build -t clouddrove/devops:0.0.${{ github.run_number }} ./docker-image/. + run: docker build -t clouddrove/devops:0.0.${{ github.run_number }} ./.docker/. - name: Bring container up and running run: docker run --name devops -d clouddrove/devops:0.0.${{ github.run_number }} From 404bd81107ec8cf101def8c50d8559c0e3b3089f Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Wed, 4 Sep 2024 15:01:53 +0530 Subject: [PATCH 11/18] Feat/enigma (#9) * Update Dockerfile * Update Dockerfile * testing enigma workflow * Update enigma-docker.yml * test * Update enigma-docker.yml * test * Update enigma-docker.yml * Update enigma-docker.yml * Update enigma-docker.yml removed commented lines * Update docker-scanner.yaml to 1.2.8 --------- Co-authored-by: Vishwajit Nagulkar <119565952+VishwajitNagulkar@users.noreply.github.com> --- .docker/Dockerfile | 6 ++-- .github/workflows/docker-scanner.yaml | 4 +-- .github/workflows/enigma-docker.yml | 45 +++++++++++++++++++++++++++ .github/workflows/sanity-check.yaml | 4 +-- 4 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/enigma-docker.yml diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 8f8d0db..3cc16f6 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -76,8 +76,8 @@ RUN apt install -y \ # ZSH -ADD ./etc/install-zsh.sh /root/install-zsh.sh -ADD ./etc/install-zsh.sh /home/ubuntu/install-zsh.sh +ADD .docker/etc/install-zsh.sh /root/install-zsh.sh +ADD .docker/etc/install-zsh.sh /home/ubuntu/install-zsh.sh RUN chmod +x /root/install-zsh.sh RUN chmod +x /home/ubuntu/install-zsh.sh @@ -183,4 +183,4 @@ WORKDIR /home/ubuntu/workspace # Define default command. EXPOSE 22 -CMD ["/usr/sbin/sshd", "-D"] \ No newline at end of file +CMD ["/usr/sbin/sshd", "-D"] diff --git a/.github/workflows/docker-scanner.yaml b/.github/workflows/docker-scanner.yaml index 2b76c5a..7e54626 100644 --- a/.github/workflows/docker-scanner.yaml +++ b/.github/workflows/docker-scanner.yaml @@ -15,8 +15,8 @@ on: jobs: docker-scanner: - uses: clouddrove/github-shared-workflows/.github/workflows/docker-scanner.yml@1.2.7 + uses: clouddrove/github-shared-workflows/.github/workflows/docker-scanner.yml@1.2.8 with: severity: "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" dockerfile-path: "./.docker/Dockerfile" - security-upload: "true" \ No newline at end of file + security-upload: "true" diff --git a/.github/workflows/enigma-docker.yml b/.github/workflows/enigma-docker.yml new file mode 100644 index 0000000..a566fba --- /dev/null +++ b/.github/workflows/enigma-docker.yml @@ -0,0 +1,45 @@ +name: Enigma Docker Build and Publish. +on: + push: + tags: [ v* ] + +jobs: + docker-build-publish: + runs-on: ubuntu-latest + permissions: + contents: 'read' + id-token: 'write' + env: + DOCKER_IMAGE: devops-machine + DOCKER_TAG: ghcr.io/${{ github.repository }}:${{ github.ref_name }} + PROVIDER: github + + steps: + - name: Checkout code + uses: actions/checkout@v4.1.7 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build Docker Image + uses: clouddrove/enigma@v0.0.7 + with: + command: bake + DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} + DOCKER_TAG: ${{ env.DOCKER_TAG }} + DOCKERFILE_PATH: .docker/Dockerfile + GITHUB_USERNAME: ${{ github.actor }} + TOKEN: ${{ secrets.GITHUB }} + + - name: Publish Docker Image + uses: clouddrove/enigma@v0.0.7 + with: + command: publish + DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} + DOCKER_TAG: ${{ env.DOCKER_TAG }} + DOCKERFILE_PATH: .docker/Dockerfile + GITHUB_USERNAME: ${{ github.actor }} + TOKEN: ${{ secrets.GITHUB }} diff --git a/.github/workflows/sanity-check.yaml b/.github/workflows/sanity-check.yaml index 50cfe4e..9ea5d5e 100644 --- a/.github/workflows/sanity-check.yaml +++ b/.github/workflows/sanity-check.yaml @@ -15,8 +15,8 @@ jobs: uses: docker/setup-buildx-action@v3.6.1 - name: Build the application image - run: docker build -t clouddrove/devops:0.0.${{ github.run_number }} ./.docker/. - + run: docker build -t clouddrove/devops:0.0.${{ github.run_number }} -f .docker/Dockerfile . + - name: Bring container up and running run: docker run --name devops -d clouddrove/devops:0.0.${{ github.run_number }} From ed73e9e8fea55117a1eb9f56e9ffe2cf210133a1 Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Wed, 4 Sep 2024 15:17:47 +0530 Subject: [PATCH 12/18] fix: tools version and dockerfile lints --- .docker/Dockerfile | 34 +++-- .github/workflows/docker-scanner.yaml | 1 + .github/workflows/sanity-check.yaml | 2 +- README.md | 188 +++++++++++++++++++------- 4 files changed, 157 insertions(+), 68 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 3cc16f6..406466a 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -7,20 +7,20 @@ ENV LC_ALL en_US.UTF-8 ENV DEBIAN_FRONTEND noninteractive ### -ENV PHP_VERSION 8.3.10 -ENV PACKER_VERSION 1.11.2 -ENV TERRAFORM_VERSION 1.9.0 -ENV ANSIBLE_VERSION 10.3.0 -ENV LINT_VERSION 4.1.0 -ENV KUBECTL_VERSION 1.31.0 -ENV HELM_VERSION 3.15.1 -ENV AZURE_CLI_VERSION 2.63.0-1~jammy -ENV AWS_CLI_VERSION 2.17.33 -ENV K9s_Version 0.32.5 -ENV GCLOUD_VERSION 489.0.0 -ENV KUI_Version 13.1.4 -ENV KUBECTX_VERSION 0.9.4 -ENV KUBENS_VERSION 0.9.4 +ENV PHP_VERSION=8.3.10 +ENV PACKER_VERSION=1.11.2 +ENV TERRAFORM_VERSION=1.9.5 +ENV ANSIBLE_VERSION=10.3.0 +ENV LINT_VERSION=4.1.0 +ENV KUBECTL_VERSION=1.31.0 +ENV HELM_VERSION=3.15.1 +ENV AZURE_CLI_VERSION=2.63.0-1~jammy +ENV AWS_CLI_VERSION=2.17.33 +ENV K9s_Version=0.32.5 +ENV GCLOUD_VERSION=490.0.0 +ENV KUI_Version=13.1.4 +ENV KUBECTX_VERSION=0.9.4 +ENV KUBENS_VERSION=0.9.4 #################################### @@ -38,8 +38,8 @@ RUN mkdir -p /home/ubuntu/.ssh RUN chmod 755 /home/ubuntu/.ssh RUN chown -R ubuntu:ubuntu /home/ubuntu RUN chmod 755 /home/ubuntu -ENV BOOT2DOCKER_ID 501 -ENV BOOT2DOCKER_GID 20 +ENV BOOT2DOCKER_ID=501 +ENV BOOT2DOCKER_GID=20 # Tweaks to give write permissions to the app RUN usermod -u ${BOOT2DOCKER_ID} ubuntu && \ usermod -G staff ubuntu @@ -84,8 +84,6 @@ RUN chmod +x /home/ubuntu/install-zsh.sh RUN sh /root/install-zsh.sh RUN su - ubuntu -c "sh /home/ubuntu/install-zsh.sh" RUN rm /root/.zshrc && chsh -s `which zsh` && chsh -s `which zsh` ubuntu && chmod -R 755 /usr/local/share/zsh* -RUN mkdir -p ~/.oh-my-zsh/custom/plugins/copydir -RUN curl -L https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/copypath/copypath.plugin.zsh -o ~/.oh-my-zsh/custom/plugins/copydir/copydir.plugin.zsh ##Python with Packages RUN pip install ansible==${ANSIBLE_VERSION} \ diff --git a/.github/workflows/docker-scanner.yaml b/.github/workflows/docker-scanner.yaml index 7e54626..6396b7a 100644 --- a/.github/workflows/docker-scanner.yaml +++ b/.github/workflows/docker-scanner.yaml @@ -20,3 +20,4 @@ jobs: severity: "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" dockerfile-path: "./.docker/Dockerfile" security-upload: "true" + block_action: "true" diff --git a/.github/workflows/sanity-check.yaml b/.github/workflows/sanity-check.yaml index 9ea5d5e..b174392 100644 --- a/.github/workflows/sanity-check.yaml +++ b/.github/workflows/sanity-check.yaml @@ -1,4 +1,4 @@ -name: Sanity_Checks +name: Sanity Checks on: pull_request: diff --git a/README.md b/README.md index ca0ebf2..9754a27 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,159 @@ - - + +![Banner](https://github.com/clouddrove/terraform-module-template/assets/119565952/67a8a1af-2eb7-40b7-ae07-c94cde9ce062)

- DevOps Machine + DevOps Machine

-

DevOps machine using docker

-
+

+ A comprehensive Docker-based DevOps environment equipped with essential tools like Terraform, Ansible, Helm, and more. +

+ +

+ + + + + + + + + + + + +

+ +--- + +This repository offers a comprehensive Docker-based environment configured with a robust set of DevOps tools, including Terraform, Ansible, Helm, and many more. This environment is designed to streamline DevOps workflows, automate tasks, and enhance productivity.. + +## πŸš€ Features + +- **Docker-Based Environment**: + - Run all tools within an isolated Docker container. +- **Phusion/baseimage (jammy-1.0.4)** +- **SSH access enabled** +- **Custom user 'ubuntu' with sudo privileges.** +- **ZSH shell with Oh My Zsh framework and all necessary plugins.** +- **Added aliase for tools command in aliases.conf file.** +- **Mounted volumes in docker-compose file for persistence data.** +- **Added extra shell configuration in extra.conf** +- **Various development and operations and pre-installed tools with the latest version.** +- **Pre-installed Tools**: + - **Terraform**: v1.9.5 + - **Ansible**: v10.3.0 + - **Helm**: v3.15.1 + - **Packer**: v1.11.2 + - **Kubectl**: v1.31.0 + - **AWS CLI**: v2.17.33 + - **Azure CLI**: v2.63.0 + - **GCloud CLI**: v490.0.0 + - **K9s**: v0.32.5 + - **TFSwitch**: v1.7.0 + - **OpenTofu**: v1.8.0 + - **Kubectx**: v0.9.4 + - **Kubens**: v0.9.4 + - **ZSH**: Pre-configured with Oh My ZSH + +## Setup DevOps Machine + +## Prerequisites +- Docker and Docker Compose are installed on your host machine. +- Make utility. + +## πŸ›  Installation + +1. Clone the repository: + ```bash + git clone https://github.com/clouddrove-sandbox/devops-machine.git + cd devops-machine + + +## πŸ›  Build A Docker Image -[![CircleCI](https://circleci.com/gh/anmolnagpal/devops-machine/tree/master.svg?style=svg)](https://circleci.com/gh/anmolnagpal/devops-machine/tree/master) +1. Copy and paste this command (Dockerfile is located in .docker directory): + ```bash + docker build -t devops-machine .docker/ -## 1- Prepare machine: +## πŸ”§ Running the DevOps Machine -##### 1.0 - Install Docker +1. To start the DevOps machine, use the following command: -if you have it installed you can skip this step otherwise run this command: + ```bash + make up -``` -brew install docker docker-compose -``` +2. To access the DevOps Machine Run this command: -## 2- Prepare the Workspace: + - Login with user: ubuntu + - No password required. -##### 2.0 - to create the workspace directory run the following command + ```bash + make ssh -``` -mkdir ~/workspace -cd ~/workspace -``` -now lets clone the devops-machine repository -``` -git clone https://github.com/anmolnagpal/devops-machine -cd devops-machine -``` -Make sure that you are at master branch & have updated code -``` -git checkout master && git pull origin master -``` -## 3- Start machine: +## ✨ Contributors -##### 3.0 - Now lets bring the devops machine up +Big thanks to our contributors for elevating our project with their dedication and expertise! But, we do not wish to stop there, would like to invite contributions from the community in improving these projects and making them more versatile for better reach. Remember, every bit of contribution is immensely valuable, as, together, we are moving in only 1 direction, i.e. forward. -``` -make up -``` + + + +
+
-##### 3.1 - Lets do the ssh into the devops machinea and start automation the things ;) + If you're considering contributing to our project, here are a few quick guidelines that we have been following (Got a suggestion? We are all ears!): -``` -make ssh -``` -## β˜‘ Tools Added +- **Fork the Repository:** Create a new branch for your feature or bug fix. +- **Coding Standards:** You know the drill. +- **Clear Commit Messages:** Write clear and concise commit messages to facilitate understanding. +- **Thorough Testing:** Test your changes thoroughly before submitting a pull request. +- **Documentation Updates:** Include relevant documentation updates if your changes impact it. -- [X] PHP -- [X] Packer -- [X] Python -- [X] Ansible -- [X] Terraform -- [X] Helm -- [X] Kubectl +## Feedback +Spot a bug or have thoughts to share with us? Let's squash it together! Log it in our [issue tracker](https://github.com/clouddrove/enigma/issues), feel free to drop us an email at [hello@clouddrove.com](mailto:hello@clouddrove.com). -## β˜‘ TODO +Show some love with a β˜… on [our GitHub](https://github.com/clouddrove/enigma)! if our work has brightened your day! – your feedback fuels our journey! -- [ ] Add other devops tools +## :rocket: Our Accomplishment -## πŸ‘¬ Contribution +We have [*100+ Terraform modules*][terraform_modules] πŸ™Œ. You could consider them finished, but, with enthusiasts like yourself, we are able to ever improve them, so we call our status - improvement in progress. -- Open pull request with improvements -- Reach out with any feedback [![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/anmol_nagpal.svg?style=social&label=Follow%20anmolnagpal)](https://twitter.com/anmol_nagpal) +- [Terraform Module Registry:](https://registry.terraform.io/namespaces/clouddrove) Discover our Terraform modules here. + +- [Terraform Modules for AWS/Azure Modules:](https://github.com/clouddrove/toc) Explore our comprehensive Table of Contents for easy navigation through our documentation for modules pertaining to AWS, Azure & GCP. + +- [Terraform Modules for Digital Ocean:](https://github.com/terraform-do-modules/toc) Check out our specialized Terraform modules for Digital Ocean. + +## Join Our Slack Community + +Join our vibrant open-source slack community and embark on an ever-evolving journey with CloudDrove; helping you in moving upwards in your career path. +Join our vibrant Open Source Slack Community and embark on a learning journey with CloudDrove. Grow with us in the world of DevOps and set your career on a path of consistency. + +πŸŒπŸ’¬What you'll get after joining this Slack community: + +- πŸš€ Encouragement to upgrade your best version. +- 🌈 Learning companionship with our DevOps squad. +- 🌱 Relentless growth with daily updates on new advancements in technologies. + +Join our tech elites [Join Now][slack] πŸš€ + +## Explore Our Blogs + + Click [here][blog] :books: :star2: + +## Tap into our capabilities +We provide a platform for organizations to engage with experienced top-tier DevOps & Cloud services. Tap into our pool of certified engineers and architects to elevate your DevOps and Cloud Solutions. + +At [CloudDrove][website], has extensive experience in designing, building & migrating environments, securing, consulting, monitoring, optimizing, automating, and maintaining complex and large modern systems. With remarkable client footprints in American & European corridors, our certified architects & engineers are ready to serve you as per your requirements & schedule. Write to us at [business@clouddrove.com](mailto:business@clouddrove.com). + +

We are The Cloud Experts!

+
+

We ❀️ Open Source and you can check out our other modules to get help with your new Cloud ideas.

+ + [website]: https://clouddrove.com + [blog]: https://blog.clouddrove.com + [slack]: https://www.launchpass.com/devops-talks + [github]: https://github.com/clouddrove + [linkedin]: https://cpco.io/linkedin + [twitter]: https://twitter.com/clouddrove/ + [email]: https://clouddrove.com/contact-us.html + [terraform_modules]: https://github.com/clouddrove?utf8=%E2%9C%93&q=terraform-&type=&language= \ No newline at end of file From 4334aec40d7c390968e52cec61c5a3cd21cccd6b Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Wed, 4 Sep 2024 15:34:04 +0530 Subject: [PATCH 13/18] fix: Readme --- README.md | 11 +++-------- docker-compose.yml | 2 -- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9754a27..0e987d1 100644 --- a/README.md +++ b/README.md @@ -65,23 +65,19 @@ This repository offers a comprehensive Docker-based environment configured with 1. Clone the repository: ```bash - git clone https://github.com/clouddrove-sandbox/devops-machine.git - cd devops-machine - - + git clone https://github.com/clouddrove/devops-machine.git + cd devops-machin ## πŸ›  Build A Docker Image 1. Copy and paste this command (Dockerfile is located in .docker directory): ```bash - docker build -t devops-machine .docker/ - + docker build -t your-image-name -f .docker/Dockerfile . ## πŸ”§ Running the DevOps Machine 1. To start the DevOps machine, use the following command: ```bash make up - 2. To access the DevOps Machine Run this command: - Login with user: ubuntu @@ -89,7 +85,6 @@ This repository offers a comprehensive Docker-based environment configured with ```bash make ssh - ## ✨ Contributors Big thanks to our contributors for elevating our project with their dedication and expertise! But, we do not wish to stop there, would like to invite contributions from the community in improving these projects and making them more versatile for better reach. Remember, every bit of contribution is immensely valuable, as, together, we are moving in only 1 direction, i.e. forward. diff --git a/docker-compose.yml b/docker-compose.yml index db0ccfb..47dd918 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '2.1' - services: devops: container_name: devops From 268afb6a00141f6c05a1b49f4194775d925bd8fa Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Wed, 4 Sep 2024 15:55:03 +0530 Subject: [PATCH 14/18] fix: Docker lints --- .docker/Dockerfile | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 406466a..49077c7 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -2,9 +2,9 @@ FROM phusion/baseimage:jammy-1.0.4 ##################################### -ENV LANG C.UTF-8 -ENV LC_ALL en_US.UTF-8 -ENV DEBIAN_FRONTEND noninteractive +ENV LANG=C.UTF-8 +ENV LC_ALL=en_US.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive ### ENV PHP_VERSION=8.3.10 @@ -136,13 +136,9 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWS_CLI_VERSION mv /usr/local/bin/aws /bin #gcloud -RUN cd /tmp && \ - wget https://storage.googleapis.com/cloud-sdk-release/google-cloud-cli-${GCLOUD_VERSION}-linux-arm.tar.gz && \ - tar -xvzf google-cloud-cli-${GCLOUD_VERSION}-linux-arm.tar.gz && \ - mv google-cloud-sdk /usr/local/gcloud && \ - /usr/local/gcloud/install.sh --quiet && \ - rm /tmp/google-cloud-cli-${GCLOUD_VERSION}-linux-arm.tar.gz -ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin +RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \ + apt-get update -y && apt-get install google-cloud-cli=${GCLOUD_VERSION}-0 -y #k9s RUN curl -LO https://github.com/derailed/k9s/releases/latest/download/k9s_Linux_amd64.tar.gz && \ @@ -181,4 +177,4 @@ WORKDIR /home/ubuntu/workspace # Define default command. EXPOSE 22 -CMD ["/usr/sbin/sshd", "-D"] +CMD ["/usr/sbin/sshd", "-D"] \ No newline at end of file From 78effe15d9ed87c3c95d31cec077015cd8cb781e Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Wed, 4 Sep 2024 17:27:24 +0530 Subject: [PATCH 15/18] fix: Update sanity checks workflow --- .github/workflows/sanity-check.yaml | 39 ++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sanity-check.yaml b/.github/workflows/sanity-check.yaml index b174392..fb343ba 100644 --- a/.github/workflows/sanity-check.yaml +++ b/.github/workflows/sanity-check.yaml @@ -25,15 +25,42 @@ jobs: - name: Sanity check run: | - # Get the latest versions + # Terraform LATEST_TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version) - - # Get the installed versions INSTALLED_TERRAFORM_VERSION=$(docker exec devops terraform version -json | jq -r .terraform_version) - - # Compare versions - if [ "$LATEST_TERRAFORM_VERSION" != "$INSTALLED_TERRAFORM_VERSION" ]; then echo "Terraform version mismatch: expected $LATEST_TERRAFORM_VERSION, got $INSTALLED_TERRAFORM_VERSION" exit 1 + fi + + # Azure CLI + LATEST_AZURE_VERSION=$(curl -s https://api.github.com/repos/Azure/azure-cli/releases/latest | jq -r .tag_name | cut -d '-' -f 3) + INSTALLED_AZURE_VERSION=$(docker exec devops az version | jq -r '."azure-cli"') + if [ "$LATEST_AZURE_VERSION" != "$INSTALLED_AZURE_VERSION" ]; then + echo "Azure CLI version mismatch: expected $LATEST_AZURE_VERSION, got $INSTALLED_AZURE_VERSION" + exit 1 + fi + + # AWS CLI + curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" + unzip awscliv2.zip + sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update + LATEST_AWS_VERSION=$(aws --version 2>&1 | awk '{print $1}' | cut -d/ -f2) + INSTALLED_AWS_VERSION=$(docker exec devops aws --version 2>&1 | awk '{print $1}' | cut -d/ -f2) + echo "AWS CLI versions - Latest: $LATEST_AWS_VERSION, Installed: $INSTALLED_AWS_VERSION" + + # Kubectl + LATEST_KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt | cut -c 2-) + INSTALLED_KUBECTL_VERSION=$(docker exec devops kubectl version --client -o json | jq -r '.clientVersion.gitVersion' | cut -c 2-) + if [ "$LATEST_KUBECTL_VERSION" != "$INSTALLED_KUBECTL_VERSION" ]; then + echo "Kubectl version mismatch: expected $LATEST_KUBECTL_VERSION, got $INSTALLED_KUBECTL_VERSION" + exit 1 + fi + + # Helm + LATEST_HELM_VERSION=$(curl -s https://api.github.com/repos/helm/helm/releases/latest | jq -r .tag_name | cut -c 2-) + INSTALLED_HELM_VERSION=$(docker exec devops helm version --template="{{ .Version }}" | cut -c 2-) + if [ "$LATEST_HELM_VERSION" != "$INSTALLED_HELM_VERSION" ]; then + echo "Helm version mismatch: expected $LATEST_HELM_VERSION, got $INSTALLED_HELM_VERSION" + exit 1 fi \ No newline at end of file From 57cd57c21c9458c41d88a5388eb23e530f1e2b89 Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Wed, 4 Sep 2024 17:34:31 +0530 Subject: [PATCH 16/18] fix: Update azure cli version --- .docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 49077c7..dbe58c6 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -14,7 +14,7 @@ ENV ANSIBLE_VERSION=10.3.0 ENV LINT_VERSION=4.1.0 ENV KUBECTL_VERSION=1.31.0 ENV HELM_VERSION=3.15.1 -ENV AZURE_CLI_VERSION=2.63.0-1~jammy +ENV AZURE_CLI_VERSION=2.64.0-1~jammy ENV AWS_CLI_VERSION=2.17.33 ENV K9s_Version=0.32.5 ENV GCLOUD_VERSION=490.0.0 From d68e8004663a82ec392727d8828248e4954c2e89 Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Wed, 4 Sep 2024 17:46:59 +0530 Subject: [PATCH 17/18] fix: Helm and aws cli version, also update sanity workflow --- .docker/Dockerfile | 4 ++-- .github/workflows/sanity-check.yaml | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index dbe58c6..f2f4541 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -13,9 +13,9 @@ ENV TERRAFORM_VERSION=1.9.5 ENV ANSIBLE_VERSION=10.3.0 ENV LINT_VERSION=4.1.0 ENV KUBECTL_VERSION=1.31.0 -ENV HELM_VERSION=3.15.1 +ENV HELM_VERSION=3.15.4 ENV AZURE_CLI_VERSION=2.64.0-1~jammy -ENV AWS_CLI_VERSION=2.17.33 +ENV AWS_CLI_VERSION=2.17.43 ENV K9s_Version=0.32.5 ENV GCLOUD_VERSION=490.0.0 ENV KUI_Version=13.1.4 diff --git a/.github/workflows/sanity-check.yaml b/.github/workflows/sanity-check.yaml index fb343ba..10c029f 100644 --- a/.github/workflows/sanity-check.yaml +++ b/.github/workflows/sanity-check.yaml @@ -25,20 +25,20 @@ jobs: - name: Sanity check run: | + mismatches="" + # Terraform LATEST_TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version) INSTALLED_TERRAFORM_VERSION=$(docker exec devops terraform version -json | jq -r .terraform_version) if [ "$LATEST_TERRAFORM_VERSION" != "$INSTALLED_TERRAFORM_VERSION" ]; then - echo "Terraform version mismatch: expected $LATEST_TERRAFORM_VERSION, got $INSTALLED_TERRAFORM_VERSION" - exit 1 + mismatches="$mismatches\nTerraform version mismatch: expected $LATEST_TERRAFORM_VERSION, got $INSTALLED_TERRAFORM_VERSION" fi # Azure CLI LATEST_AZURE_VERSION=$(curl -s https://api.github.com/repos/Azure/azure-cli/releases/latest | jq -r .tag_name | cut -d '-' -f 3) INSTALLED_AZURE_VERSION=$(docker exec devops az version | jq -r '."azure-cli"') if [ "$LATEST_AZURE_VERSION" != "$INSTALLED_AZURE_VERSION" ]; then - echo "Azure CLI version mismatch: expected $LATEST_AZURE_VERSION, got $INSTALLED_AZURE_VERSION" - exit 1 + mismatches="$mismatches\nAzure CLI version mismatch: expected $LATEST_AZURE_VERSION, got $INSTALLED_AZURE_VERSION" fi # AWS CLI @@ -47,20 +47,26 @@ jobs: sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update LATEST_AWS_VERSION=$(aws --version 2>&1 | awk '{print $1}' | cut -d/ -f2) INSTALLED_AWS_VERSION=$(docker exec devops aws --version 2>&1 | awk '{print $1}' | cut -d/ -f2) - echo "AWS CLI versions - Latest: $LATEST_AWS_VERSION, Installed: $INSTALLED_AWS_VERSION" + if [ "$LATEST_AWS_VERSION" != "$INSTALLED_AWS_VERSION" ]; then + mismatches="$mismatches\nAWS CLI version mismatch: expected $LATEST_AWS_VERSION, got $INSTALLED_AWS_VERSION" + fi # Kubectl LATEST_KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt | cut -c 2-) INSTALLED_KUBECTL_VERSION=$(docker exec devops kubectl version --client -o json | jq -r '.clientVersion.gitVersion' | cut -c 2-) if [ "$LATEST_KUBECTL_VERSION" != "$INSTALLED_KUBECTL_VERSION" ]; then - echo "Kubectl version mismatch: expected $LATEST_KUBECTL_VERSION, got $INSTALLED_KUBECTL_VERSION" - exit 1 + mismatches="$mismatches\nKubectl version mismatch: expected $LATEST_KUBECTL_VERSION, got $INSTALLED_KUBECTL_VERSION" fi # Helm LATEST_HELM_VERSION=$(curl -s https://api.github.com/repos/helm/helm/releases/latest | jq -r .tag_name | cut -c 2-) INSTALLED_HELM_VERSION=$(docker exec devops helm version --template="{{ .Version }}" | cut -c 2-) if [ "$LATEST_HELM_VERSION" != "$INSTALLED_HELM_VERSION" ]; then - echo "Helm version mismatch: expected $LATEST_HELM_VERSION, got $INSTALLED_HELM_VERSION" + mismatches="$mismatches\nHelm version mismatch: expected $LATEST_HELM_VERSION, got $INSTALLED_HELM_VERSION" + fi + + # Print mismatches and fail if any + if [ -n "$mismatches" ]; then + echo -e "Version mismatches found:$mismatches" exit 1 fi \ No newline at end of file From 485629cb39cb1d06af1e1521a5a12ed71efc26cf Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Wed, 4 Sep 2024 23:25:36 +0530 Subject: [PATCH 18/18] feat: Added gcloud in sanity checks --- .github/workflows/sanity-check.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/sanity-check.yaml b/.github/workflows/sanity-check.yaml index 10c029f..175c579 100644 --- a/.github/workflows/sanity-check.yaml +++ b/.github/workflows/sanity-check.yaml @@ -65,6 +65,18 @@ jobs: mismatches="$mismatches\nHelm version mismatch: expected $LATEST_HELM_VERSION, got $INSTALLED_HELM_VERSION" fi + # Google Cloud SDK (gcloud) + curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz + tar -xf google-cloud-cli-linux-x86_64.tar.gz + ./google-cloud-sdk/install.sh --quiet + export PATH=$PATH:$PWD/google-cloud-sdk/bin + LATEST_GCLOUD_VERSION=$(gcloud --version | grep -oP '(?<=Google Cloud SDK )\S+') + INSTALLED_GCLOUD_VERSION=$(docker exec devops gcloud --version | grep -oP '(?<=Google Cloud SDK )\S+') + echo "Google Cloud SDK versions - Latest: $LATEST_GCLOUD_VERSION, Installed: $INSTALLED_GCLOUD_VERSION" + if [ "$LATEST_GCLOUD_VERSION" != "$INSTALLED_GCLOUD_VERSION" ]; then + mismatches="$mismatches\nGoogle Cloud SDK version mismatch: expected $LATEST_GCLOUD_VERSION, got $INSTALLED_GCLOUD_VERSION" + fi + # Print mismatches and fail if any if [ -n "$mismatches" ]; then echo -e "Version mismatches found:$mismatches"