From a9d740b2698a9682a2c1632b993a2e406dd13661 Mon Sep 17 00:00:00 2001
From: Tung Bui
Date: Sat, 31 Aug 2024 15:33:19 +0700
Subject: [PATCH 1/7] Update repo info
---
README.md | 150 +++++++++++++++++-------------------------------------
1 file changed, 47 insertions(+), 103 deletions(-)
diff --git a/README.md b/README.md
index 355c4e7..e73c683 100644
--- a/README.md
+++ b/README.md
@@ -15,88 +15,72 @@
-## Key features
+## Key Features
-- **Pre-installed Tools**: Includes a variety of essential tools such as git, python, ansible, terraform, kubectl, helm, awscli, azurecli, etc.
-- **Continuous Integration**: Utilizes full CI/CD for deployment to Docker Hub using GitHub Actions.
-- **Documentation**: Provides detailed documentation for each tool included.
-- **Regular Updates**: Weekly checks and updates for core tools ensure the toolkit's reliability and security.
-- **Sample code**: Includes sample code demonstrating the usage of various tools available in the toolkit.
-- **Support for Build Variants**: Enables users to customize the toolkit by building it with their preferred versions of each tool.
-- **Support Configuration Reusable**: Mounts a config folder on the host to the container. This allows reusing configurations in the container, like AWS and Azure login sessions, ...
+- **Comprehensive Toolset**: Pre-installed with tools like Git, Python, Ansible, Terraform, kubectl, Helm, AWS CLI, Azure CLI, and more.
+- **Easy Integration**: Use it directly or customize it with your preferred versions.
+- **Efficient Updates**: Weekly updates ensure the latest versions and security patches.
+- **Configuration Reusability**: Mounts host config folders for seamless reuse across sessions.
-## Prerequisites 🔓
+## Getting Started
-Before you begin, ensure that you have [Docker](https://docs.docker.com/engine/install/) installed. It's also helpful to have a basic understanding of Docker concepts.
+You can use the DevOps Toolkit with two approaches:
-## Versioning 🔖
+### Approach 1: Use the Execution Script
-Below is the versioning strategy for the repository and DockerHub:
+The provided script simplifies setup and execution.
-- Tagging format:
- - Repository: `vX.Y.Z`, for example: `v1.2.3`
- - DockerHub: `X.Y.Z`, for example: `1.2.3`. (Usage: `docker pull tungbq/devops-toolkit:1.2.3`)
-- Tagging description:
- - Specific tag (e.g., `0.1.0`, `0.2.3`): Contains the latest tooling version and repository features at the time this repository is tagged.
- - In addition to that, we offer the latest tag on DockerHub (`latest`): Contains the latest tooling version and repository features inside the toolkit, which will be built and updated on a weekly basis.
+1. **Install**:
-_NOTE_: In the following section, we use the latest tag in the documentation, but you can specify your desired tag based on your needs.
+ ```bash
+ curl -o devops-toolkit https://raw.githubusercontent.com/tungbq/devops-toolkit/main/devops-toolkit
+ chmod +x devops-toolkit
+ sudo mv devops-toolkit /usr/local/bin/
+ ```
-## Use devops-toolkit with execution script
+2. **Run**:
-The `devops-toolkit` script in this repo helps you use the devops-toolkit in the fast and efficience way.
+ - Start a new container:
-### Install
+ ```bash
+ devops-toolkit run
+ ```
-```bash
-curl -o devops-toolkit https://raw.githubusercontent.com/tungbq/devops-toolkit/main/devops-toolkit
-chmod +x devops-toolkit
-sudo mv devops-toolkit /usr/local/bin/
-```
+ - Execute a command in the container:
-### Run
+ ```bash
+ devops-toolkit run ls -la
+ ```
-Navigate to your working directory then run the devops-toolkit
+ - Access the shell:
-```bash
-# See available commands or get help
-devops-toolkit help
-# Start a new container
-devops-toolkit run
-# Start a new container and run a command
-devops-toolkit run ls -la
-# Execute the shell
-devops-toolkit shell
-# Update the devops-toolkit
-devops-toolkit update
-# Remove container
-devops-toolkit cleanup
-```
+ ```bash
+ devops-toolkit shell
+ ```
-## Use devops-toolkit with docker command
+ - For more commands, use `devops-toolkit help`.
-In this option you use your own docker command to start and run the devops-toolkit.
+### Approach 2: Use Docker Command Directly
-### Quick start 🔥
+Quickly start the toolkit with a simple Docker command.
-- Use latest tag
+- **Quick Start**:
```bash
mkdir -p ~/.dtc
docker run --network host -it --rm -v ~/.dtc:/dtc tungbq/devops-toolkit:latest
```
-- Use specific tag
+_NOTE_:
- ```bash
- docker run --network host -it --rm -v ~/.dtc:/dtc tungbq/devops-toolkit:0.1.0
- ```
+- You can replace `~/.dtc` with any desired folder path on your VM.
+- Remove the `-v ~/.dtc:/dtc` option if you do not wish to store configurations on the host (not recommended for configuration reuse).
-- _NOTE_
- - You can replace `~/.dtc` with any desired folder path on your VM.
- - Remove the `-v ~/.dtc:/dtc` option if you do not wish to store configurations on the host (not recommended for configuration reuse).
+- **Advanced Options**:
-### Demo 📺
+ For more detailed examples and commands, refer to our [full guide](./docs/usage/README.md).
+
+- **Demo 📺**
```bash
docker run --network host --rm -v ~/.dtc:/dtc tungbq/devops-toolkit:latest samples/run_sample.sh
@@ -104,65 +88,25 @@ docker run --network host --rm -v ~/.dtc:/dtc tungbq/devops-toolkit:latest sampl
Check out the full sample and instruction at [**samples**](./samples/)
-## Getting started 📖
+## Versioning
+
+We use the following versioning scheme:
-### Pull the official image from Docker Hub
+- **Repository Tags**: `vX.Y.Z` (e.g., `v1.2.3`)
+- **Docker Tags**: `X.Y.Z` or `latest` for the most recent version.
-DockerHub image: [**tungbq/devops-toolkit:latest**](https://hub.docker.com/r/tungbq/devops-toolkit)
+You can pull specific versions from Docker Hub using:
```bash
-docker pull tungbq/devops-toolkit:latest
+docker pull tungbq/devops-toolkit:1.2.3
```
-### Build your own image
-
-Skip this step if you use the image from DockerHub
-
-- If you prefer to build your own image from the source code, refer to the [**build_toolkit_image**](./docs/build/build_toolkit_image.md) instructions.
-- We can customize the toolkit by building it with our preferred versions of each tool.
-
-### Start and explore the toolkit container
-
-Once you have the image ready, you can start using the toolkit with the following commands
-
-- Start devops-toolkit container
-
- ```bash
- docker run --network host -it --rm -v ~/.dtc:/dtc tungbq/devops-toolkit:latest
- ```
-
-- Now we are in the docker container terminal, let's explore it
-
- ```bash
- root@docker-desktop:~# python3 --version
- Python 3.12.2
-
- root@docker-desktop:~# terraform --version
- Terraform v1.7.5
- on linux_amd64
-
- root@docker-desktop:~# kubectl version
- Client Version: v1.29.3
- Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
-
- root@docker-desktop:~# aws configure
- root@docker-desktop:~# az login --use-device-code
-
- # ... more command as your needed
- ```
+For more details on versioning, check the release notes.
## User Guide 📖
Explore the comprehensive guide below to gain insight into the detailed utilization of every tool within the toolkit.
-- Prepare configuration folder on the Host (Skip this step if you do not intend to reuse configurations.)
-
- ```bash
- mkdir ~/.dtc
- ```
-
- _NOTE:_ We are using `~/.dtc` to store toolkit configurations, but you can choose any folder name on the host.
-
- For detailed instructions on using specific tools, refer to: [**DevOps toolkit specific tool user guide**](./docs/usage/README.md)
- For instructions on common run modes, visit [**DevOps toolkit common run mode**](./docs/usage/run_mode.md)
From 62ef37e657913b0d7b024aae5b9e2493dbe8949e Mon Sep 17 00:00:00 2001
From: Tung Bui
Date: Sat, 31 Aug 2024 15:39:37 +0700
Subject: [PATCH 2/7] Update repo info
---
README.md | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index e73c683..3ceb3a7 100644
--- a/README.md
+++ b/README.md
@@ -69,12 +69,10 @@ Quickly start the toolkit with a simple Docker command.
```bash
mkdir -p ~/.dtc
docker run --network host -it --rm -v ~/.dtc:/dtc tungbq/devops-toolkit:latest
- ```
-
-_NOTE_:
-- You can replace `~/.dtc` with any desired folder path on your VM.
-- Remove the `-v ~/.dtc:/dtc` option if you do not wish to store configurations on the host (not recommended for configuration reuse).
+ # You can replace `~/.dtc` with any desired folder path on your VM.
+ # Remove the `-v ~/.dtc:/dtc` option if you do not wish to store configurations on the host (not recommended for configuration reuse).
+ ```
- **Advanced Options**:
@@ -101,7 +99,7 @@ You can pull specific versions from Docker Hub using:
docker pull tungbq/devops-toolkit:1.2.3
```
-For more details on versioning, check the release notes.
+For more details on versioning, check the [release notes](https://github.com/tungbq/devops-toolkit/releases).
## User Guide 📖
From f7173386032cf3666d4561d5231f66105862cbef Mon Sep 17 00:00:00 2001
From: Tung Bui
Date: Sat, 31 Aug 2024 16:09:04 +0700
Subject: [PATCH 3/7] Add init feat
---
README.md | 7 +++++++
devops-toolkit | 31 ++++++++++++++++++++++++++++++-
2 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 3ceb3a7..a58e920 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,13 @@ The provided script simplifies setup and execution.
2. **Run**:
+ - Start a new container:
+
+ ```bash
+ devops-toolkit init
+ # Run 'devops-toolkit init vX.Y.Z' if you want to use specific version
+ ```
+
- Start a new container:
```bash
diff --git a/devops-toolkit b/devops-toolkit
index a12b08e..98cbdcb 100755
--- a/devops-toolkit
+++ b/devops-toolkit
@@ -180,6 +180,7 @@ shell_access() {
usage() {
log $BLUE "Usage: $0 [command] [options]"
echo "Commands:"
+ echo " init [version]: Initialize the container. If version is omitted, initializes with the latest image."
echo " run [command]: Start a new container and run a command"
echo " exec [command]: Execute a command in an existing container"
echo " cleanup: Remove the container"
@@ -191,7 +192,35 @@ usage() {
echo " shell: Get a shell inside the running container"
}
+init() {
+ local version="$1"
+ local image="${DOCKER_IMAGE%:*}:${version:-latest}"
+
+ # Check if the directory exists
+ if [ ! -d "$CONFIG_MOUNT_PATH" ]; then
+ # If the directory doesn't exist, create it
+ mkdir -p "$CONFIG_MOUNT_PATH"
+ echo "Config path $DICONFIG_MOUNT_PATHR created."
+ else
+ echo "Config path $CONFIG_MOUNT_PATH already exists."
+ fi
+
+ if docker inspect --type=container "$CONTAINER_NAME" > /dev/null 2>&1; then
+ log $YELLOW "Container $CONTAINER_NAME already exists. Skipping initialization."
+ log $YELLOW "Run 'devops-toolkit cleanup' then init again if you want to re-init!"
+ else
+ log $BLUE "Initializing container with image $image..."
+ pull_image "$image"
+ start_container "$image"
+ log $GREEN "Initialization complete."
+ fi
+}
+
case "$1" in
+ init)
+ shift
+ init "$1"
+ ;;
run)
RUN_MODE="run"
shift
@@ -237,4 +266,4 @@ case "$1" in
usage
exit 1
;;
-esac
\ No newline at end of file
+esac
From ba914b98ccd1f68762d180e088b954cc8a803e50 Mon Sep 17 00:00:00 2001
From: Tung Bui
Date: Sat, 31 Aug 2024 16:10:24 +0700
Subject: [PATCH 4/7] Add init feat.v1
---
README.md | 2 +-
devops-toolkit | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index a58e920..e68d510 100644
--- a/README.md
+++ b/README.md
@@ -40,7 +40,7 @@ The provided script simplifies setup and execution.
2. **Run**:
- - Start a new container:
+ - Initialize the docker image and configuration directory:
```bash
devops-toolkit init
diff --git a/devops-toolkit b/devops-toolkit
index 98cbdcb..7ffee43 100755
--- a/devops-toolkit
+++ b/devops-toolkit
@@ -180,7 +180,7 @@ shell_access() {
usage() {
log $BLUE "Usage: $0 [command] [options]"
echo "Commands:"
- echo " init [version]: Initialize the container. If version is omitted, initializes with the latest image."
+ echo " init [version]: Initialize the container and configuration directory. If version is omitted, initializes with the latest image."
echo " run [command]: Start a new container and run a command"
echo " exec [command]: Execute a command in an existing container"
echo " cleanup: Remove the container"
From 9bc8ba91102577bf4f023cfa7d5b88535d864cae Mon Sep 17 00:00:00 2001
From: Tung Bui
Date: Sat, 31 Aug 2024 16:34:53 +0700
Subject: [PATCH 5/7] Add init feat.v2
---
README.md | 74 ++++++++++++++++++++++++-------------------------------
1 file changed, 32 insertions(+), 42 deletions(-)
diff --git a/README.md b/README.md
index e68d510..190b632 100644
--- a/README.md
+++ b/README.md
@@ -24,75 +24,65 @@
## Getting Started
-You can use the DevOps Toolkit with two approaches:
-
-### Approach 1: Use the Execution Script
-
-The provided script simplifies setup and execution.
+Use the provided execution script simplifies setup, execution and managing DevOps Toolkit.
1. **Install**:
- ```bash
- curl -o devops-toolkit https://raw.githubusercontent.com/tungbq/devops-toolkit/main/devops-toolkit
- chmod +x devops-toolkit
- sudo mv devops-toolkit /usr/local/bin/
- ```
+```bash
+curl -o devops-toolkit https://raw.githubusercontent.com/tungbq/devops-toolkit/main/devops-toolkit
+chmod +x devops-toolkit
+sudo mv devops-toolkit /usr/local/bin/
+```
2. **Run**:
- - Initialize the docker image and configuration directory:
+- Initialize the docker image and configuration directory:
- ```bash
- devops-toolkit init
- # Run 'devops-toolkit init vX.Y.Z' if you want to use specific version
- ```
+```bash
+devops-toolkit init
+# Run 'devops-toolkit init vX.Y.Z' if you want to use specific version
+```
- - Start a new container:
+- Start a new container:
- ```bash
- devops-toolkit run
- ```
+```bash
+devops-toolkit run
+```
- - Execute a command in the container:
+- Execute a command in the container:
- ```bash
- devops-toolkit run ls -la
- ```
+```bash
+devops-toolkit run ls -la
+```
- - Access the shell:
+- Access the shell:
- ```bash
- devops-toolkit shell
- ```
+```bash
+devops-toolkit shell
+```
- - For more commands, use `devops-toolkit help`.
+- For more commands, use `devops-toolkit help`.
-### Approach 2: Use Docker Command Directly
+## Use Docker Command Directly
-Quickly start the toolkit with a simple Docker command.
+Follow this instruction if you would like to use from docker command without the help of execution script
- **Quick Start**:
```bash
- mkdir -p ~/.dtc
- docker run --network host -it --rm -v ~/.dtc:/dtc tungbq/devops-toolkit:latest
+ mkdir -p $HOME/.dtc
+ docker run --network host -it --rm -v $HOME/.dtc:/dtc tungbq/devops-toolkit:latest
- # You can replace `~/.dtc` with any desired folder path on your VM.
- # Remove the `-v ~/.dtc:/dtc` option if you do not wish to store configurations on the host (not recommended for configuration reuse).
+ # You can replace `$HOME/.dtc` with any desired folder path on your VM.
+ # Remove the `-v $HOME/.dtc:/dtc` option if you do not wish to store configurations on the host (not recommended for configuration reuse).
```
-- **Advanced Options**:
-
- For more detailed examples and commands, refer to our [full guide](./docs/usage/README.md).
-
-- **Demo 📺**
+- **Advanced Run Options**:
```bash
-docker run --network host --rm -v ~/.dtc:/dtc tungbq/devops-toolkit:latest samples/run_sample.sh
+# TODO
```
-Check out the full sample and instruction at [**samples**](./samples/)
-
## Versioning
We use the following versioning scheme:
From 053f288f6149b4d9de84e5e3b396f7ee845a8daa Mon Sep 17 00:00:00 2001
From: Tung Bui
Date: Sat, 31 Aug 2024 16:59:46 +0700
Subject: [PATCH 6/7] Update document
---
README.md | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 190b632..63d686f 100644
--- a/README.md
+++ b/README.md
@@ -36,14 +36,14 @@ sudo mv devops-toolkit /usr/local/bin/
2. **Run**:
-- Initialize the docker image and configuration directory:
+- Initialize the docker image, container and configuration directory:
```bash
devops-toolkit init
-# Run 'devops-toolkit init vX.Y.Z' if you want to use specific version
+# Run 'devops-toolkit init vX.Y.Z' if you want to use specific version. E.g: devops-toolkit init 1.0.2
```
-- Start a new container:
+- Start a shell in new container:
```bash
devops-toolkit run
@@ -72,17 +72,23 @@ Follow this instruction if you would like to use from docker command without the
```bash
mkdir -p $HOME/.dtc
docker run --network host -it --rm -v $HOME/.dtc:/dtc tungbq/devops-toolkit:latest
-
- # You can replace `$HOME/.dtc` with any desired folder path on your VM.
- # Remove the `-v $HOME/.dtc:/dtc` option if you do not wish to store configurations on the host (not recommended for configuration reuse).
```
- **Advanced Run Options**:
```bash
-# TODO
+docker run -it --name devops-toolkit-ctn \
+ --volume "$PWD:$PWD" \
+ --volume "$HOME/.dtc:/dtc" \
+ --volume "$HOME/.ssh:/root/.ssh" \
+ --workdir "$PWD" \
+ --network host \
+ tungbq/devops-toolkit:latest
```
+- You can replace `$HOME/.dtc` with any desired folder path on your VM.
+- Remove the `-v $HOME/.dtc:/dtc` option if you do not wish to store configurations on the host (not recommended for configuration reuse).
+
## Versioning
We use the following versioning scheme:
From 9621708cee9506492fe7de57032019b4cf90155a Mon Sep 17 00:00:00 2001
From: Tung Bui
Date: Sat, 31 Aug 2024 17:10:33 +0700
Subject: [PATCH 7/7] Update document
---
README.md | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index 63d686f..23754c7 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@
Use the provided execution script simplifies setup, execution and managing DevOps Toolkit.
-1. **Install**:
+### 1. Install
```bash
curl -o devops-toolkit https://raw.githubusercontent.com/tungbq/devops-toolkit/main/devops-toolkit
@@ -34,7 +34,7 @@ chmod +x devops-toolkit
sudo mv devops-toolkit /usr/local/bin/
```
-2. **Run**:
+### 2. Run
- Initialize the docker image, container and configuration directory:
@@ -63,18 +63,18 @@ devops-toolkit shell
- For more commands, use `devops-toolkit help`.
-## Use Docker Command Directly
+## Use DevOps Toolkit with docker command directly
-Follow this instruction if you would like to use from docker command without the help of execution script
+Follow this instruction if you would like to use from docker command without the help of the execution script
-- **Quick Start**:
+### 1. Quick Start
- ```bash
- mkdir -p $HOME/.dtc
- docker run --network host -it --rm -v $HOME/.dtc:/dtc tungbq/devops-toolkit:latest
- ```
+```bash
+mkdir -p $HOME/.dtc # Skip this step if you already created the configuration folder before
+docker run --network host -it --rm -v $HOME/.dtc:/dtc tungbq/devops-toolkit:latest
+```
-- **Advanced Run Options**:
+### 2. Advanced Run Options
```bash
docker run -it --name devops-toolkit-ctn \
@@ -84,8 +84,12 @@ docker run -it --name devops-toolkit-ctn \
--workdir "$PWD" \
--network host \
tungbq/devops-toolkit:latest
+
+# Adjust the docker run command base on your use cases
```
+### 3. Note
+
- You can replace `$HOME/.dtc` with any desired folder path on your VM.
- Remove the `-v $HOME/.dtc:/dtc` option if you do not wish to store configurations on the host (not recommended for configuration reuse).
@@ -100,6 +104,7 @@ You can pull specific versions from Docker Hub using:
```bash
docker pull tungbq/devops-toolkit:1.2.3
+docker pull tungbq/devops-toolkit:latest
```
For more details on versioning, check the [release notes](https://github.com/tungbq/devops-toolkit/releases).