mirror of
https://github.com/bluxmit/alnoda-workspaces.git
synced 2024-09-30 09:16:14 +13:00
remove blast-radius from UI in ansible-terraform workspace
This commit is contained in:
parent
40ce80f95e
commit
aaa4474d64
9 changed files with 66 additions and 53 deletions
|
@ -22,8 +22,7 @@ port_increments = {
|
||||||
"TERMINAL_URL": 6,
|
"TERMINAL_URL": 6,
|
||||||
"MC_URL": 7,
|
"MC_URL": 7,
|
||||||
"HTOP_URL": 8,
|
"HTOP_URL": 8,
|
||||||
"ANSIBLE_ARA": 9,
|
"ANSIBLE_ARA": 9
|
||||||
"TERRAFORM_BLAST_RADIUS": 10
|
|
||||||
}
|
}
|
||||||
|
|
||||||
workspace_meta = {
|
workspace_meta = {
|
||||||
|
@ -45,7 +44,7 @@ workspace_meta = {
|
||||||
},
|
},
|
||||||
"ansible-terraform-workspace": {
|
"ansible-terraform-workspace": {
|
||||||
"port-range": 15,
|
"port-range": 15,
|
||||||
"entrypoints": ["DOCS_URL", "FILEBROWSER_URL", "STATICFS_URL", "CRONICLE_URL", "UNGIT_URL", "IDE_URL", "TERMINAL_URL", "MC_URL", "HTOP_URL", "ANSIBLE_ARA", "TERRAFORM_BLAST_RADIUS"]
|
"entrypoints": ["DOCS_URL", "FILEBROWSER_URL", "STATICFS_URL", "CRONICLE_URL", "UNGIT_URL", "IDE_URL", "TERMINAL_URL", "MC_URL", "HTOP_URL", "ANSIBLE_ARA"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
while getopts i:o: flag
|
|
||||||
do
|
|
||||||
case "${flag}" in
|
|
||||||
i) inventory=${OPTARG};;
|
|
||||||
o) output_dir=${OPTARG};;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "${output_dir}" ]; then output_dir="/home/static-server/terraform-reports/"; fi
|
|
||||||
project_name=${PWD##*/}
|
|
||||||
printf '%s\n' "project name - ${project_name}"
|
|
||||||
report_dir="${output_dir}/${project_name}/$(date +"%d-%m-%Y-%H-%M-%S")"
|
|
||||||
mkdir -p "$report_dir"
|
|
||||||
|
|
||||||
# terraform-docs
|
|
||||||
terrascan scan > ${report_dir}/terrascan.txt
|
|
||||||
|
|
||||||
# Terraform Graph
|
|
||||||
terraform graph | dot -Tsvg > .${report_dir}/graph.svg
|
|
||||||
|
|
||||||
# Terraform Visual
|
|
||||||
terraform plan -out=${report_dir}/plan.out
|
|
||||||
terraform show -json ${report_dir}/plan.out > ${report_dir}/plan.json
|
|
||||||
cd ${report_dir} && terraform-visual --plan ${report_dir}/plan.json
|
|
||||||
|
|
|
@ -126,5 +126,6 @@ RUN echo "------------------------------------------------------ ansible ara" \
|
||||||
&& find /home -type f | xargs -I{} chown abc {}
|
&& find /home -type f | xargs -I{} chown abc {}
|
||||||
|
|
||||||
USER abc
|
USER abc
|
||||||
COPY README.md /home/docs/docs/get-started.md
|
|
||||||
|
COPY README.md /home/docs/docs/docs.md
|
||||||
COPY ./examples/terraform-scaleway /home/terraform
|
COPY ./examples/terraform-scaleway /home/terraform
|
|
@ -36,12 +36,9 @@ and open [localhost:8020](http://localhost:8020) in browser
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
The workspace contains browser-based Visual Studio Code, and other browser-based tools that make it comfortable working with dockerized
|
The workspace contains browser-based Visual Studio Code and multiple tools which make working with Ansible and Terraform more convenient.
|
||||||
environments.
|
|
||||||
|
|
||||||
[GIF]
|
**Ansible tools:**
|
||||||
|
|
||||||
Workspace has the following Ansible tools installed:
|
|
||||||
|
|
||||||
- [**Ansible Ara**](https://github.com/ansible-community/ara). Configured to track execution of all ansible playbooks, has UI.
|
- [**Ansible Ara**](https://github.com/ansible-community/ara). Configured to track execution of all ansible playbooks, has UI.
|
||||||
- [**Ansible-pre-commit**](https://github.com/adarnimrod/ansible-pre-commit)
|
- [**Ansible-pre-commit**](https://github.com/adarnimrod/ansible-pre-commit)
|
||||||
|
@ -52,7 +49,7 @@ Workspace has the following Ansible tools installed:
|
||||||
- [**Ansible Mitogen**](https://mitogen.networkgenomics.com/ansible_detailed.html)
|
- [**Ansible Mitogen**](https://mitogen.networkgenomics.com/ansible_detailed.html)
|
||||||
- [**Ansible Doctor**](https://ansible-doctor.geekdocs.de/)
|
- [**Ansible Doctor**](https://ansible-doctor.geekdocs.de/)
|
||||||
|
|
||||||
Workspace has the following Terraform tools installed:
|
**Terraform tools:**
|
||||||
|
|
||||||
- [**Pre-commit-terraform**](https://github.com/antonbabenko/pre-commit-terraform)
|
- [**Pre-commit-terraform**](https://github.com/antonbabenko/pre-commit-terraform)
|
||||||
- [**Blast-Radius**](https://github.com/28mm/blast-radius). Has UI, visualizes any terraform project in folder /home/terraform/.
|
- [**Blast-Radius**](https://github.com/28mm/blast-radius). Has UI, visualizes any terraform project in folder /home/terraform/.
|
||||||
|
@ -60,11 +57,11 @@ Workspace has the following Terraform tools installed:
|
||||||
- [**Terraform Graph**](https://www.terraform.io/docs/cli/commands/graph.html)
|
- [**Terraform Graph**](https://www.terraform.io/docs/cli/commands/graph.html)
|
||||||
- [**Inframap**](https://github.com/cycloidio/inframap)
|
- [**Inframap**](https://github.com/cycloidio/inframap)
|
||||||
|
|
||||||
Workspace has the following common tools installed:
|
**Common tools:**
|
||||||
|
|
||||||
- **Workspace UI** - Browser-based UI for Ansible-Terraform Workspace. Launch all workspace tools from one place. Customize to your yown needs.
|
- **Workspace UI** - Browser-based UI for Ansible-Terraform Workspace. Launch all workspace tools from one place. Customize to your yown needs.
|
||||||
- [**Eclipse Theia**](https://theia-ide.org/docs/) - open source version of popular Visual Studio Code IDE. Theia is trully open-source, has
|
- [**Eclipse Theia**](https://theia-ide.org/docs/) - open source version of popular Visual Studio Code IDE. Theia is trully open-source, has
|
||||||
VS-Code extensions and works in browser. This means it can run inside a docker container on local machine or in cloud.
|
VS-Code extensions and works in browser. This means it can run inside a docker container on local machine or in cloud. For the Ansible-Terraform workspace beautiful [SynthWave '84](https://open-vsx.org/extension/RobbOwen/synthwave-vscode) theme is set by default.
|
||||||
- [**FileBrowser**](https://github.com/filebrowser/filebrowser) - manage files and folders inside the workspace, and exchange data between local environment and the workspace
|
- [**FileBrowser**](https://github.com/filebrowser/filebrowser) - manage files and folders inside the workspace, and exchange data between local environment and the workspace
|
||||||
- [**Cronicle**](https://github.com/jhuckaby/Cronicle) - task scheduler and runner, with a web based front-end UI. It handles both scheduled, repeating and on-demand jobs, targeting any number of worker servers, with real-time stats and live log viewer.
|
- [**Cronicle**](https://github.com/jhuckaby/Cronicle) - task scheduler and runner, with a web based front-end UI. It handles both scheduled, repeating and on-demand jobs, targeting any number of worker servers, with real-time stats and live log viewer.
|
||||||
- [**Static File Server**](https://github.com/vercel/serve) - view any static html sites as easy as if you do it on your local machine. Serve static websites easily.
|
- [**Static File Server**](https://github.com/vercel/serve) - view any static html sites as easy as if you do it on your local machine. Serve static websites easily.
|
||||||
|
@ -100,6 +97,60 @@ and dependencies. Workspace can be used and shared "as a whole", removing this d
|
||||||
applying Terraform code (i.e. remote Terraform state), this Workspace makes it even easier, when it is deployed on the remote
|
applying Terraform code (i.e. remote Terraform state), this Workspace makes it even easier, when it is deployed on the remote
|
||||||
cloud server, and used by multiple users.
|
cloud server, and used by multiple users.
|
||||||
|
|
||||||
|
|
||||||
|
## Ansible Features
|
||||||
|
|
||||||
|
|
||||||
|
## Terraform Features
|
||||||
|
|
||||||
|
### Terraform report
|
||||||
|
|
||||||
|
A small tool that produces several outputs from a terraform project, and visualizes terraform plan as an interactive HTML page.
|
||||||
|
|
||||||
|
If you want to try it out yourself, create key/secret for your AWS account, open workspace and create [file with AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
|
||||||
|
|
||||||
|
> `mkdir -p ~/.aws`
|
||||||
|
> `nano ~/.aws/credentials`
|
||||||
|
|
||||||
|
The file `~/.aws/credentials` would look like this
|
||||||
|
|
||||||
|
```
|
||||||
|
[terraform]
|
||||||
|
aws_access_key_id = <YOUR_AWS_KEY>
|
||||||
|
aws_secret_access_key = <YOUR_AWS_SECRET>
|
||||||
|
```
|
||||||
|
|
||||||
|
Clone this terraform example repo into your workspace
|
||||||
|
|
||||||
|
> `git clone https://github.com/pvarentsov/terraform-aws-free-tier /home/project/aws-example`
|
||||||
|
|
||||||
|
Open file `/home/project/aws-example/src/free-tier/main.tf` and comment out the part that configures S3 backend
|
||||||
|
|
||||||
|
```
|
||||||
|
terraform {
|
||||||
|
backend "s3" {}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Initialize a working Terraform directory
|
||||||
|
|
||||||
|
> `cd /home/project/aws-example/src/free-tier && terraform init`
|
||||||
|
|
||||||
|
Paste public ssh key (for the sake of example you can type anything)
|
||||||
|
|
||||||
|
> `nano ./provision/access/free-tier-ec2-key.pub`
|
||||||
|
|
||||||
|
Now you can gen erate terraform report
|
||||||
|
|
||||||
|
> `terraform-report`
|
||||||
|
|
||||||
|
Open Static file server and look on the generated files
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="./img/terraform-report.gif" alt="Htop" width="750">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
## Launch Workspace
|
## Launch Workspace
|
||||||
|
|
||||||
Workspaces - are merely docker containers, that's why managing workspaces is easy and intuitive - it is enough to know only docker commands,
|
Workspaces - are merely docker containers, that's why managing workspaces is easy and intuitive - it is enough to know only docker commands,
|
||||||
|
@ -136,7 +187,7 @@ There are several ways how to work with terminal of the the ansible-terraform wo
|
||||||
- ssh into the running the docker container (of the workspace) from your terminal
|
- ssh into the running the docker container (of the workspace) from your terminal
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/base-workspace/img/base-workspace-terminal.gif" alt="Base-Workspace terminal" width="500">
|
<img src="./img/terminal.gif" alt="Base-Workspace terminal" width="500">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
*(Browser-based terminals always work under the user you started the workspace with, the default is non root user "abc")*
|
*(Browser-based terminals always work under the user you started the workspace with, the default is non root user "abc")*
|
||||||
|
@ -165,7 +216,7 @@ You can work in Ubuntu terminal now. Execute the followinng command to know your
|
||||||
|
|
||||||
Every workspace requires range of ports. If one workspace is up and running, the ports 8020-8035 are taken.
|
Every workspace requires range of ports. If one workspace is up and running, the ports 8020-8035 are taken.
|
||||||
|
|
||||||
Ansible-terraform workspace itself uses 11 ports (8020-8030), but it is recommended to map several extra ports just in case. Having extra ports,
|
Ansible-terraform workspace itself uses 10 ports (8020-8029), but it is recommended to map several extra ports just in case. Having extra ports,
|
||||||
you can always launch new applications on these ports, and they will be immediately exposed outside of the workspace.
|
you can always launch new applications on these ports, and they will be immediately exposed outside of the workspace.
|
||||||
|
|
||||||
In order to start another workspace, you either need to stop currently runnning workspace, or to run another workspace
|
In order to start another workspace, you either need to stop currently runnning workspace, or to run another workspace
|
||||||
|
|
BIN
workspaces/ansible-terraform-workspace/img/terminal.gif
Normal file
BIN
workspaces/ansible-terraform-workspace/img/terminal.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
BIN
workspaces/ansible-terraform-workspace/img/terraform-report.gif
Normal file
BIN
workspaces/ansible-terraform-workspace/img/terraform-report.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 MiB |
|
@ -14,8 +14,7 @@ port_increments = {
|
||||||
"TERMINAL_URL": 6,
|
"TERMINAL_URL": 6,
|
||||||
"MC_URL": 7,
|
"MC_URL": 7,
|
||||||
"HTOP_URL": 8,
|
"HTOP_URL": 8,
|
||||||
"ANSIBLE_ARA": 9,
|
"ANSIBLE_ARA": 9
|
||||||
"TERRAFORM_BLAST_RADIUS": 10
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# this function name should not be changed
|
# this function name should not be changed
|
||||||
|
|
|
@ -107,12 +107,6 @@
|
||||||
"name": "Ansible Ara",
|
"name": "Ansible Ara",
|
||||||
"image": "Ara.png",
|
"image": "Ara.png",
|
||||||
"description": "Monitor for all Ansible plays"
|
"description": "Monitor for all Ansible plays"
|
||||||
},
|
|
||||||
{
|
|
||||||
"env": "TERRAFORM_BLAST_RADIUS",
|
|
||||||
"name": "Terraform Blast Radius",
|
|
||||||
"image": "Blast-radius.png",
|
|
||||||
"description": "Visualise terraform dependency graphf for a project in folder /home/terraform"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
%}
|
%}
|
||||||
|
|
|
@ -4,7 +4,3 @@ command=/bin/sh -c " ara-manage runserver 0.0.0.0:8029 "
|
||||||
stderr_logfile = /var/log/ara/stderr.log
|
stderr_logfile = /var/log/ara/stderr.log
|
||||||
stdout_logfile = /var/log/ara/arastdout.log
|
stdout_logfile = /var/log/ara/arastdout.log
|
||||||
logfile_maxbytes = 1024
|
logfile_maxbytes = 1024
|
||||||
|
|
||||||
[program:blast-radius]
|
|
||||||
directory=/home/terraform
|
|
||||||
command=/bin/sh -c " blast-radius --serve --port 8030 /home/terraform "
|
|
||||||
|
|
Loading…
Reference in a new issue