Giter VIP home page Giter VIP logo

googlecloudplatform / bank-of-anthos Goto Github PK

View Code? Open in Web Editor NEW
928.0 53.0 540.0 7.44 MB

Retail banking sample application showcasing Kubernetes and Google Cloud

Home Page: https://cymbal-bank.fsi.cymbal.dev

License: Apache License 2.0

Makefile 0.84% Shell 7.90% Dockerfile 1.54% Python 24.60% CSS 3.14% HTML 11.42% Java 35.91% HCL 13.32% JavaScript 1.35%
samples kubernetes reference-architecture sample-app fsi google-cloud gcp

bank-of-anthos's Introduction

Bank of Anthos

Website

Bank of Anthos is a sample HTTP-based web app that simulates a bank's payment processing network, allowing users to create artificial bank accounts and complete transactions.

Google uses this application to demonstrate how developers can modernize enterprise applications using Google Cloud products, including: Google Kubernetes Engine (GKE), Anthos Service Mesh (ASM), Anthos Config Management (ACM), Migrate to Containers, Spring Cloud GCP, Cloud Operations, Cloud SQL, Cloud Build, and Cloud Deploy. This application works on any Kubernetes cluster.

If you are using Bank of Anthos, please ★Star this repository to show your interest!

Note to Googlers: Please fill out the form at go/bank-of-anthos-form.

Screenshots

Sign in Home
Login User Transactions

Service architecture

Architecture Diagram

Service Language Description
frontend Python Exposes an HTTP server to serve the website. Contains login page, signup page, and home page.
ledger-writer Java Accepts and validates incoming transactions before writing them to the ledger.
balance-reader Java Provides efficient readable cache of user balances, as read from ledger-db.
transaction-history Java Provides efficient readable cache of past transactions, as read from ledger-db.
ledger-db PostgreSQL Ledger of all transactions. Option to pre-populate with transactions for demo users.
user-service Python Manages user accounts and authentication. Signs JWTs used for authentication by other services.
contacts Python Stores list of other accounts associated with a user. Used for drop down in "Send Payment" and "Deposit" forms.
accounts-db PostgreSQL Database for user accounts and associated data. Option to pre-populate with demo users.
loadgenerator Python/Locust Continuously sends requests imitating users to the frontend. Periodically creates new accounts and simulates transactions between them.

Interactive quickstart (GKE)

The following button opens up an interactive tutorial showing how to deploy Bank of Anthos in GKE:

Open in Cloud Shell

Quickstart (GKE)

  1. Ensure you have the following requirements:

  2. Clone the repository.

    git clone https://github.com/GoogleCloudPlatform/bank-of-anthos
    cd bank-of-anthos/
  3. Set the Google Cloud project and region and ensure the Google Kubernetes Engine API is enabled.

    export PROJECT_ID=<PROJECT_ID>
    export REGION=us-central1
    gcloud services enable container.googleapis.com \
      --project=${PROJECT_ID}

    Substitute <PROJECT_ID> with the ID of your Google Cloud project.

  4. Create a GKE cluster and get the credentials for it.

    gcloud container clusters create-auto bank-of-anthos \
      --project=${PROJECT_ID} --region=${REGION}

    Creating the cluster may take a few minutes.

  5. Deploy Bank of Anthos to the cluster.

    kubectl apply -f ./extras/jwt/jwt-secret.yaml
    kubectl apply -f ./kubernetes-manifests
  6. Wait for the pods to be ready.

    kubectl get pods

    After a few minutes, you should see the Pods in a Running state:

    NAME                                  READY   STATUS    RESTARTS   AGE
    accounts-db-6f589464bc-6r7b7          1/1     Running   0          99s
    balancereader-797bf6d7c5-8xvp6        1/1     Running   0          99s
    contacts-769c4fb556-25pg2             1/1     Running   0          98s
    frontend-7c96b54f6b-zkdbz             1/1     Running   0          98s
    ledger-db-5b78474d4f-p6xcb            1/1     Running   0          98s
    ledgerwriter-84bf44b95d-65mqf         1/1     Running   0          97s
    loadgenerator-559667b6ff-4zsvb        1/1     Running   0          97s
    transactionhistory-5569754896-z94cn   1/1     Running   0          97s
    userservice-78dc876bff-pdhtl          1/1     Running   0          96s
    
  7. Access the web frontend in a browser using the frontend's external IP.

    kubectl get service frontend | awk '{print $4}'

    Visit http://EXTERNAL_IP in a web browser to access your instance of Bank of Anthos.

  8. Once you are done with it, delete the GKE cluster.

    gcloud container clusters delete bank-of-anthos \
      --project=${PROJECT_ID} --region=${REGION}

    Deleting the cluster may take a few minutes.

Additional deployment options

  • Workload Identity: See these instructions.
  • Cloud SQL: See these instructions to replace the in-cluster databases with hosted Google Cloud SQL.
  • Multi Cluster with Cloud SQL: See these instructions to replicate the app across two regions using GKE, Multi Cluster Ingress, and Google Cloud SQL.
  • Istio: See these instructions to configure an IngressGateway.
  • Anthos Service Mesh: ASM requires Workload Identity to be enabled in your GKE cluster. See the workload identity instructions to configure and deploy the app. Then, apply extras/istio/ to your cluster to configure frontend ingress.
  • Java Monolith (VM): We provide a version of this app where the three Java microservices are coupled together into one monolithic service, which you can deploy inside a VM (eg. Google Compute Engine). See the ledgermonolith directory.

Documentation

Demos featuring Bank of Anthos

bank-of-anthos's People

Contributors

aablsk avatar arueth avatar askmeegs avatar aydarzaynutdinov avatar benjamin-maynard avatar bharathkkb avatar bourgeoisor avatar chadbr avatar chandranshurao14 avatar daniel-sanche avatar dependabot[bot] avatar djmailhot avatar donmccasland avatar google-cloud-policy-bot[bot] avatar gsquared94 avatar harsha6174 avatar kaariger avatar kelsk avatar lisafc avatar mathieu-benoit avatar muncus avatar murog avatar nimjay avatar oginskis avatar renovate-bot avatar shabirmean avatar sunny3728 avatar therealspaceship avatar williamg240 avatar xtineskim avatar

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

Watchers

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

bank-of-anthos's Issues

Send payment allows negative balances

Action:

  • Log into Test Account
  • Send Payment for $1 million

Expected:

  • Payment rejected as account balance is ~$5k

Actual:

  • Payment accepted and account balance is negative ~$995k

Merge balancereader and transactionhistory services

There is much duplicated code between BalanceReader and TransactionHistory. If we were to merge the two services, we could reduce the code complexity and the resource footprint of the application.

Currently, the two services both:

  • Read every transaction in the database
    • calculate a set of values
    • store the results
  • Poll for new transactions
    • update the associated values
  • Serve REST requests to retrieve said values

The only difference what value is being calculated:

  • BalanceReader: a running account balance
  • TransactionHistory: a running list of historical transactions

We could easily merge these two services and simplify the application and codebase. As an example:

AccountsReader

  • /accounts/<accountid>/balance GET
  • /accounts/<accountid>/transactions GET

skaffold build - ledger writer Docker build fails with Maven err

INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11.435 s
[INFO] Finished at: 2020-03-05T09:17:54-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.1.0:resources (default-resources) on project ledgerwriter: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:3.1.0:resources failed: A required class was missing while executing org.apache.maven.plugins:maven-resources-plugin:3.1.0:resources: org/apache/maven/shared/utils/io/FileUtils$FilterWrapper
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-resources-plugin:3.1.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/mokeefe/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/3.1.0/maven-resources-plugin-3.1.0.jar
[ERROR] urls[1] = file:/Users/mokeefe/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[2] = file:/Users/mokeefe/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[3] = file:/Users/mokeefe/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
[ERROR] urls[4] = file:/Users/mokeefe/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.7.1/plexus-component-annotations-1.7.1.jar
[ERROR] urls[5] = file:/Users/mokeefe/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[6] = file:/Users/mokeefe/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[7] = file:/Users/mokeefe/.m2/repository/org/codehaus/plexus/plexus-utils/3.1.0/plexus-utils-3.1.0.jar
[ERROR] urls[8] = file:/Users/mokeefe/.m2/repository/org/apache/maven/shared/maven-filtering/3.1.1/maven-filtering-3.1.1.jar
[ERROR] urls[9] = file:/Users/mokeefe/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.0.0/maven-shared-utils-3.0.0.jar
[ERROR] urls[10] = file:/Users/mokeefe/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
[ERROR] urls[11] = file:/Users/mokeefe/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[ERROR] urls[12] = file:/Users/mokeefe/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
[ERROR] urls[13] = file:/Users/mokeefe/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.24/plexus-interpolation-1.24.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : org.apache.maven.shared.utils.io.FileUtils$FilterWrapper
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
FATA[0054] build failed: building [ledgerwriter]: build artifact: maven build failed: exit status 1

Bug: negative balance

The ledgerwriter seems to be allowing sending funds > current balance. Check into what's causing this

initcontainers will not play well with Istio/ASM - Strict mTLS

https://discuss.istio.io/t/k8s-istio-sidecar-injection-with-other-init-containers/845

istio/istio#12038

When Istio sidecar injection is enabled for the app, and strict mutual TLS is also enabled, the app's init-db container (redis ping) will start before Istio's init container.

This is currently causing errors on a GKE cluster --

$ kubectl logs -n fsi ledgerwriter-5884b5d954-s2nmp init-db-ready
Error: Protocol error, got "\x15" as reply type byte

Although this isn't ideal, I'd recommend moving the "wait for DB" retry logic into the app code / client startup. Keeping the readiness and liveness probes is fine, but for mTLS compability, I recommend adding the "RewriteHTTP" probes to our release Deployments -- https://istio.io/docs/ops/configuration/mesh/app-health-check/#use-annotations-on-pod

Add end-to-end tests to CI

  • Add new e2e step to actions workflow (#92)
  • 1: User can log in with default account and see correct balance
  • 2: User is blocked from signing in with bad credentials
  • 3: User can create account and see zero balance
  • 4: User can deposit funds
    • See balance update
    • See transaction in history
    • See new contact show up
  • 5: User can transfer funds
    • See balance update
    • See transaction in history
    • See new contact show up
  • 6: User is blocked from sending invalid data
    • Amount > balance
    • Amount <= 0
    • Amount with more than 2 decimal digits
    • Badly formatted routing or account numbers
  • 7: User is redirected from /home to /login when not authenticated
  • 8: User is redirected from /login and /signup to /home when already authenticated

Validate Account numbers

We don't validate account numbers when you send money to a contact account. We should probably validate in the ledgerwriter, and possibly at the frontend

Handle missing services

If balancereader or transactionhistory are removed, the frontend crashes. It should still render what it can

Readiness / liveness probes are failing

Istio 1.4.6 - mTLS is not enabled (when enabled, this often causes readiness/liveness probe failure.)

Events:
  Type     Reason     Age                    From                                                        Message
  ----     ------     ----                   ----                                                        -------
  Normal   Scheduled  4m26s                  default-scheduler                                           Successfully assigned default/balancereader-f56f87c4c-szdgx to gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x
  Normal   Pulled     2m11s (x2 over 4m25s)  kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Container image "redis:alpine" already present on machine
  Normal   Created    2m11s (x2 over 4m24s)  kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Created container init-db-ready
  Normal   Started    2m11s (x2 over 4m24s)  kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Started container init-db-ready
  Normal   Pulled     2m9s                   kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Container image "docker.io/istio/proxyv2:1.4.6" already present on machine
  Normal   Created    2m9s                   kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Created container istio-init
  Normal   Started    2m9s                   kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Started container istio-init
  Normal   Created    2m8s                   kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Created container reader
  Normal   Pulled     2m8s                   kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Container image "gcr.io/megandemo/fsi/balancereader:aae97ea-dirty@sha256:bfe2905ca663f0975ad7b4d0a07c832660f335f9f0287173ea9a61286c9e439e" already present on machine
  Normal   Started    2m8s                   kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Started container reader
  Normal   Pulled     2m8s                   kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Container image "docker.io/istio/proxyv2:1.4.6" already present on machine
  Normal   Created    2m8s                   kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Created container istio-proxy
  Normal   Started    2m8s                   kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Started container istio-proxy
  Warning  Unhealthy  2m7s                   kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Readiness probe failed: HTTP probe failed with statuscode: 503
  Warning  Unhealthy  93s (x7 over 2m3s)     kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Readiness probe failed: HTTP probe failed with statuscode: 503
  Warning  Unhealthy  28s (x2 over 33s)      kubelet, gke-fsi-single-cluster-default-pool-0bdf24ed-6d9x  Liveness probe failed: HTTP probe failed with statuscode: 500

Display more informative error messages on the frontend

Currently the frontend only shows basic error messages

  • Deposit failed
  • Transaction failed
  • etc

The backend services return human-readable error messages on failures. We could update the frontend to show these informative error messages:

  • Deposit failed: invalid account number
  • Transaction failed: may not add yourself to contacts
  • etc, etc, etc

Default new user signup details to more neutral options

Use more neutral options for user signup defaults

Currently, the new user signup page defaults to user details that pinpoint the Google Seattle, South Lake Union office. Google is a global company, and this sample app is already being planned to be used in multiple places across the globe.

Suggestion: the location of 'The Charging Bull of Wall Street'

Address:  Bowling Green, New York City
State:  NY
Zip:  10004
Timezone:  GMT -5

Caches don't react to database restarts

TransactionHistory and BalanceReader act as caches to the data in ledger-db. If ledger-db is deleted and restarted, the caches will keep serving old data. They should self-destruct

Cleanup script - missing dependencies

When I run the cleanup script, some scripts appear to be missing :

./env: line 10: /home/user/bank_of_anthos/bank-of-anthos-scripts/install/common/manage-state.sh: No such file or directory
./env: line 11: load_state: command not found
WORK_DIR set to /home/user/bank_of_anthos/bank-of-anthos-scripts/install/workdir
Updated property [core/project].
./cleanup.sh: line 32: ./connect-hub/cleanup-hub.sh: No such file or directory

Update accounts-db to not allow blank contact labels

Currently, the backend allows contacts without a label. We should update the backend to always save contacts with a label.

The frontend shows that contact/external account labels are optional. If no label is provided then the contact is not saved.

Deployment dependency's - install kops into cloud shell

Perhaps someone can add in the dependency on kops being deployed within cloudshell into the README, to save on time debugging what the pre-requisites required actually are.

Installation is trivial :

curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-linux-amd64
chmod +x kops-linux-amd64
sudo mv kops-linux-amd64 /usr/local/bin/kops

CI: Add additional self-hosted runners

Description

Current CI uses one self hosed runner with github actions. With each build expected to take ~10 minutes, the queue time can grow really long. It would be helpful to have an additional runner to cut time down when several PR's are opened at once.

Add a golang service to the demo

Most K8s related customers are using golang as their default language and golang is very picky at the structure of the src code.

Maybe good to have at least one service which is written with golang.

Use config maps for shared env vars

Some services need to share variable data, like LOCAL_ROUTING_NUM and DEFAULT_ACCOUNT_ID. We should consider putting them into config maps that can be mounted into multiple pods

The 'contacts service' name seems to mismatch with its functionality

The contacts service currently handles 'contacts' and 'external accounts'. Thus, the name 'contacts service' seems to mismatch with its functionality.

  • Consider renaming the service to encapsulate both sets of functionality.
  • Consider separating the functionality into 2 services

offer instructions for on-prem clusters

I was able to deploy this on my on-prem cluster with some simple modifications.

  1. I created a namespace (kubectl create ns bank-of-anthos) to make it simple to clean up after, as on-prem clusters aren't quite as easy to build and tear down as gke in the cloud. I then modified the create secret and apply commands to include -n bank-of-anthos when running them. This is optional but probably a best practice.

  2. I modified ./kubernetes-manifests/frontend.yaml to include a loadBalancerIP field which is required when exposing services on prem. So my service definition looks like follows:

apiVersion: v1
kind: Service
metadata:
  name: frontend
spec:
  type: LoadBalancer
  loadBalancerIP: <enter available VIP here>
  selector:
    app: frontend
  ports:
  - name: http
    port: 80
    targetPort: 8080

frontend date validation

If you enter an invalid date, you get a backend failure. It would be better if we could display a warning in the frontend before submission

Consider init containers one off Job pod for secret init

This part of readme is slightly sad as it requires extra user interaction
to deploy the app, and requires another step of additional user interaction.

openssl genrsa -out jwtRS256.key 4096
openssl rsa -in jwtRS256.key -outform PEM -pubout -out jwtRS256.key.pub
kubectl create secret generic jwt-key --from-file=./jwtRS256.key --from-file=./jwtRS256.key.pub

AFAICT the resulting key is never used on developer machine and only lives in
the cluster (?). If that's the case, consider creating a one-off Job manifest
in kubernetes-manifests.yaml.

Istio's own deployment applies this practice (one-off Jobs).

Similarly, an initContainer for userservice may be also able to handle this,
though I'm not so sure about feasibility of that one as it depends on the
volume directly.

Support for running bootstrap.sh from GCP GCE (Ubuntu VM)

Support for running the bootstrap.sh script from GCP GCE (Ubuntu VM).

Right now, the script is doing this check :
if [[ $OSTYPE == "linux-gnu" && $CLOUD_SHELL == true ]]; then

I'm not sure what pre-requisites need to be in place, but certainly kubectl and helm and kops and gcloud and kubectx need to be available.

improper setup leads to successful deployment

I didn't setup rsa private keys but ran skaffold run successfully.

All pods are healthy but the frontend is not responding on its IP.

Logs show an exception, so I'm guessing a health probe that should be able to
catch this class of issues if homepage is not loading.

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[2020-04-15 14:42:27 +0000] [9] [ERROR] Exception on /payment [POST]
Traceback (most recent call last):
  File "/env/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/env/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/env/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/env/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/env/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/env/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/vmagent/app/flask_server.py", line 139, in payment
    _submit_transaction(transaction_data)
  File "/home/vmagent/app/flask_server.py", line 212, in _submit_transaction
    raise UserWarning(resp.json().get('msg', ''))
  File "/env/lib/python3.7/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/opt/python3.7/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/opt/python3.7/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/python3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

Python tests: userservice

Description

Add tests to userservice

Expected Behavior

  • Tests run in CI
  • Test cases
    • /version returns expected version with 200 OK
    • /ready returns 200 OK
    • can create user and return 201 and expected user
    • creating existing user returns 409
    • sql error results in 500 and error message
    • invalid user with missing fields returns 400
    • invalid user with mismatched password values results in 400
    • can log in with existing user
    • logging in with existing user and invalid password results in 404

dev docs don't list Java/jib requirement

docs/development.md doesn't talk about Java, so upon running skaffold build,
I've got a JDK install popup on macOS, and logs saying:

error checking cache, caching may not work as expected: getting hash for
artifact gcr.io/bank-of-anthos/balancereader: getting dependencies for
"gcr.io/bank-of-anthos/balancereader": getting jib-maven dependencies:
initial Jib dependency refresh failed: failed to get Jib dependencies:
running [/Users/ahmetb/workspace/bank-of-anthos/mvnw
jib:_skaffold-fail-if-jib-out-of-date -Djib.requiredVersion=1.4.0 --projects
src/balancereader --also-make jib:_skaffold-files-v2 --quiet --batch-mode]

Prevent replay attacks

Problem:
Duplicate transactions can be created in two ways

  1. user spams "submit" button
  2. attacker (or buggy router) copies and replays TCP packets, resulting in duplicate valid transactions reaching backend

Plan:
the frontend generates a uuid on each modal load, and passes it and a timestamp with the transaction. The ledgerwriter keeps a cache of recent uuids, and ignores duplicates and old transactions. The client generated uuid/timestamp doesn't need to be persisted to the database or trusted, this is just to weed out accidental duplicates

specify full volume paths

this isn't quite a best practice

      volumes:
      - name: keys
        secret:
          secretName: jwt-key
          items:
          - key: jwtRS256.key
            path: privatekey
          - key: jwtRS256.key.pub
            path: publickey

since the relative path e.g. /root/ can change based on user set in dockerfile
or at execution time (as a matter of fact, disabling root execution is a very
common GKE/kubernetes best practice).

Please use paths like /etc/secrets/foo etc.

Flaky smoke test

Sometimes the smoke test will fail even though the services are all running.

According to @ahmetb:

So the smoke tests fail on grep Aggregated which is actually indicating a test issue (i.e. string not found). Tests need to be better in this case.

Upgrade skaffold version

Currently using apiVersion: skaffold/v1beta15, putting us a major version behind the latest apiVersion: skaffold/v2alpha4

  • update github actions skaffold version
  • update skaffold version in config

UI Tests: Enable screenshots in CI

Description

Cypress UI Tests can generate screenshots for failing tests that are helpful for debugging. These should be pushed to storage and viewable by authors of PR's.

Expected Behavior

  • Screenshots are enabled
  • Screenshots are pushed to Storage Bucket
  • Links to screenshots are surfaced in logs
  • Screenshots are deleted on VM or CI has sufficient permission to delete screenshots on next build

Current Behavior

Screenshots are currently disabled because cypress docker container runs as root, resulting in artifacts that only root user can delete. When CI re-runs, it is unable to delete the screenshots directory from the previous build.

##[error]One or more errors occurred. (One or more errors occurred. (Access to the path '/home/user/actions-runner/_work/anthos-finance-demo/anthos-finance-demo/e2e/cypress/screenshots/login_spec.js/Bad Credentials on Form Submission -- fails with alert banner (failed).png' is denied.)) (Access to the path '/home/user/actions-runner/_work/anthos-finance-demo/anthos-finance-demo/e2e/cypress/screenshots/login_spec.js/Bad Credentials on Form Submission -- fails with alert banner (failed).png' is denied.)
##[error]Exit code 1 returned from process: file name '/home/user/actions-runner/bin.2.168.0/Runner.PluginHost', arguments 'action "GitHub.Runner.Plugins.Repository.v1_0.CheckoutTask, Runner.Plugins"'.

Possible solutions

  • Run cypress as non-root
  • Modify permissions on screenshots/ dir
  • Move screenshots out of _work dir (temp fix, would need to be cleaned up manually)

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.