Skip to content

Commit afb59b6

Browse files
adding btp gcp tf guide (#52)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a comprehensive tutorial for installing the Blockchain Transformation Platform on Google Cloud Platform using Terraform, including prerequisites and setup instructions. - **Documentation** - Streamlined the installation documentation for the Settlemint platform by removing unnecessary TODO comments, enhancing clarity. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: saeeddawod <saeed.dawod@gmail.com>
1 parent 90e8ddd commit afb59b6

File tree

3 files changed

+5566
-6657
lines changed

3 files changed

+5566
-6657
lines changed
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
---
2+
sidebar_position: 1
3+
sidebar_label: 'Sandbox Installation: BTP on Goodle Cloud Platform with Terraform'
4+
---
5+
6+
# BTP on Goodle Cloud Platform
7+
8+
## **For DEMO purposes only.**
9+
*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.*
10+
11+
This repository contains the code for the tutorial BTP on GCP.
12+
13+
<div style={{ display:"flex" , justifyContent: "center" }}>
14+
<iframe width="560" height="315" src="https://www.youtube.com/embed/fovi3PWYcd0?si=mUysC79FjZLtgnLN" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
15+
</div>
16+
17+
## Prerequisites
18+
19+
### Hashicorp Terraform
20+
21+
For 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.
22+
23+
```sh
24+
brew tap hashicorp/tap
25+
brew install hashicorp/tap/terraform
26+
```
27+
28+
### Google Cloud Platform
29+
30+
The 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.
31+
32+
You 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:
33+
34+
```sh
35+
brew cask install google-cloud-sdk
36+
gcloud auth application-default login
37+
```
38+
39+
You will need to enable several API for your project.
40+
41+
- container.googleapis.com:`` https://console.developers.google.com/apis/api/container.googleapis.com/overview?project=<project_id>``
42+
- cloudkms.googleapis.com (KMS) API: ``https://console.developers.google.com/apis/api/container.googleapis.com/overview?project=`<project_id>``
43+
44+
Your 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:
45+
- Editor
46+
- Cloud KMS Admin
47+
- Project IAM Admin
48+
- Kubernetes Engine Admin
49+
- Service Account Admin
50+
51+
### SettleMint Blockchain Transformation Platform credentials
52+
53+
From 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.
54+
55+
### OAuth2 Provider Setup
56+
57+
We will use Google login to login to BTP platform.
58+
59+
Browse https://console.cloud.google.com/apis/credentials/consent and press `CONFIGURE CONSENT SCREEN`. Choose`External` and press create.
60+
61+
Fill all fields:
62+
`App name` - staging
63+
`User support email` - your email
64+
`Developer contact information` - your email
65+
66+
Browse 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.
67+
68+
In Authorised JavaScript origins add the domain name you will use to access BTP platform, for example example https://btp.settlemint.com. In Authorised redirect URIs use https://btp.settlemint.com/api/auth/callback/google.
69+
70+
You will get a Client ID and Client secret at the end of this process, note them down for later.
71+
72+
## Terraform setup
73+
74+
Below 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.
75+
76+
clone the following github repository:
77+
```sh
78+
git clone git@github.com:settlemint/tutorial-btp-on-gcp.git
79+
```
80+
81+
Export following env variables before execute terraform code:
82+
```sh
83+
export TF_VAR_gcp_dns_zone=`YOUR_DNS_ZONE` # DNS zone(subdomain) you are using to access the btp platform, eg btp.settlemint.com
84+
export TF_VAR_gcp_project_id=`YOUR_GCP_PROJECT_ID` # gcp project id where you setup BTP platform
85+
export TF_VAR_gcp_region=`YOUR_GCP_REGION` # where cluster will deploy
86+
export TF_VAR_gcp_client_id=`YOUR_GCP_CLIENT_ID` # from OAuth2 Provider Setup step
87+
export TF_VAR_gcp_client_secret=`YOUR_GCP_CLIENT_SECRET` # from OAuth2 Provider Setup step
88+
export TF_VAR_oci_registry_username=`YOUR_REGISTRY_USERNAME` # provided by Customer Success Team
89+
export TF_VAR_oci_registry_password=`YOUR_REGISTRY_PASSWORD` # provided by Customer Success Team
90+
export TF_VAR_btp_version=`BTP_VERSION` # provided by Customer Success Team
91+
92+
```
93+
94+
### Setting up the DNS zone.
95+
96+
Step 1: Create the DNS Zone in Google Cloud DNS
97+
98+
1. Navigate to the `00_dns_zone` folder:
99+
This folder contains the Terraform code to create the DNS zone on Google Cloud DNS.
100+
101+
2. Run Terraform to create the DNS zone:
102+
Execute the following commands to initialize Terraform and apply the configuration:
103+
104+
```sh
105+
terraform init
106+
terraform apply
107+
```
108+
109+
It will create GCP Cloud DNS with zone from `TF_VAR_gcp_dns_zone` env variable.
110+
111+
3. Retrieve the nameservers:
112+
After applying the Terraform configuration, note down the nameservers from the output. These nameservers will be used to delegate the subdomain.
113+
114+
Step 2: Delegate the Subdomain in Your Domain Registrar (Cloudflare as an example)
115+
116+
1. Log in to your domain registrar (e.g., Cloudflare):
117+
Access the DNS settings for your top-level domain (e.g., settlemint.com).
118+
2. Add NS records for the subdomain:
119+
Use 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:
120+
• Type: NS
121+
• Name: btp (or btp.settlemint.com)
122+
• Content: ns-cloud-a1.googledomains.com
123+
• TTL: Auto
124+
Repeat this for each nameserver provided by Google Cloud DNS (ns-cloud-a2.googledomains.com, ns-cloud-a3.googledomains.com, etc.).
125+
126+
To check if a domain or subdomain is correctly delegated to the specified nameservers use following command:
127+
```sh
128+
dig NS btp.settlemint.com
129+
```
130+
131+
Example of the output:
132+
```
133+
> dig NS btp.settlemint.com
134+
135+
; <<>> DiG 9.10.6 <<>> NS btp.settlemint.com
136+
;; global options: +cmd
137+
;; Got answer:
138+
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57022
139+
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 9
140+
141+
;; OPT PSEUDOSECTION:
142+
; EDNS: version: 0, flags:; udp: 1232
143+
;; QUESTION SECTION:
144+
;btp.settlemint.com. IN NS
145+
146+
;; ANSWER SECTION:
147+
btp.settlemint.com. 300 IN NS ns-cloud-a4.googledomains.com.
148+
btp.settlemint.com. 300 IN NS ns-cloud-a1.googledomains.com.
149+
btp.settlemint.com. 300 IN NS ns-cloud-a2.googledomains.com.
150+
btp.settlemint.com. 300 IN NS ns-cloud-a3.googledomains.com.
151+
152+
;; ADDITIONAL SECTION:
153+
ns-cloud-a1.googledomains.com. 102654 IN A 216.239.32.106
154+
ns-cloud-a2.googledomains.com. 102417 IN A 216.239.34.106
155+
ns-cloud-a3.googledomains.com. 102278 IN A 216.239.36.106
156+
ns-cloud-a4.googledomains.com. 102507 IN A 216.239.38.106
157+
ns-cloud-a1.googledomains.com. 102654 IN AAAA 2001:4860:4802:32::6a
158+
ns-cloud-a2.googledomains.com. 102417 IN AAAA 2001:4860:4802:34::6a
159+
ns-cloud-a3.googledomains.com. 102278 IN AAAA 2001:4860:4802:36::6a
160+
ns-cloud-a4.googledomains.com. 102507 IN AAAA 2001:4860:4802:38::6a
161+
162+
;; Query time: 58 msec
163+
;; SERVER: 10.123.50.1#53(10.123.50.1)
164+
;; WHEN: Mon Jul 01 11:30:57 EEST 2024
165+
;; MSG SIZE rcvd: 344
166+
```
167+
168+
After the domain is delegated, you can create underlying infrastructure.
169+
170+
### Setting up the infrastructure.
171+
172+
In the `01_infrastructure` folder, run the following terraform command to create BTP infrastructure:
173+
```sh
174+
terraform init
175+
terraform apply
176+
```
177+
178+
It will create BTP platform on top of GCP cloud.
179+
180+
### Destroy the infrastructure.
181+
182+
To destroy infrastructure, run following command:
183+
```sh
184+
terraform destroy
185+
```
186+
187+
If it's fail, try to run it second time.

docs/launch-platform/self-hosted/installing-on-an-existing-cluster/quick-start-examples-trial-installation/installation-trial-embedded.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ and then installing them
150150
sudo ./settlemint-platform install --license license.yaml
151151
```
152152

153-
154-
TODO:
155-
156153
Storage class
157154
```bash
158155
apiVersion: storage.k8s.io/v1

0 commit comments

Comments
 (0)