Guide to the CloudTruth Demo

A reference implementation for the CloudTruth Solution.

The CloudTruth Demo provides an example of using CloudTruth Parameters and Templates to configure a simple web application and backend service. All source files and configuration are hosted as part of a GitHub organization. The organization consists of three repositories: web, ops, and service.

Both the web client and the json service are deployed to AWS using Github Actions for CI/CD.

You can browse (.github/workflows/cd.yml) within each repository as a guide for integrating CloudTruth with your own CI/CD system.

For example, the command below within (web/.github/workflows/cd.yml) uses curl to retrieve the results of a CloudTruth template, directed to a .env file.

- name: Configure react
run: curl -sfL https://api.cloudtruth.com/t/${DEPLOY_WEB_DOTENV_TID}/${ENV} > .env

The resulting .env file looks something like:

REACT_APP_DEMO1_ADDRESS="https://demo1.demo.cloudtruth.dev"
REACT_APP_CONFIG_TID="xxxxxxxx-xxxx-xxxx-xxxx-2e11683d590d"
REACT_APP_ENV="default"
REACT_APP_POLLING_INTERVAL=14000

This .env file is used to configure the demo web application during deployment.

The app is deployed with the following action, using curl to retrieve the configuration from CloudTruth Templates needed for AWS S3.

- name: Deploy to S3
run: |
source <(curl -sfL https://api.cloudtruth.com/t/${DEPLOY_AWS_ENV_TID}/${ENV} | sed 's/&quot;//g' | cat)
source <(curl -sfL https://api.cloudtruth.com/t/${DEPLOY_WEB_ENV_TID}/${ENV} | cat)
aws s3 sync build/ s3://${BUCKET_NAME}/
aws cloudfront create-invalidation --distribution-id ${DISTRIBUTION_ID} --paths /index.html /asset-manifest.json /manifest.json

Once deployed, the app itself fetches its live configuration from another CloudTruth template:

address={"https://api.cloudtruth.com/t/" + process.env.REACT_APP_CONFIG_TID + "/" + process.env.REACT_APP_ENV}

You can launch the Demo app here: http://app.demo.cloudtruth.dev