[Oracle Cloud] Terraform + Helm

The terraform configuration scripts can be used to completely install MuShop to Oracle Cloud along with necessary Oracle Cloud Infrastructure services.

Prerequisites

You need to install terraform locally.

Configuration

Create copy of terraform variables file terraform.tfvars.example.

cp terraform.tfvars.example mushop.tfvars

Then edit the mushop.tfvars:

  1. Configure the OCI authentication and deployment variables. Follow the guidelines on how to obtain authentication details and configure the provider.:

    # OCI authentication
    tenancy_ocid     = "ocid1.tenancy....."
    fingerprint      = "" # e.g.: "5f:53:..." or leave blank if using CloudShell
    user_ocid        = "" # e.g.: "ocid1.user..." or leave blank if using CloudShell
    private_key_path = "" # e.g.: "/users/user/.oci/oci_api_key.pem" or leave blank if using CloudShell
    
    # Deployment compartment
    compartment_ocid = "ocid1.compartment...."
    
    # region
    region = "us-ashburn-1"
    
  2. Enable streaming service (optional):

    # Streaming
    create_oracle_streaming_service_stream = true
    

    Note that by configuring this option the terraform will configure Oracle Cloud Streaming service. The default quota allows the account to have 1 stream. In case you’re out of the quota keep this option disabled, the MuShop application won’t be affected.

  3. Enable newsletter service (optional):

    # Newsletter
    create_oracle_function_newsletter = true
    newsletter_function_approved_email_address = "micronaut-newsletter@mushop.com"
    

    Note that by configuring this option the terraform will configure Oracle Functions, Oracle API Gateway and Oracle Email Delivery Service. The default quota allows the account to have 1 API Gateway configured. In case you’re out of the quota keep this option disabled, the MuShop application won’t be affected.

  4. Enable Application Performance Monitoring: The Oracle Cloud Application Performance Monitoring service doesn’t provide the Terraform provider so it needs to be created manually before running the terraform:

    1. Navigate to Observability & Management -> Application Performance Monitoring -> Administration.
    2. Hit the button Create APM domain and enter the domain name.
    3. Once created make a note of Data Upload Endpoint and auto_generated_public_key.
    4. Edit the mushop.tfvars:
    # Tracing
    apm_zipkin_enabled = false
    apm_zipkin_url = "" # Copy here the APM domain Data Upload Endpoint.
    apm_zipkin_path = "" # The format is: /20200101/observations/public-span?dataFormat=zipkin&dataFormatVersion=2&dataKey=<auto_generated_public_key>
    

Installation

From the directory deploy/complete/terraform:

  1. Init the providers:

    terraform init
    
  2. Plan the execution (Optional):

    terraform plan --var-file mushop.tfvars
    
  3. Execute the plan:

    terraform apply --var-file mushop.tfvars
    

    Note the deployment of all resources may take a while (~20 minutes).

    After successful deployment you should see output variables like below:

    Outputs:
    
    autonomous_database_password = "...."
    comments = "The application URL will be unavailable for a few minutes after provisioning while the application is configured and deployed to Kubernetes"
    deploy_id = "R8Mm"
    deployed_oke_kubernetes_version = "v1.19.7"
    deployed_to_region = "us-ashburn-1"
    dev = "Made with ❤ by Oracle Developers"
    external_ip = "129.159.91.46"
    generated_private_key_pem = <<EOT
    ...
    -----END RSA PRIVATE KEY-----
    
    EOT
    grafana_admin_password = "....."
    grafana_url = "http://129.159.91.46/grafana"
    kubeconfig_for_kubectl = "export KUBECONFIG=./generated/kubeconfig"
    mushop_source_code = "https://github.com/oracle-quickstart/oci-micronaut"
    mushop_url = "http://129.159.91.46"
    mushop_url_button = "http://129.159.91.46"
    mushop_url_https = "https://129.159.91.46"
    

    To access MuShop use the mushop_url_https output variable.

Cleanup

From the directory deploy/complete/terraform destroy the stack:

# From this directory
terraform destroy