Skip to content

Latest commit

 

History

History

Example use of the Awala Pong server behind an Awala Internet Endpoint middleware

This Terraform module integrates the Awala Internet Endpoint with the Awala Pong server in a fully serverless environment on Google Cloud Platform and MongoDB Atlas.

Prerequisites

  • A GCP project with billing and the Cloud Resource Manager API enabled.
  • A domain name with DNSSEC correctly configured.
  • A MongoDB Atlas API key with the permissions Organization Owner on the project you wish to use.

Instructions

  1. Initialise this module with the required variables. For example:
      module "awala-pong" {
        source  = "relaycorp/awala-endpoint/google//examples/pong"
        version = "<INSERT VERSION HERE>"
    
        google_project          = "your-project"
        google_credentials_path = "/home/you/Desktop/google-credentials.json"
    
        mongodbatlas_public_key  = "your-public-key-id"
        mongodbatlas_private_key = "your-private-key"
        mongodbatlas_project_id  = "your-project-id"
    
        internet_address     = "your-company.com"
        pohttp_server_domain = "awala-endpoint.your-company.com"
      }
  2. Run terraform init, followed by terraform apply.
  3. Execute the bootstrapping script as follows:
    gcloud --project=PROJECT run jobs execute \
      "$(terraform output -raw bootstrap_job_name)" \
       --region=REGION \
      --wait
  4. Create the following DNS records:
    • A record for the load balancer, whose IPv4 address can be found in the output variable pohttp_server_ip_address.
    • SRV record for the A record above, so that it can be used as an Awala Parcel-Delivery Connection (PDC) server. For example:
      _awala-pdc._tcp.your-company.com. 3600 IN SRV 0 0 443 pohttp-server.your-company.com.
      

Test

  1. Install the Awala Ping app for Android or desktop.
  2. Download the connection parameters file from your Awala Internet Endpoint server. Its URL is https://<POHTTP-SERVER-DOMAIN>/connection-params.der.
  3. Import the connection parameters file into the Awala Ping app.
    • On Android, open the endpoints by tapping the respective icon in the top-right corner, then tap the + button in the bottom-right corner, then select "Public endpoint", and finally select the DER file above and save.
    • On desktop, run awala-ping third-party-endpoints import-public. For example:
      awala-ping third-party-endpoints import-public < /path/to/connection-params.der
  4. Send a ping and wait for a pong.
    • On Android, go back to the main screen and tap the "+ Ping" button. Then select the endpoint you just imported and tap the send button in to top-right corner.
    • On desktop, run awala-ping ping. For example:
      awala-ping ping your-company.com

If you don't get a pong within a few seconds, check the logs and whether any errors were reported.

Limitations

  • This module does NOT restrict access to MongoDB from any particular IP address.