diff --git a/.gitignore b/.gitignore index 0f20302cf..778fe2465 100644 --- a/.gitignore +++ b/.gitignore @@ -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/* @@ -9,3 +16,4 @@ # secrets folder **/.secrets/** +takeoff/takeoff_lib/test/test.dart diff --git a/scripts/pipelines/gcloud/templates/package/package-setup-environment.sh b/scripts/pipelines/gcloud/templates/package/package-setup-environment.sh index 522857d63..e8101145b 100755 --- a/scripts/pipelines/gcloud/templates/package/package-setup-environment.sh +++ b/scripts/pipelines/gcloud/templates/package/package-setup-environment.sh @@ -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 \ No newline at end of file +fi diff --git a/scripts/quickstart/gcloud/quickstart-wayat-backend.sh b/scripts/quickstart/gcloud/quickstart-wayat-backend.sh old mode 100755 new mode 100644 diff --git a/scripts/quickstart/gcloud/quickstart-wayat.sh b/scripts/quickstart/gcloud/quickstart-wayat.sh new file mode 100644 index 000000000..1295e2b92 --- /dev/null +++ b/scripts/quickstart/gcloud/quickstart-wayat.sh @@ -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 \ No newline at end of file diff --git a/takeoff/README.asciidoc b/takeoff/README.asciidoc new file mode 100644 index 000000000..68c60d14f --- /dev/null +++ b/takeoff/README.asciidoc @@ -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/516-takeoff-gui-and-cli-documentation/takeoff/takeoff_cli/README.asciidoc +:url-use-gui: https://github.com/devonfw/hangar/blob/516-takeoff-gui-and-cli-documentation/takeoff/takeoff_gui/README.asciidoc + +* {url-use-cli}[TakeOff CLI] +* {url-use-gui}[TakeOff GUI] diff --git a/takeoff/_docs/rocket_logo.png b/takeoff/_docs/rocket_logo.png new file mode 100644 index 000000000..2b06ec3ac Binary files /dev/null and b/takeoff/_docs/rocket_logo.png differ diff --git a/takeoff/takeoff_cli/README.asciidoc b/takeoff/takeoff_cli/README.asciidoc new file mode 100644 index 000000000..272baec37 --- /dev/null +++ b/takeoff/takeoff_cli/README.asciidoc @@ -0,0 +1,68 @@ += TakeOff CLI + +``` +takeoff_cli [arguments] +``` + +image::documentation/assets/takeoff_cli.png[800,800] + +== Commands +``` + aws Using AWS Cloud Services. + azure Using Azure Cloud Services. + gc Using Google Cloud Services. + quickstart +``` + +== Subcommands +``` + init --account [account] Initialize the account which will use the selected cloud provider. + create [arguments] Creates a new project in the specified cloud provider and sets up the environment. + run --project [projectId] Creates a shell with the selected project and the TakeOff service account. + list List all the projects created from TakeOff with the selected Cloud Provider. + web --project [projectId] [arguments] Open in web browser project resource. + clean --id [projectId] Removes all the local data of the provided project. + This will not delete the project in the cloud provider. +``` + +== Create arguments +``` + -h, --help + -n, --name Project name / ProjectId + -a, --billing-account Billing account + -b, --backend-language The technology for the BackEnd. Required if no frontend-language is specified. + [node, python, quarkus, quarkus-jvm] + --backend-version The version for the backend-language. This will have no effect unless backend-language is specified. + -f, --frontend-language The technology for the FrontEnd. Required if no backend-language is specified. + [angular, flutter] + --frontend-version The version for the frontend-language. This will have no effect unless frontend-language is specified. + -r, --region Cloud region in which the project will be created. +``` + +== Web arguments +``` + -h, --help + -p, --project [Required] ProjectId which resource need open. + -r, --resource [Required] Resource type [ide, pipeline, frontend repository, backend repository]. +``` + +== QuickStart commands +``` + viplane Automatically creates and deploys all the necessary services and resources to have VipLane on the cloud + wayat Automatically creates and deploys all the necessary services and resources to have Wayat on the cloud. +``` + +== Examples +* Windows: +``` + .\takeoff_cli gc init --account user@email.com + .\takeoff_cli gc create -n takeoff-test-project -a [billing-account] -b python 3.10 -f flutter 3.3.7 -r europe-west1 + .\takeoff_cli gc web -p takeoff-test-project -r pipeline +``` + +* Linux: +``` + ./takeoff_cli gc init --account user@email.com + ./takeoff_cli gc create -n takeoff-test-project -a [billing-account] -b python 3.10 -f flutter 3.3.7 -r europe-west1 + ./takeoff_cli gc web -p takeoff-test-project -r pipeline +``` diff --git a/takeoff/takeoff_cli/README.md b/takeoff/takeoff_cli/README.md deleted file mode 100644 index 3816eca3a..000000000 --- a/takeoff/takeoff_cli/README.md +++ /dev/null @@ -1,2 +0,0 @@ -A sample command-line application with an entrypoint in `bin/`, library code -in `lib/`, and example unit test in `test/`. diff --git a/takeoff/takeoff_cli/bin/takeoff_cli.exe b/takeoff/takeoff_cli/bin/takeoff_cli.exe new file mode 100644 index 000000000..5823a86ea Binary files /dev/null and b/takeoff/takeoff_cli/bin/takeoff_cli.exe differ diff --git a/takeoff/takeoff_cli/documentation/assets/takeoff_cli.png b/takeoff/takeoff_cli/documentation/assets/takeoff_cli.png new file mode 100644 index 000000000..c9698b63f Binary files /dev/null and b/takeoff/takeoff_cli/documentation/assets/takeoff_cli.png differ diff --git a/takeoff/takeoff_cli/documentation/diagrams/takeoff_diagram.png b/takeoff/takeoff_cli/documentation/diagrams/takeoff_diagram.png new file mode 100644 index 000000000..3e86d38f0 Binary files /dev/null and b/takeoff/takeoff_cli/documentation/diagrams/takeoff_diagram.png differ diff --git a/takeoff/takeoff_gui/README.asciidoc b/takeoff/takeoff_gui/README.asciidoc new file mode 100644 index 000000000..238ac8f4a --- /dev/null +++ b/takeoff/takeoff_gui/README.asciidoc @@ -0,0 +1,17 @@ += TakeOff GUI + +image::documentation/assets/takeoff_main.png[700,700] + +== Usage + +* Create a new project that will import and deploy a real application in your account almost automatically with Quickstart + +image::documentation/assets/takeoff_quickstart.png[700,700] + +* Create a new empty project (no preexisting code imported) using the `Create` option + +image::documentation/assets/takeoff_create.png[700,700] + +* Manage projects created with TakeOff with the resource screen to open the cloud IDE, pipelines, Frontend repository or Backend repository in your browser + +image::documentation/assets/takeoff_resources.png[700,700] diff --git a/takeoff/takeoff_gui/README.md b/takeoff/takeoff_gui/README.md deleted file mode 100644 index eb4b1476c..000000000 --- a/takeoff/takeoff_gui/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Take Off GUI - -This is a GUI to ease use of take off quickly create a cloud environment ready for production and development diff --git a/takeoff/takeoff_gui/assets/images/rocket_logo.png b/takeoff/takeoff_gui/assets/images/rocket_logo.png index eecef35b4..2b06ec3ac 100644 Binary files a/takeoff/takeoff_gui/assets/images/rocket_logo.png and b/takeoff/takeoff_gui/assets/images/rocket_logo.png differ diff --git a/takeoff/takeoff_gui/documentation/assets/takeoff_create.png b/takeoff/takeoff_gui/documentation/assets/takeoff_create.png new file mode 100644 index 000000000..09fa928be Binary files /dev/null and b/takeoff/takeoff_gui/documentation/assets/takeoff_create.png differ diff --git a/takeoff/takeoff_gui/documentation/assets/takeoff_main.png b/takeoff/takeoff_gui/documentation/assets/takeoff_main.png new file mode 100644 index 000000000..1ddc5d2b5 Binary files /dev/null and b/takeoff/takeoff_gui/documentation/assets/takeoff_main.png differ diff --git a/takeoff/takeoff_gui/documentation/assets/takeoff_quickstart.png b/takeoff/takeoff_gui/documentation/assets/takeoff_quickstart.png new file mode 100644 index 000000000..be8d1ddfd Binary files /dev/null and b/takeoff/takeoff_gui/documentation/assets/takeoff_quickstart.png differ diff --git a/takeoff/takeoff_gui/documentation/assets/takeoff_resources.png b/takeoff/takeoff_gui/documentation/assets/takeoff_resources.png new file mode 100644 index 000000000..55f47a726 Binary files /dev/null and b/takeoff/takeoff_gui/documentation/assets/takeoff_resources.png differ diff --git a/takeoff/takeoff_gui/documentation/diagrams/takeoff_diagram.png b/takeoff/takeoff_gui/documentation/diagrams/takeoff_diagram.png new file mode 100644 index 000000000..3e86d38f0 Binary files /dev/null and b/takeoff/takeoff_gui/documentation/diagrams/takeoff_diagram.png differ diff --git a/takeoff/takeoff_lib/README.asciidoc b/takeoff/takeoff_lib/README.asciidoc new file mode 100644 index 000000000..0c12347ff --- /dev/null +++ b/takeoff/takeoff_lib/README.asciidoc @@ -0,0 +1,32 @@ += TakeOff LIB + +Export any libraries intended for clients of this package. + +== Lib contains: +``` + export 'src/takeoff_facade.dart'; + export 'src/utils/logger/log.dart'; + export 'src/domain/cloud_provider.dart'; + export 'src/domain/cloud_provider_id.dart'; + export 'src/domain/language.dart'; + export 'src/domain/resource.dart'; + export 'src/domain/gui_message/gui_message.dart'; + export 'src/domain/gui_message/input_type.dart'; + export 'src/domain/gui_message/message_type.dart'; + export 'src/controllers/cloud/common/hangar/project/create_project_exception.dart'; + export 'src/utils/url_launcher/url_launcher.dart'; + export 'src/domain/resource.dart'; +``` + +== Using +``` + import 'package:takeoff_lib/src/[folder]/[subfolder]/[filename].dart' +``` + +== Example +``` + import 'package:takeoff_lib/src/utils/logger/log.dart' + import 'package:takeoff_lib/src/domain/gui_message/gui_message.dart'; + import 'package:takeoff_lib/src/controllers/cloud/common/hangar/project/create_project_exception.dart'; + +``` diff --git a/takeoff/takeoff_lib/README.md b/takeoff/takeoff_lib/README.md deleted file mode 100644 index 8b55e735b..000000000 --- a/takeoff/takeoff_lib/README.md +++ /dev/null @@ -1,39 +0,0 @@ - - -TODO: Put a short description of the package here that helps potential users -know whether this package might be useful for them. - -## Features - -TODO: List what your package can do. Maybe include images, gifs, or videos. - -## Getting started - -TODO: List prerequisites and provide or point to information on how to -start using the package. - -## Usage - -TODO: Include short and useful examples for package users. Add longer examples -to `/example` folder. - -```dart -const like = 'sample'; -``` - -## Additional information - -TODO: Tell users more about the package: where to find more information, how to -contribute to the package, how to file issues, what response they can expect -from the package authors, and more.