Skip to content

Commit

Permalink
Update tool usage for devops-toolkit-cli approach (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
tungbq authored Aug 31, 2024
1 parent d84ef72 commit 911b8a7
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 42 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

## Getting Started

Use the provided execution script simplifies setup, execution and managing DevOps Toolkit.
The provided execution script simplifies the setup, execution, and management of the DevOps Toolkit.

### 1. Install

Expand All @@ -36,11 +36,14 @@ sudo mv devops-toolkit-cli /usr/local/bin/

### 2. Run

Navigate to your workspace folder, then:

- Initialize the docker image, container and configuration directory:

```bash
devops-toolkit-cli init
# Run 'devops-toolkit-cli init vX.Y.Z' if you want to use specific version. E.g: devops-toolkit-cli init 1.0.2
# Run 'devops-toolkit-cli init vX.Y.Z' if you want to use specific version.
# E.g: devops-toolkit-cli init 1.0.2
```

- Start a shell in new container:
Expand All @@ -61,11 +64,14 @@ devops-toolkit-cli run ls -la
devops-toolkit-cli shell
```

- For more commands, use `devops-toolkit-cli help`.
### 3. Get Help

- For more commands, run `devops-toolkit-cli help`.
- For detailed `devops-toolkit-cli` document and advanced usage, see: [docs/usage/devops_toolkit_cli](./docs/usage/devops_toolkit_cli.md)

## Use DevOps Toolkit with 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 the execution script
Follow these instructions if you prefer to use Docker commands without the help of the execution script.

### 1. Quick Start

Expand All @@ -90,6 +96,7 @@ docker run -it --name devops-toolkit-ctn \

### 3. Note

- `.dtc` stands for **D**evOps **T**oolkit **C**onfiguration
- 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).

Expand All @@ -107,7 +114,7 @@ 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).
For more details on versioning, check the [**release notes**](https://github.com/tungbq/devops-toolkit/releases).

## User Guide 📖

Expand Down
32 changes: 25 additions & 7 deletions docs/usage/ansible_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,37 @@ Some document to help you start with ansible
- <https://github.com/tungbq/devops-basic/tree/main/topics/ansible>
- <https://www.ansible.com/>

## Note
## Run with devops-toolkit-cli

### Start the container

Navigate to your workspace folder, then run:

```bash
devops-toolkit-cli init
devops-toolkit-cli run

# You now in the container terminal. Execute the ansible command normally
ansible --version
```

It will mount the workspace code to container and you then can execute desired scripts inside the `devops-toolkit` container.

## Run with Docker command

### Note

To use the existing container instead of creating one, use `docker exec` command instead of `docker run`

```bash
docker exec -it my_devops_toolkit /bin/bash
```

## Common Run Modes
### Common Run Modes

For instructions on common run modes, visit [**DevOps Toolkit Common Run Mode**](../usage/run_mode.md).

## Use case 1: Run Ansible sample code provided in the container
### Use case 1: Run Ansible sample code provided in the container

```bash
docker run --rm --network host -v ~/.dtc:/dtc -it tungbq/devops-toolkit:latest
Expand All @@ -28,7 +46,7 @@ docker run --rm --network host -v ~/.dtc:/dtc -it tungbq/devops-toolkit:latest
ansible-playbook samples/ansible/check_os.yml
```

## Use case 2: Clone external code inside container
### Use case 2: Clone external code inside container

```bash
docker run --rm --network host -v ~/.dtc:/dtc -it tungbq/devops-toolkit:latest
Expand All @@ -43,7 +61,7 @@ cd ansible-examples
ansible-playbook <YOUR_PLAYBOOK_CMD>
```

## Use case 3: Mount external code to container
### Use case 3: Mount external code to container

Clone the code to the host then mount to container

Expand All @@ -53,7 +71,7 @@ docker run --rm -v "$(pwd)":/root/ansible_workspace --network host -v ~/.dtc:/dt
# Run the ansible code as usual
```

## Use case 4: Mount external code to container and use .ssh keys from the host
### Use case 4: Mount external code to container and use .ssh keys from the host

Clone the code to the host then mount code and `.ssh` folder to container

Expand All @@ -63,6 +81,6 @@ docker run --rm -v ~/.ssh:/root/.ssh -v "$(pwd)":/root/ansible_workspace --netwo
# Run the ansible code as usual
```

## Troubleshooting
### Troubleshooting

- For any issues, check [this reference](../troubleshooting/TROUBLESHOOTING.md)
27 changes: 23 additions & 4 deletions docs/usage/awscli_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,38 @@ Some document to help you start with awscli
- <https://docs.aws.amazon.com/cli/>
- <https://github.com/tungbq/devops-basic/tree/main/topics/aws>

## Note

## Run with devops-toolkit-cli

### Start the container

Navigate to your workspace folder, then run:

```bash
devops-toolkit-cli init
devops-toolkit-cli run

# You now in the container terminal. Execute the awscli command normally
awscli --version
```

It will mount the workspace code to container and you then can execute desired scripts inside the `devops-toolkit` container.

## Run with Docker command

### Note

To use the existing container instead of creating one, use `docker exec` command instead of `docker run`

```bash
docker exec -it my_devops_toolkit /bin/bash
```

## Common Run Modes
### Common Run Modes

For instructions on common run modes, visit [**DevOps Toolkit Common Run Mode**](../usage/run_mode.md).

## Use case 1: Configure credentials and list S3 bucket with awscli
### Use case 1: Configure credentials and list S3 bucket with awscli

```bash
docker run --rm --network host -it -v ~/.dtc:/dtc tungbq/devops-toolkit:latest
Expand All @@ -46,6 +65,6 @@ Default region name [None]: xxxxxxxx
Default output format [None]: xxxxxxxx
```

## Troubleshooting
### Troubleshooting

- For any issues, check [this reference](../troubleshooting/TROUBLESHOOTING.md)
28 changes: 23 additions & 5 deletions docs/usage/azurecli_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,44 @@ Some document to help you start with azurecli

- <https://learn.microsoft.com/en-us/cli/azure/>

## Note
## Run with devops-toolkit-cli

### Start the container

Navigate to your workspace folder, then run:

```bash
devops-toolkit-cli init
devops-toolkit-cli run

# You now in the container terminal. Execute the az command normally
az --version
```

It will mount the workspace code to container and you then can execute desired scripts inside the `devops-toolkit` container.

## Run with Docker command

### Note

To use the existing container instead of creating one, use `docker exec` command instead of `docker run`

```bash
docker exec -it my_devops_toolkit /bin/bash
```

## Common Run Modes
### Common Run Modes

For instructions on common run modes, visit [**DevOps Toolkit Common Run Mode**](../usage/run_mode.md).

## Use case 1: Az login and run command
### Use case 1: Az login and run command

```bash
docker run --rm -it -v ~/.dtc:/dtc tungbq/devops-toolkit:latest

# Login with AZ CLI
az login --use-device-code
## To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code <SHOWN_IN_SCREEN> to authenticate
### To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code <SHOWN_IN_SCREEN> to authenticate

# List all resource groups
az group list
Expand All @@ -55,6 +73,6 @@ root@f097467db632:~# az group list
]
```

## Troubleshooting
### Troubleshooting

- For any issues, check [this reference](../troubleshooting/TROUBLESHOOTING.md)
2 changes: 2 additions & 0 deletions docs/usage/devops_toolkit_cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Document for devops-toolkit-cli
- TODO
26 changes: 22 additions & 4 deletions docs/usage/helm_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,37 @@ Some document to help you start with helm
- <https://helm.sh/docs/>
- <https://github.com/tungbq/devops-basic/tree/main/topics/helm>

## Note
## Run with devops-toolkit-cli

### Start the container

Navigate to your workspace folder, then run:

```bash
devops-toolkit-cli init
devops-toolkit-cli run

# You now in the container terminal. Execute the helm command normally
helm --version
```

It will mount the workspace code to container and you then can execute desired scripts inside the `devops-toolkit` container.

## Run with Docker command

### Note

To use the existing container instead of creating one, use `docker exec` command instead of `docker run`

```bash
docker exec -it my_devops_toolkit /bin/bash
```

## Common Run Modes
### Common Run Modes

For instructions on common run modes, visit [**DevOps Toolkit Common Run Mode**](../usage/run_mode.md).

## Use case 1: Deploy an application with Helm
### Use case 1: Deploy an application with Helm

```bash
docker run --rm --network host -it -v ~/.dtc:/dtc tungbq/devops-toolkit:latest
Expand Down Expand Up @@ -58,6 +76,6 @@ CHART VERSION: 9.23.0
APP VERSION: 8.0.36
```

## Troubleshooting
### Troubleshooting

- For any issues, check [this reference](../troubleshooting/TROUBLESHOOTING.md)
26 changes: 22 additions & 4 deletions docs/usage/kubectl_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,37 @@ Some document to help you start with kubernetes (k8s)
- <https://kubernetes.io/docs/home/>
- <https://github.com/tungbq/devops-basic/tree/main/topics/k8s>

## Note
## Run with devops-toolkit-cli

### Start the container

Navigate to your workspace folder, then run:

```bash
devops-toolkit-cli init
devops-toolkit-cli run

# You now in the container terminal. Execute the kubectl command normally
kubectl --version
```

It will mount the workspace code to container and you then can execute desired scripts inside the `devops-toolkit` container.

## Run with Docker command

### Note

To use the existing container instead of creating one, use `docker exec` command instead of `docker run`

```bash
docker exec -it my_devops_toolkit /bin/bash
```

## Common Run Modes
### Common Run Modes

For instructions on common run modes, visit [**DevOps Toolkit Common Run Mode**](../usage/run_mode.md).

## Use case 1: Use kube config from the host
### Use case 1: Use kube config from the host

Mount the `.kube/config` file from the host to container

Expand Down Expand Up @@ -56,6 +74,6 @@ NAME READY UP-TO-DATE AVAILABLE AGE
nginx-deployment 2/2 2 2 115s
```

## Troubleshooting
### Troubleshooting

- For any issues, check [this reference](../troubleshooting/TROUBLESHOOTING.md)
Loading

0 comments on commit 911b8a7

Please sign in to comment.