{"id":20217281,"url":"https://github.com/settlemint/tutorial-btp-on-gcp","last_synced_at":"2025-03-03T11:26:14.857Z","repository":{"id":248375746,"uuid":"824481500","full_name":"settlemint/tutorial-btp-on-gcp","owner":"settlemint","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-28T01:24:51.000Z","size":97,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-28T09:36:18.998Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/settlemint.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-05T08:20:02.000Z","updated_at":"2025-02-28T01:24:54.000Z","dependencies_parsed_at":"2024-11-04T12:23:35.348Z","dependency_job_id":"984b9d2d-b419-4940-a4c1-b21e94333e26","html_url":"https://github.com/settlemint/tutorial-btp-on-gcp","commit_stats":null,"previous_names":["settlemint/tutorial-btp-on-gcp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settlemint%2Ftutorial-btp-on-gcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settlemint%2Ftutorial-btp-on-gcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settlemint%2Ftutorial-btp-on-gcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settlemint%2Ftutorial-btp-on-gcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/settlemint","download_url":"https://codeload.github.com/settlemint/tutorial-btp-on-gcp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241654587,"owners_count":19997893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T06:33:09.640Z","updated_at":"2025-03-03T11:26:14.834Z","avatar_url":"https://github.com/settlemint.png","language":"HCL","readme":"# BTP on Goodle Cloud Platform\n\n## **For DEMO purposes only.**\n*This is not production ready solution. We run all components locally and not in HA mode. For production, we suggest running PostgreSQL, Redis, and Vault outside of the cluster.*\n\nThis repository contains the code for the tutorial BTP on GCP.\n\n## Prerequisites\n\n### Hashicorp Terraform\n\nFor the infrastructure setup, you need to have [Terraform](https://developer.hashicorp.com/terraform/tutorials/gcp-get-started/install-cli) installed. Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.\n\n```sh\nbrew tap hashicorp/tap\nbrew install hashicorp/tap/terraform\n```\n\n### Google Cloud Platform\n\nThe Google Cloud Platform (GCP) is a set of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products, such as Google Search, YouTube, Google Maps, and so on. You will need a Google Cloud Platform account, if you do not have a GCP account, [create one now](https://console.cloud.google.com/freetrial/). Create a new project to be used for the tutorial.\n\nYou will also need the gcloud command line tool, which you can [install](https://cloud.google.com/sdk/docs/install) and authenticate with by running the following command:\n\n```sh\nbrew cask install google-cloud-sdk\ngcloud auth application-default login\n```\n\nYou will need to enable several API for your project.\n\n- container.googleapis.com: https://console.developers.google.com/apis/api/container.googleapis.com/overview?project=\u003cproject_id\u003e\n- cloudkms.googleapis.com (KMS) API: https://console.cloud.google.com/marketplace/product/google/cloudkms.googleapis.com?project=\u003cproject_id\u003e\n\nYour GCP IAM user should have permission to manage GKE clusters, CloudDNS zones, KMS keys and IAM permissions. Suggest to run it with `Owner` permission. If you cannot grant your GCP user `Owner` permissions, grant following:\n- Editor\n- Cloud KMS Admin\n- Project IAM Admin\n- Kubernetes Engine Admin\n- Service Account Admin\n\n### SettleMint Blockchain Transformation Platform credentials\n\nFrom your Customer Success contact, you will get login credentials for the SettleMint OCI registry hosting the Helm chart and docker images. We will also need the version to be installed.\n\n### OAuth2 Provider Setup\n\nWe will use Google login to login to BTP platform.\n\nBrowse https://console.cloud.google.com/apis/credentials/consent and press `CONFIGURE CONSENT SCREEN`. Choose`External` and press create.\n\nFill all fields:\n`App name` - staging\n`User support email` - your email\n`Developer contact information` - your email\n\nBrowse to https://console.developers.google.com/apis/credentials and on the top use + CREATE CREDENTIALS, choose `OAuth client ID` and then as type Web application.\n\nIn Authorised JavaScript origins add the domain name you will use to access BTP platform, for example https://btp.settlemint.com. In Authorised redirect URIs use https://btp.settlemint.com/api/auth/callback/google.\n\nYou will get a Client ID and Client secret at the end of this process, note them down for later.\n\n### SMTP configuration (Optional)\n\nIf you want to configure email notifications, you will need to setup SMTP server. You can use any SMTP server, for example [MailGun](https://www.mailgun.com/). You will need to create SMTP credentials for your account. Without this, you will not able to invite users to your Organization. Everything else will work fine.\n\nIf you have a working SMTP server, update following values in value.yaml.tmpl:\n\n```yaml\ninternal:\n  email:\n    enabled: true\n    from: \"support@example.com\"\n    server: \"smtps://username:password@host:port\"\n```\n\nYou will need to replace `support@example.com` with your email address and `username:password@host:port` with your SMTP credentials.\n\n## Terraform setup\n\nBelow you will find instruction how to setup BTP platform on GCP with terraform code. It consist 2 steps and manual step, as we need to preconfigure public DNS zone to access BTP platform.\n\nExport following env variables before execute terraform code:\n```sh\nexport TF_VAR_gcp_dns_zone=`YOUR_DNS_ZONE` # DNS zone(subdomain) you are using to access the btp platform, eg btp.settlemint.com\nexport TF_VAR_gcp_project_id=`YOUR_GCP_PROJECT_ID` # gcp project id where you setup BTP platform\nexport TF_VAR_gcp_region=`YOUR_GCP_REGION` # where cluster will deploy\nexport TF_VAR_gcp_client_id=`YOUR_GCP_CLIENT_ID` # from OAuth2 Provider Setup step\nexport TF_VAR_gcp_client_secret=`YOUR_GCP_CLIENT_SECRET` # from OAuth2 Provider Setup step\nexport TF_VAR_oci_registry_username=`YOUR_REGISTRY_USERNAME` # provided by Customer Success Team\nexport TF_VAR_oci_registry_password=`YOUR_REGISTRY_PASSWORD` # provided by Customer Success Team\nexport TF_VAR_btp_version=`BTP_VERSION` # provided by Customer Success Team\n\n```\n\n### Setting up the DNS zone.\n\nStep 1: Create the DNS Zone in Google Cloud DNS\n\n1.\tNavigate to the `00_dns_zone` folder:\nThis folder contains the Terraform code to create the DNS zone on Google Cloud DNS.\n\n2.\tRun Terraform to create the DNS zone:\nExecute the following commands to initialize Terraform and apply the configuration:\n\n```sh\nterraform init\nterraform apply\n```\n\nIt will create GCP Cloud DNS with zone from `TF_VAR_gcp_dns_zone` env variable.\n\n3.\tRetrieve the nameservers:\nAfter applying the Terraform configuration, note down the nameservers from the output. These nameservers will be used to delegate the subdomain.\n\nStep 2: Delegate the Subdomain in Your Domain Registrar (Cloudflare as an example)\n\n1.\tLog in to your domain registrar (e.g., Cloudflare):\nAccess the DNS settings for your top-level domain (e.g., settlemint.com).\n2.\tAdd NS records for the subdomain:\nUse the nameservers retrieved from the Terraform output to delegate the subdomain to Google Cloud DNS. For example, if the subdomain is btp.settlemint.com, add the following NS records:\n\t•\tType: NS\n\t•\tName: btp (or btp.settlemint.com)\n\t•\tContent: ns-cloud-a1.googledomains.com\n\t•\tTTL: Auto\nRepeat this for each nameserver provided by Google Cloud DNS (ns-cloud-a2.googledomains.com, ns-cloud-a3.googledomains.com, etc.).\n\nTo check if a domain or subdomain is correctly delegated to the specified nameservers use following command:\n```sh\ndig NS btp.settlemint.com\n```\n\nExample of the output:\n```\n\u003e dig NS btp.settlemint.com\n\n; \u003c\u003c\u003e\u003e DiG 9.10.6 \u003c\u003c\u003e\u003e NS btp.settlemint.com\n;; global options: +cmd\n;; Got answer:\n;; -\u003e\u003eHEADER\u003c\u003c- opcode: QUERY, status: NOERROR, id: 57022\n;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 9\n\n;; OPT PSEUDOSECTION:\n; EDNS: version: 0, flags:; udp: 1232\n;; QUESTION SECTION:\n;btp.settlemint.com.\t\tIN\tNS\n\n;; ANSWER SECTION:\nbtp.settlemint.com.\t300\tIN\tNS\tns-cloud-a4.googledomains.com.\nbtp.settlemint.com.\t300\tIN\tNS\tns-cloud-a1.googledomains.com.\nbtp.settlemint.com.\t300\tIN\tNS\tns-cloud-a2.googledomains.com.\nbtp.settlemint.com.\t300\tIN\tNS\tns-cloud-a3.googledomains.com.\n\n;; ADDITIONAL SECTION:\nns-cloud-a1.googledomains.com. 102654 IN A\t216.239.32.106\nns-cloud-a2.googledomains.com. 102417 IN A\t216.239.34.106\nns-cloud-a3.googledomains.com. 102278 IN A\t216.239.36.106\nns-cloud-a4.googledomains.com. 102507 IN A\t216.239.38.106\nns-cloud-a1.googledomains.com. 102654 IN AAAA\t2001:4860:4802:32::6a\nns-cloud-a2.googledomains.com. 102417 IN AAAA\t2001:4860:4802:34::6a\nns-cloud-a3.googledomains.com. 102278 IN AAAA\t2001:4860:4802:36::6a\nns-cloud-a4.googledomains.com. 102507 IN AAAA\t2001:4860:4802:38::6a\n\n;; Query time: 58 msec\n;; SERVER: 10.123.50.1#53(10.123.50.1)\n;; WHEN: Mon Jul 01 11:30:57 EEST 2024\n;; MSG SIZE  rcvd: 344\n```\n\nAfter the domain is delegated, you can create underlying infrastructure.\n\n### Setting up the infrastructure.\n\nIn the `01_infrastructure` folder, run the following terraform command to create BTP infrastructure:\n```sh\nterraform init\nterraform apply\n```\n\nIt will create BTP platform on top of GCP cloud.\n\n### Destroy the infrastructure.\n\nTo destroy infrastructure, run following command:\n```sh\nterraform destroy\n```\n\nIf it's fail, try to run it second time.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsettlemint%2Ftutorial-btp-on-gcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsettlemint%2Ftutorial-btp-on-gcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsettlemint%2Ftutorial-btp-on-gcp/lists"}