Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Takeoff Quickstart and Access Resources #521

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@

#takeoff
takeoff/takeoff_lib/coverage/lcov.info
takeoff/takeoff_cli/takeoff_cli.exe
takeoff/takeoff_gui/.vscode/launch.json
takeoff/takeoff_gui/pubspec.lock
takeoff/takeoff_cli/bin/takeoff_cli.exe
# VSCode Config
.vscode/*

Expand All @@ -9,3 +16,4 @@

# secrets folder
**/.secrets/**
takeoff/takeoff_lib/test/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ then
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
fi
fi
Empty file modified scripts/quickstart/gcloud/quickstart-wayat-backend.sh
100755 → 100644
Empty file.
62 changes: 62 additions & 0 deletions scripts/quickstart/gcloud/quickstart-wayat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# # https://github.com/devonfw/hangar/tree/master/setup
# docker build -t hangar -f ./setup/Dockerfile .
# docker run --rm -it -v /Users/$env:UserName/AppData/Roaming/gcloud:/root/.config/gcloud -v /Users/$env:UserName/AppData/Roaming/configstore:/root/.config/configstore -v /Users/$env:UserName/.aws:/root/.aws -v /Users/$env:UserName/.azure:/root/.azure -v /Users/$env:UserName/.kube:/root/.kube -v "/Users/$env:UserName/AppData/Roaming/GitHub CLI:/root/.config/gh" -v /Users/$env:UserName/.ssh:/root/.ssh -v /Users/$env:UserName/hangar_workspace:/hangar_workspace -v /Users/$env:UserName/.gitconfig:/root/.gitconfig -v ./scripts:/scripts hangar bash
gcloud auth login
firebase login --no-localhost
echo "Please write the project ID:" && read project_id
description_project="Quickstart Wayat"
region="europe-west6"
zone="europe-west6-a"
firebase_region="europe-west6"
frontendName="Frontend-Flutter"
backendName="Backend-Python"
frontendLanguage="flutter"
frontendLanguage_version=3.3.4
backendLanguage="python"
backendLanguage_version=3.10
echo "Please write your billing account." && read billing_account
workspace_base=/workspace
mkdir -p $workspace_base/$project_id
workspace=$workspace_base/$project_id
sa_name=sa-hangar
# Create project
/scripts/accounts/gcloud/create-project.sh -n "$project_id" -d "$description_project" -b "$billing_account" --firebase
# Create SA
/scripts/accounts/gcloud/setup-principal-account.sh -s "$sa_name" -p "$project_id" -f /scripts/accounts/gcloud/predefined-roles.txt -k "$workspace/key.json"
/scripts/accounts/gcloud/verify-principal-roles-and-permissions.sh -s $sa_name -p "$project_id" -f /scripts/accounts/gcloud/predefined-roles.txt
gcloud auth activate-service-account --key-file="$workspace/key.json"
# Create repos
/scripts/repositories/gcloud/create-repo.sh -a create -s gitflow -p "$project_id" -n "$frontendName" -d "$workspace"
/scripts/repositories/gcloud/create-repo.sh -a create -s gitflow -p "$project_id" -n "$backendName" -d "$workspace"
# Create Sonarqube
mkdir -p $workspace/sonarqube
cd /scripts/sonarqube/gcloud/
./sonarqube.sh apply --state-folder "$workspace/sonarqube" --service_account_file "$workspace/key.json" --project "$project_id" --region "$region" --zone "$zone"
sonarqube_token=$(grep "sonarqube_token" "$workspace/sonarqube/terraform.tfoutput" | cut -d' ' -f 3 | sed 's/^.//;s/.$//')
sonarqube_url=$(grep "sonarqube_url" "$workspace/sonarqube/terraform.tfoutput" | cut -d' ' -f 3 | sed 's/^.//;s/.$//')
cd /scripts
# Get Cloud Run endpoints
/scripts/quickstart/gcloud/init-cloud-run.sh -p "$project_id" -n "${frontendName,,}" -r "$region" -o "$workspace/$frontendName-url.txt"
/scripts/quickstart/gcloud/init-cloud-run.sh -p "$project_id" -n "${backendName,,}" -r "$region" -o "$workspace/$backendName-url.txt"
# Setup firebase
/scripts/accounts/gcloud/setup-firebase.sh -n "$project_id" -o "$workspace" -r "$firebase_region" --enable-maps --setup-ios --setup-android --setup-web
# Quickstart apps
echo "Manual actions required. Read the info of the last command to more information."
echo "Please write the map secret token." && read map_secret
backend_url=$(<"$workspace/$backendName-url.txt")
frontend_url=$(<"$workspace/$frontendName-url.txt")
./quickstart/gcloud/quickstart-wayat-backend.sh -p "$project_id" -w "$workspace" -d "$workspace/$backendName" --storage-bucket "$project_id".appspot.com
./quickstart/gcloud/quickstart-wayat-frontend.sh -p "$project_id" -w "$workspace" -d "$workspace/$frontendName" --keystore "$workspace/keystore.jks" --backend-url $backend_url --frontend-url $frontend_url --maps-static-secret $map_secret
echo "Manual actions required. Read the info of the last command to more information. Press enter to continue..." && read
# Create backend pipelines
/scripts/pipelines/gcloud/pipeline_generator.sh -c /scripts/pipelines/gcloud/templates/build/build-pipeline.cfg -n "${backendName,,}"-build -d "$workspace/$backendName" -l $backendLanguage --language-version $backendLanguage_version -b develop
/scripts/pipelines/gcloud/pipeline_generator.sh -c /scripts/pipelines/gcloud/templates/test/test-pipeline.cfg -n "${backendName,,}"-test -d "$workspace/$backendName" -l $backendLanguage --language-version $backendLanguage_version --build-pipeline-name "${backendName,,}"-build -b develop
/scripts/pipelines/gcloud/pipeline_generator.sh -c /scripts/pipelines/gcloud/templates/quality/quality-pipeline.cfg -n "${backendName,,}"-quality -d "$workspace/$backendName" -l $backendLanguage --language-version $backendLanguage_version --build-pipeline-name "${backendName,,}"-build --test-pipeline-name "${backendName,,}"-test --sonar-url "$sonarqube_url" --sonar-token "$sonarqube_token" -b develop
/scripts/pipelines/gcloud/pipeline_generator.sh -c /scripts/pipelines/gcloud/templates/package/package-pipeline.cfg -i "$region"-docker.pkg.dev/"$project_id"/"${backendName,,}"/"${backendName,,}" -n "${backendName,,}"-package -d "$workspace/$backendName" -l $backendLanguage --language-version $backendLanguage_version --build-pipeline-name "${backendName,,}"-build --quality-pipeline-name "${backendName,,}"-quality -b develop
/scripts/pipelines/gcloud/pipeline_generator.sh -c /scripts/pipelines/gcloud/templates/deploy-cloud-run/deploy-cloud-run-pipeline.cfg -n "${backendName,,}"-deploy -d "$workspace/$backendName" -b develop --service-name "${backendName,,}" --gcloud-region "$region"
# Create frontend web pipelines
/scripts/pipelines/gcloud/pipeline_generator.sh -c /scripts/pipelines/gcloud/templates/build/build-pipeline.cfg -n "${frontendName,,}"-build -d "$workspace/$frontendName" -l "$frontendLanguage" --language-version "$frontendLanguage_version" --registry-location "$region" -b develop -m E2_HIGHCPU_8
/scripts/pipelines/gcloud/pipeline_generator.sh -c /scripts/pipelines/gcloud/templates/test/test-pipeline.cfg -n "${frontendName,,}"-test -d "$workspace/$frontendName" -l "$frontendLanguage" --language-version "$frontendLanguage_version" --registry-location "$region" --build-pipeline-name "${frontendName,,}"-build -b develop -m E2_HIGHCPU_8
/scripts/pipelines/gcloud/pipeline_generator.sh -c /scripts/pipelines/gcloud/templates/quality/quality-pipeline.cfg -n "${frontendName,,}"-quality -d "$workspace/$frontendName" -l "$frontendLanguage" --language-version "$frontendLanguage_version" --registry-location "$region" --build-pipeline-name "${frontendName,,}"-build --test-pipeline-name "${frontendName,,}"-test --sonar-url "$sonarqube_url" --sonar-token "$sonarqube_token" -b develop -m E2_HIGHCPU_8
/scripts/pipelines/gcloud/pipeline_generator.sh -c /scripts/pipelines/gcloud/templates/package/package-pipeline.cfg -i "$region"-docker.pkg.dev/"$project_id"/"${frontendName,,}"/"${frontendName,,}" -n "${frontendName,,}"-web-package -d "$workspace/$frontendName" -l "$frontendLanguage" --language-version "$frontendLanguage_version" --build-pipeline-name "${frontendName,,}"-build --quality-pipeline-name "${frontendName,,}"-quality -b develop --registry-location "$region" --flutter-web-platform --flutter-android-platform canvaskit -m E2_HIGHCPU_8
/scripts/pipelines/gcloud/pipeline_generator.sh -c /scripts/pipelines/gcloud/templates/deploy-cloud-run/deploy-cloud-run-pipeline.cfg -n "${frontendName,,}"-web-deploy -d "$workspace/$frontendName" -b develop --service-name "${frontendName,,}" --gcloud-region "$region" --port 80 -m E2_HIGHCPU_8
6 changes: 6 additions & 0 deletions takeoff/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

# Autogenerated files
*.g.dart
*.gr.dart
*.mocks.dart
takeoff_cli/bin/takeoff_cli.exe
42 changes: 42 additions & 0 deletions takeoff/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "takeoff_cli",
"cwd": "takeoff_cli",
"console": "terminal",
"request": "launch",
"type": "dart",
"program": "bin/takeoff_cli.dart"
},
{
"name": "takeoff_gui",
"cwd": "takeoff_gui",
"request": "launch",
"type": "dart"
},
{
"name": "takeoff_gui (profile mode)",
"cwd": "takeoff_gui",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "takeoff_gui (release mode)",
"cwd": "takeoff_gui",
"request": "launch",
"type": "dart",
"flutterMode": "release"
},
{
"name": "takeoff_lib",
"cwd": "takeoff_lib",
"request": "launch",
"type": "dart"
}
]
}
41 changes: 41 additions & 0 deletions takeoff/README.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
:url-wayat: https://github.com/devonfw-forge/wayat-flutter-python-mvp

= Takeoff

image:https://img.shields.io/badge/os-Windows-GREEN.svg[]
image:https://img.shields.io/badge/os-Linux-GREEN.svg[]

image:https://img.shields.io/badge/Flutter-%2302569B.svg?style=for-the-badge&logo=Flutter&logoColor=white[]
image:https://img.shields.io/badge/GoogleCloud-%234285F4.svg?style=for-the-badge&logo=google-cloud&logoColor=white[]

image::_docs/rocket_logo.png[]

A CLI and graphical application for creating new projects in the cloud.

== What is TakeOff?
TakeOff is a simple and user-friendly graphical and command line interface and to create and projects in the Cloud.

The main use case is to be able to have a real application created and deployed in the most automated way possible (for Google Cloud, we have chosen {url-wayat}[Wayat]), so any team can take it as a base and start working on the Cloud. We call this "Quickstart".

It currently only supports Google Cloud, with support for AWS and Azure still being worked on.

== Requirements
:url-get-docker: https://docs.docker.com/get-docker/
:url-get-rancher: https://rancherdesktop.io
:url-get-docker-desktop: https://www.docker.com/products/docker-desktop/

To use TakeOff, Docker must be previously installed in one of the following ways:

* {url-get-docker}[Docker] (Linux)
* {url-get-rancher}[Rancher Desktop] (MacOS and Windows)
* {url-get-docker-desktop}[Docker Desktop] (MacOS and Windows)

image::_docs/diagrams/context_diagram/Context_Diagram.png[600,600]

== How to use TakeOff

:url-use-cli: https://github.com/devonfw/hangar/blob/takeoff_develop/takeoff/takeoff_cli/README.asciidoc
:url-use-gui: https://github.com/devonfw/hangar/blob/takeoff_develop/takeoff/takeoff_gui/README.asciidoc

* {url-use-cli}[TakeOff CLI]
* {url-use-gui}[TakeOff GUI]
27 changes: 27 additions & 0 deletions takeoff/_docs/diagrams/commands_diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@startmindmap CommandsName
<style>
mindmapDiagram {
done {
BackgroundColor lightGreen
}
progress {
BackgroundColor orange
}
notDone {
BackgroundColor #FF7276
}
}
</style>
* takeoff
** gc <<done>>
*** create <<done>>
*** run <<done>>
*** init <<done>>
*** list <<done>>
*** clean <<done>>
** aws <<notDone>>
** azure <<notDone>>
** quickstart <<progress>>
*** wayat <<progress>>
*** viplane <<notDone>>
@endmindmap
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions takeoff/_docs/diagrams/component_diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
@startuml Component_Diagram
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
!define DEVICONS https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/devicons
!define FONTAWESOME https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/font-awesome-5
!include DEVICONS/angular.puml
!include DEVICONS/java.puml
!include DEVICONS/msql_server.puml
!include FONTAWESOME/users.puml
!define osaPuml https://raw.githubusercontent.com/Crashedmind/PlantUML-opensecurityarchitecture2-icons/master
!include osaPuml/Common.puml
!include osaPuml/User/all.puml

!include <office/Servers/database_server>
!include <office/Servers/file_server>
!include <office/Servers/application_server>
!include <office/Concepts/service_application>
!include <office/Concepts/firewall>
left to right direction

AddContainerTag("db", $sprite="database_server", $legendText="database container")


Person(user, "User", "Interacts with the GUI and CLI to create/deploy on Cloud environments", $sprite="users")
Container_Ext(hangar_cont, "Hangar Container", "Docker","Contains all the hangar scripts and the tools to interact with the Cloud services")

System_Boundary(c1, "TakeOff") {
Container_Boundary(takeoff_gui, "TakeOff GUI") {
Component(gui, "GUI", $techn="Flutter", $descr="Receives the inputs from the user and calls the appropriate logic")
Component(shared_libary_gui, "Shared business logic library", $techn="Dart package", $descr="Shared package with logic library for both the CLI and GUI")

}
Container_Boundary(takeoff_cli, "TakeOff CLI") {
Component(cli, "Input Controller", $techn="dart", $descr="Reads the console commands to determine which scripts should be executed")
Component(shared_libary_cli, "Shared business logic library", $techn="Dart package", $descr="Shared package with logic library for both the CLI and GUI")

}

ContainerDb(cache, "Cache Store", "Stores user configuration", $tags="db")
}

Rel(cli, gui, "can launch")
Rel(user, gui, "Uses", "GUI")
Rel_Right(user, cli, "Uses", "CLI")
Rel(gui, shared_libary_gui, "calls")
Rel(cli, shared_libary_cli, "calls")
Rel(shared_libary_cli, hangar_cont, "Executes commands", "Docker CLI")
Rel(shared_libary_gui, hangar_cont, "Executes commands", "Docker CLI")
Rel_Right(shared_libary_cli, cache, "stores/writes")
Rel_Right(shared_libary_gui, cache, "stores/writes")
@enduml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions takeoff/_docs/diagrams/container_diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@startuml Container_Diagram
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
!define DEVICONS https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/devicons
!define FONTAWESOME https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/font-awesome-5
!include DEVICONS/angular.puml
!include DEVICONS/java.puml
!include DEVICONS/msql_server.puml
!include FONTAWESOME/users.puml
!define osaPuml https://raw.githubusercontent.com/Crashedmind/PlantUML-opensecurityarchitecture2-icons/master
!include osaPuml/Common.puml
!include osaPuml/User/all.puml

!include <office/Servers/database_server>
!include <office/Servers/file_server>
!include <office/Servers/application_server>
!include <office/Concepts/service_application>
!include <office/Concepts/firewall>
AddContainerTag("db", $sprite="database_server", $legendText="mounted volume")


Person(user, "User", "Interacts with the GUI and CLI to create/deploy on Cloud environments", $sprite="users")
Container_Ext(hangar_cont, "Hangar Container", "Docker","Contains all the hangar scripts and the tools to interact with the Cloud services")

System_Boundary(c1, "TakeOff") {
Container(flutter_gui, "TakeOff GUI", "Flutter GUI","Simplifies the interaction with TakeOff logic wrapping everything in a UI")
Container(dart_cli, "TakeOff CLI", "Dart CLI","Gets command-line arguments and executes the appropiate scripts against the Hangar container")
ContainerDb(file_cache, "Cache Store", "Stores user configuration", $tags="db")
}

System_Ext(google, "Google Cloud", "Cloud provider")
System_Ext(azure, "Azure", "Cloud provider")
System_Ext(aws, "AWS", "Cloud Provider")

Rel(user, flutter_gui, "Uses", "GUI")
Rel(user, dart_cli, "Uses", "CLI")
Rel(dart_cli, hangar_cont, "Executes commands", "Docker CLI")
Rel(flutter_gui, hangar_cont, "Executes commands", "Docker CLI")
Rel(dart_cli, file_cache, "stores/writes")
Rel(flutter_gui, file_cache, "stores/writes")

Rel(hangar_cont, google, "uses", "HTTPS")
Rel(hangar_cont, aws, "uses", "HTTPS")
Rel(hangar_cont, azure, "uses", "HTTPS")
@enduml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions takeoff/_docs/diagrams/context_diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@startuml Context_Diagram
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
!define DEVICONS https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/devicons
!define FONTAWESOME https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/font-awesome-5
!include DEVICONS/angular.puml
!include DEVICONS/java.puml
!include DEVICONS/msql_server.puml
!include FONTAWESOME/users.puml

' LAYOUT_WITH_LEGEND()

Person(user, "User", "Interacts with the GUI and CLI to create/deploy on Cloud environments", $sprite="users")
System(take_off, "TakeOff", "GUI & CLI program to Create / Manage Cloud Projects")
Container_Ext(hangar_cont, "Hangar Container", "Docker","Contains all the hangar scripts and the tools to interact with the Cloud services")

System_Ext(google, "Google Cloud", "Cloud provider")
System_Ext(azure, "Azure", "Cloud provider")
System_Ext(aws, "AWS", "Cloud Provider")

Rel(user, take_off, "Uses", "CLI / GUI")
Rel(take_off, hangar_cont, "Executes commands", "Docker CLI")
Rel(hangar_cont, google, "uses", "HTTPS")
Rel(hangar_cont, aws, "uses", "HTTPS")
Rel(hangar_cont, azure, "uses", "HTTPS")
@endum
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading