Skip to content

Rajeshsupreet/TechChallengeApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform-cloudfoundry-servian-app

This Terraform root module demonstrates deployment of servian TechChallengeApp to Azure

  • Contents of this README:
    1. What is being provisioned
    2. Requirements
    3. Providers
    4. Modules
    5. Resources
    6. Inputs
    7. High level architectural overview of deployment
      • GitHub Action overview
      • deployment-overview.
    8. Deployment
      • GitHub Actions (Automated Process)
      • Manual Deployment.
    9. Technical Challenge URL
    10. Contact / Getting help
    11. License

1. What is being provisioned

  • PostgreSQL database
  • TechChallengeApp

2. Requirements

Name Version
terraform >= 0.14.0
cloudfoundry >= 0.14.2
cloudfoundry-Host n/a

3. Providers

Name Version
cloudfoundry >= 0.14.1
hsdp n/a

4. Modules

No modules.


5. Resources

Name Type
cloudfoundry_app.servianapp resource
cloudfoundry_service_instance.database resource
cloudfoundry_service_key.database_key resource
cloudfoundry_domain.domain data source
cloudfoundry_org.org data source
cloudfoundry_service.rds data source
hsdp_config.cf data source

6. Inputs

Name Description Type Default Required
cf_api Cloud foundry API endpoint (region specific) string "https://api.cloud.pcftest.com" yes
cf_app_name The CF app name string "servian-app" yes
cf_domain_name The CF domain to use for app string "cloud.pcftest.com" no
cf_db_name The name of the database string "servian-db" yes
cf_org_name The CF Org to deploy under string n/a yes
cf_app_region Cloud foundry region string "us-east" yes
cf_space_id The id of the CF Space to deploy in string n/a yes
db_broker The Database broker to use for requesting a PostgreSQL database string "hsdp-rds" no
db_plan The Database plan to use string "postgres-micro-dev" no
disk The amount of Disk space to allocate for app (MB) number 1024 no
docker_image Docker image to use string servian/techchallengeapp:latest yes
listenport The listenport of the app number 8080 yes
listenhost The listenhost of the app string 0.0.0.0 yes
memory The amount of RAM to allocate for app (MB) number 512 no

7. High level architectural overview of deployment

GitHub Action overview deployment-overview
Actions deployment

8. Deployment

GitHub Actions (Automated Process) -- Recommended

  • Whenever new code is merged to the main branch then the GitHub action will be triggered automatically.
  • On successful build completion, Tech Challange App and postgres DB instance will be provisioned in cloud foundry
  • The secret variables are configured in Github
  • Full workflow about provisioning Tech Challange App and postgres DB is available in the servian-app-actions.yml

Manual Deployment

Installing Terraform

Terraform should be installed on your system. Instructions available here. Once installed check the version, it should be at least 0.14.2 or higher:

$ terraform version
Terraform v1.0.7

Initalizing Terraform

Next Terraform needs to download the necessary provider plugins, modules and set up the initial (empty) state. Start by executing

$ terraform init

terraform plan

Now you are ready to run terraform plan with secrets vraiables :

$ terraform plan -var="cf_org_name=${{secrets.CF_ORG_NAME}}" -var="cf_username=${{secrets.CF_USERNAME}}" -var="cf_password=${{secrets.CF_PASSWORD}}" -var="cf_space_id=${{secrets.CF_SPACE_ID}}" -out=tfplan

Terraform will calculate an execution plan and display all the actions it needs to perform to deploy app and components.

terraform apply

The apply step will kick off provisioning of all resources:

$ terraform apply -auto-approve "tfplan"

This typically takes between 5-15 minutes. The majority of the time is spend waiting on the PostgreSQL database to become available for use. Once the apply step finishes you should see something like below:

Apply complete! Resources: 4 added, 0 changed, 0 destroyed..

terraform destroy

You can remove all created resources using the terraform destroy command

$ terraform destroy

9. Technical Challenge URL

To Access Technical Challenge URL depolyed in cloud foundry:

https://techchallenge-app.cloud.pcftest.com/

10. Contact / Getting help

Please reach me at Rajesh Cholleti

11. License

License is MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages