remove blast-radius from UI in ansible-terraform workspace

This commit is contained in:
bluxmit 2021-08-29 20:02:32 +00:00
parent 40ce80f95e
commit aaa4474d64
9 changed files with 66 additions and 53 deletions

View file

@ -22,8 +22,7 @@ port_increments = {
"TERMINAL_URL": 6,
"MC_URL": 7,
"HTOP_URL": 8,
"ANSIBLE_ARA": 9,
"TERRAFORM_BLAST_RADIUS": 10
"ANSIBLE_ARA": 9
}
workspace_meta = {
@ -45,7 +44,7 @@ workspace_meta = {
},
"ansible-terraform-workspace": {
"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"]
}
}

View file

@ -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

View file

@ -126,5 +126,6 @@ RUN echo "------------------------------------------------------ ansible ara" \
&& find /home -type f | xargs -I{} chown 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

View file

@ -36,12 +36,9 @@ and open [localhost:8020](http://localhost:8020) in browser
## About
The workspace contains browser-based Visual Studio Code, and other browser-based tools that make it comfortable working with dockerized
environments.
The workspace contains browser-based Visual Studio Code and multiple tools which make working with Ansible and Terraform more convenient.
[GIF]
Workspace has the following Ansible tools installed:
**Ansible tools:**
- [**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)
@ -52,7 +49,7 @@ Workspace has the following Ansible tools installed:
- [**Ansible Mitogen**](https://mitogen.networkgenomics.com/ansible_detailed.html)
- [**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)
- [**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)
- [**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.
- [**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
- [**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.
@ -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
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
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
<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>
*(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.
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.
In order to start another workspace, you either need to stop currently runnning workspace, or to run another workspace

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 MiB

View file

@ -14,8 +14,7 @@ port_increments = {
"TERMINAL_URL": 6,
"MC_URL": 7,
"HTOP_URL": 8,
"ANSIBLE_ARA": 9,
"TERRAFORM_BLAST_RADIUS": 10
"ANSIBLE_ARA": 9
}
# this function name should not be changed

View file

@ -107,12 +107,6 @@
"name": "Ansible Ara",
"image": "Ara.png",
"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"
}
]
%}

View file

@ -4,7 +4,3 @@ command=/bin/sh -c " ara-manage runserver 0.0.0.0:8029 "
stderr_logfile = /var/log/ara/stderr.log
stdout_logfile = /var/log/ara/arastdout.log
logfile_maxbytes = 1024
[program:blast-radius]
directory=/home/terraform
command=/bin/sh -c " blast-radius --serve --port 8030 /home/terraform "