Git Product home page Git Product logo

vmware-tanzu / application-accelerator-samples Goto Github PK

View Code? Open in Web Editor NEW
42.0 7.0 170.0 87.43 MB

Project for samples to be used with "Application Accelerator for VMware Tanzu" which is part of "VMware Tanzu Application Platform".

Home Page: https://docs.vmware.com/en/VMware-Tanzu-Application-Platform/index.html

License: MIT No Attribution

Java 59.35% Starlark 4.11% HTML 2.73% JavaScript 4.31% Shell 1.13% Python 1.79% CSS 4.08% C# 1.87% TypeScript 17.52% Dockerfile 0.04% Procfile 0.06% Vue 3.02%

application-accelerator-samples's Introduction

application-accelerator-samples

Overview

Application Accelerators for VMware Tanzu helps you bootstrap developing your applications and deploying them in a discoverable and repeatable way.

Enterprise Architects author and publish accelerator projects that provide developers and operators in their organization ready-made, enterprise-conformant code and configurations.

Published accelerator projects are maintained in Git repositories. You can then use Application Accelerators to create new projects based on those accelerator projects.

The Application Accelerators user interface(UI) enables you to discover available accelerators, configure them, and generate new projects to download.

How does Application Accelerators work?

Application Accelerators allow you to generate new projects from files in Git repositories. An accelerator.yaml file in the repository declares input options for the accelerator. This file also contains instructions for processing the files when you generate a new project.

Accelerator custom resources (CRs) control which repositories appear in the Application Accelerators UI. You can maintain CRs by using Kubernetes tools such as kubectl or by using the Tanzu CLI accelerator commands. The Accelerator controller reconciles the CRs with a Flux2 Source Controller to fetch files from GitHub or GitLab.

The Application Accelerators UI and IDE extension gives you a searchable list of accelerators to choose from. After you select an accelerator, the UI and IDE extension present input fields for any input options.

Application Accelerators UI and IDE extension send the input values to the Accelerator Engine for processing. The Engine then returns the project in a ZIP file. You can open the project in your favorite integrated development environment (IDE) to develop further.

Prerequisites

To use these Application Accelerators samples you need to have access to an installation of VMware Tanzu Application Platform.

Build & Run

Each Accelerator is provided in a separate directory and is its own self contained project with a README file descibing how to build it.

Testing

The test suite runs in GitHub actions om each push.

You can run the tests locally by setting the following environment variables:

export TANZU_CLI=tanzu
export CLI_PLUGIN=acc
export TEST_PATTERN=tanzu-java-web-app-*  # set this to a pattern that matches the tests you want to run
export TEST_WORKSPACE=$PWD
export ACC_SERVER_URL=<URL>  # this is the URL for Tanzu Portal (TAP-GUI) in your view cluster

Then run the tests using:

./run-test-local.sh

Documentation

Application Accelerators for VMware Tanzu documentation is provided as part of the official documentation for VMware Tanzu Application Platform

Contributing

The application-accelerator-samples project team welcomes contributions from the community. Before you start working with application-accelerator-samples, please read our Developer Certificate of Origin. All contributions to this repository must be signed as described on that page. Your signature certifies that you wrote the patch or have the right to pass it on as an open-source patch. For more detailed information, refer to CONTRIBUTING.md.

License

MIT No Attribution (MIT-0) License

application-accelerator-samples's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

application-accelerator-samples's Issues

Add solution file to .NET samples

If no solution file exists, VS will create one in the project root.

Adding a solution file will prevent one from being created as well as provide an additional option for opinionated configuration.

Remove Non Developer Persona Based Configuration From Spring SMTP Server

As part of the initiative to remove non developer persona based configuration files from the accelerators, this enhancement removes the installation of the RabbitMQ operator as well as configuration to create cluster instance classes and RBAC roles. Instead it will included instructions to create the RabbitMQ instance using the Tanzu CLI dynamic provisioning features and the preinstalled Bitnami services and ClusterInstance classes.

Python App Implementation In Where For Dinner

There have been requests for Where For Dinner to be more polyglot. Currently it supports the following languages

  • ReactJS for Front End UI
  • Java/Spring for all other backend services.

This enhancement will provide an alternative to the crawler application in the form of a python web application. It will also include an accelerator option to toggle between current Java/Spring implementations and alternate service implementations written in other languages. For backward compatibility, the default option will continue to use Java/Spring for all backend services.

Steeltoe sample app has incorrect app title

The Steeltoe sample app title should be "Steeltoe Weather Forecast" but is instead "C# Weather Forecast".

To reproduce, fetch app root, e.g.:

$ http http://<APP>/ | grep '<title>'
    <title>C# Weather Forecast</title>

Expected:

$ http http://<APP>/ | grep '<title>'
    <title>Steeltoe Weather Forecast</title>

Where For Dinner Incorrect Redirect URL with AppSSO

The TAP 1.5 version of where for dinner submits the wrong redirect URL to AppSSO when attempting to log in. This is causing an error in AppSSO in that it doesn't recognized the URL as a registered redirect URL. This appears to be something introduced in Spring Boot 3.0.4.

[Enhancement Request] Steeltoe accelerators - project name validation to check for C# syntax

While generating from either weatherforecast-csharp or weatherforecast-steeltoe, one of the required params is an application name.
Screenshot 2023-01-26 at 4 13 57 PM

Although defaulted to 'Sample', a user may modify this to a different value - e.g. weatherforecast-steeltoe. This application name affects the following generated files:

generated from weatherforecast-steeltoe accelerator:

These 2 cs files are syntactically incorrect to a C# compiler.

This request is to either:

  • add validation to the application name before generating accelerator artifacts
    or
  • massage the application name input to be syntactically correct in C#

Support TAP Spring Cloud Gateway in Where For Dinner

Where For Dinner will support configuration options to utilize the optional TAP Spring Cloud Gateway package instead of the OSS gateway deployment. This will include:

  • Gateway instance creating
  • Mapping and route configuration
  • Ingress configuration
  • Links to documentation that include optional TLS configuration
  • Single logout URL configuration for OSS and TAP Spring Cloud Gateway

Add sample appsso-starter-java

All samples are moving to the new VMware Tanzu OSS repo - https://github.com/vmware-tanzu/application-accelerator-samples

We need to add the app-sso-starter sample from https://github.com/sample-accelerators/tanzu-java-web-app in a directory named appsso-starter-java.

Tasks for updating each sample:

  • Add/Change license file to MIT-0 license (same as in the root of this repo)
  • Update paths in README and workload.yaml files to point to this repo using main branch and the subPath of the new directory.

Notes for VMware contributors:

Some potential defects in spring-smtp-sample

To get it going for use in intellij demo I had to change a few things.

  • portforward in the Tiltfile is 1025 whereas the actual port seems to be 1026 (as per the workload.yml)
  • the name of the gateway sub-project is wrong in Tiltfile. It is using spring-smtp-gateway throughout, but the actual name is just smtp-gateway. I had to basically do a search replace in there to fix it.
  • the pod selectors in both Tiltfiles are wrong and needed to be changed to these:
k8s_resource('smtp-gateway', port_forwards=["1026:1026"],
    extra_pod_selectors=[{'carto.run/workload-name': 'smtp-gateway'}])

k8s_resource('smtp-sink', port_forwards=[],
    extra_pod_selectors=[{'carto.run/workload-name': 'smtp-sink'}])

I am not sure this is actually 100% correct too (maybe it selects too many pods, such as build pods, instead of just run pods). But what is in the file currently, selecting based on serving.knative.dev/service doesn't work at all. Presumably this is because of the workload type being server and worker and so they don't actually result in creation of any knative services (as a web type workload would do).

Maven web app cannot be deployed inside airgap

The tanzu-java-web-app sample vendors the mvnw, mvnw.cmd, and .mvn/wrapper/maven-wrapper.properties files.

Unfortunately, this makes it quite a bit less intuitive to deploy this application inside of an airgapped installation. Specifically, the maven-wrapper.properties file contains URLs that refer to locations on the open internet:

distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar

Users trying to deploy this app into an airgapped environment will just see an unexplained connection timeout error when their app is being built by the Tanzu Java buildpack. Specifically, the buildpack is trying to call into mvnw, which then is referencing these addresses on the public internet.

The Java Buildpack (specifically, the Maven Buildpack) is capable of installing Maven dependencies without needing for this mvnw file or its configuration to be checked in.

As a resolution, we've recommended to users attempting to deploy this application into offline environments remove the above listed files. Would we consider doing the same here in the canonical sample repo?

Add simple API to Where For Dinner for inner loop validation testing

Release engineering has requested a simple API in a Where For Dinner service so they can validate changes occurring in the inner loop process.

The availability service will implement a simple application version API that can be queried via a simple REST client. This will allow them to be able to validate changes to the API implementation using tools like curl.

README for tap-workload fragment is wrong

The tap-workload fragment is meant to be used with the repo creation feature.
It expects values provided by TAP-GUI (bsGitRepository and bsGitBranch) that use a special format for the url which should be considered an implementation detail of TAP-GUI and subject to change.

The README, although advocating to not use the fragment "directly", mentions repoUrl as an option. It is not. This is a computed value.

Accelerator java-rest-service does not show correct options in the UI

The java-rest-service accelerator has some options that depend on the selected database type.
For example databasePostgresMonitoringClass should only be shown if the database type is postgres.

This functionality is currently broken, and all options from spring-boot-postgresql and spring-boot-mysql show regardless of the database type that has been selected.

Invalid branch referenced in secure option of hungryman

The branch for the “secure” option of the ui app is “sucure-ui” which does not exist in this repo. This option is marked as experimental and is not part of the default deployment. The “main” branch can still be used for the secure option, the ui app will just not present a login button (It should automatically go to the main screen). We should update the branch to “main” for now when the secure option is selected.

Label "apps.tanzu.vmware.com/has-tests" can't have boolean value

The label apps.tanzu.vmware.com/has-tests can't have a boolean value, must be a string.

Change

  • java-rest-service/config/workload-api-provider.yaml
  • java-rest-service/config/workload-basic.yaml
  • java-server-side-ui/config/workload.yaml

to use:

metadata:
  labels:
    apps.tanzu.vmware.com/has-tests: "true"

Add samples weatherforecast-csharp and weatherforecast-steeltoe

All samples are moving to the new VMware Tanzu OSS repo - https://github.com/vmware-tanzu/application-accelerator-samples

We need to add the weatherforecast-csharp and weatherforecast-steeltoe samples from https://github.com/sample-accelerators/tanzu-java-web-app in a directories named weatherforecast-csharp and weatherforecast-steeltoe.

Tasks for updating each sample:

  • Add/Change license file to MIT-0 license (same as in the root of this repo)
  • Update paths in README and workload.yaml files to point to this repo using main branch and the subPath of the new directory.

Notes for VMware contributors:

[Observation] Tiltfile apply cmd only works with apps plugin >= 0.10.0

Hey maintainers! I was recently surprised to see my steeltoe-weatherforecast accelerator failing to apply upon tilt up. Seems like the reason is that the --update-strategy flag is only recognized by the latest version of the tanzu cli apps plugin (0.10.0).

I'm not sure that this is a fixable phenomenon (makes sense that --update-strategy is a good feature to include), but maybe tanzu apps v 0.10.0 could at least be called out as a dependency somewhere? (I didn't see it in any docs -- maybe I missed it?)

Support subPath for rewriting Git repo reference

All accelerators except hungryman and spring-smtp-gateway are updated to use the tap-workload fragment. The excluded two are multi-module projects which require usage of subPath property. This property currently isn't supported.

We should either support this in the tap-workload fragment or create a new fragment that supports modifying the subPath removing the first level of the path - subPath: hungryman/hungryman-search -> subPath: hungryman-search

Where For Dinner TAP 1.4 Compliance Updates And Ehancements

There Where For Dinner application has needs for the following:

  • AppSSO 2.0.0 updates for deprecated features. Specifically the issuerURI has been deprecated and will no be supported in future updates. The accelerator needs to use the tls.disabled: false technique as described in the AppSSO migration guide and remove the field for the issuerURI
  • A Redis cache option (vs a simple in memory cache) has been available but no utilized. This enhancement will add a Redis instance to the application when selected by the accelerator and enable the implementation in the search-proc service.
  • The search crawler service has been available for some time, but not utilized. This enhancement adds the crawler service to the application stack.

Add samples "Hungryman" and "Spring SMTP Gateway"

Add "Hungryman" and "Spring SMTP Gateway" samples.

Tasks for each sample:

  • Add/Change license file to MIT-0 license (same as in the root of this repo)
  • Update paths to point to this repo

Notes for VMware contributors:

Incorrect workload types in individual project directories of smtp server.

Workload type in the workloads.yaml file in the individual project directories used for live update is still listed as tcp and queue. This does not affect the deployment instructions as they use the workloads.yaml file in the config/developer directory which has the correct workload type. TCP and queue should still be updated to the correct workload types in the individual workload/project directories.

Code generated from the 'angular-frontend' accelerator without SSO has compilation errors

Affected accelerator: angular-frontend accelerator from TAP 1.5.0-rc.13

When the Single Sign-on option is left unchecked, the generated code doesn't compile. There are some imports/references to authorization and user-profile that linger around, but those folders are excluded for non-SSO version.

See sample errors when running build or start scripts:
Screen Shot 2023-04-03 at 3 54 16 PM

It would be nice if the accelerator transform(s) took care of those imports too.

Add validation for options that can't be left blank when exposing API endpoint

Add validation for options that can't be left blank when exposing API endpoint. This applies to the java-rest-service accelerator.

Not sure if the API entity processor should accept empty system, other entities like service components seem to allow leaving system blank.

Left system blank and see this error in the tap-gui server logs:

{
  "ts": "2022-09-18T17:00:37.730Z",
  "level": "warn",
  "meta": {
    "type": "plugin",
    "plugin": "catalog",
    "service": "backstage",
    "entity": "api:default/customer-profile-34.139.6.200.nip.io"
  },
  "msg": "Processor BuiltinKindsEntityProcessor threw an error while validating the entity api:default/customer-profile-34.139.6.200.nip.io; caused by TypeError: /spec/system must be string - type: string"
}

Tiltfile OUTPUT_TO_NULL_COMMAND not recognized on Windows

Describe the bug
After cloning the steeltoe-weatherforecast accelerator to a Windows OS, running tilt up fails by default, raising a "path not found" error:

Successfully loaded Tiltfile (3.024ms)
   sample-app â"‚ 
   sample-app â"‚ Initial Build
   sample-app â"‚ STEP 1/1 â€" Deploying
   sample-app â"‚      Running cmd: tanzu apps workload apply -f config/workload.yaml --update-strategy replace --debug --live-update --local-path . --source-image your-registry.io/project/steeltoe-weatherforecast-source --build-env BP_DEBUG_ENABLED=true --namespace default --yes  > /dev/null  && kubectl get workload sample-app --namespace default -o yaml
   sample-app â"‚      The system cannot find the path specified.
   sample-app â"‚ 
   sample-app â"‚ ERROR: Build Failed: apply command exited with status 1

To Reproduce
Steps to reproduce the behavior:

  1. Open the steeltoe-weatherforecast accelerator in Windows
  2. Invoke tilt up from the root project directory

Expected behavior
tilt up command to succeed.

Additional context

  • This error goes away after removing the OUTPUT_TO_NULL_COMMAND from the default Tiltfile's apply_cmd string.
  • > NUL might be a suitable Windows equivalent to > /dev/null

Create a fragment directory and import fragments from "sample-accelerators/fragments" repo

Import all fragments from https://github.com/sample-accelerators/fragments

The fragments should all be in their own sub-directory under a fragments directory.

Fragments to include

  • fragments/app-sso-client
  • fragments/java-version
  • fragments/live-update
  • fragments/spring-boot-app-sso-auth-code-flow
  • fragments/tap-initialize
  • fragments/tap-workload

Tasks for each fragment:

  • Update/add README.md file documenting how to create the Fragment resource and how use the fragment in an accelerator, this includes changing any repo references to use this new repo.
  • Add/Change license file to MIT-0 license (same as in the root of this repo)

Notes for VMware contributors:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.