Men-deploy instance MySQL dengan App Lifecycle Manager
Pelajari cara men-deploy instance Cloud SQL menggunakan App Lifecycle Manager.
Sebelum memulai
-
Login ke Akun Google Anda.
Jika Anda belum memilikinya, Daftar untuk membuat akun baru.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the App Lifecycle Manager, Artifact Registry, Cloud Build, Cloud Storage, Developer Connect, Infrastructure Manager, Design Center, App Hub, Cloud Resource Manager, Identity and Access Management, Cloud Asset Inventory, Cloud Monitoring, Cloud Logging, and Service Health APIs, if any are not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
Create a service account:
-
Ensure that you have the Create Service Accounts IAM role
(
roles/iam.serviceAccountCreator) and the Project IAM Admin role (roles/resourcemanager.projectIamAdmin). Learn how to grant roles. -
In the Google Cloud console, go to the Create service account page.
Go to Create service account - Select your project.
-
In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.
In the Service account description field, enter a description. For example,
Service account for quickstart. - Click Create and continue.
-
Grant the Project > Owner role to the service account.
To grant the role, find the Select a role list, then select Project > Owner.
- Click Continue.
-
Click Done to finish creating the service account.
-
Ensure that you have the Create Service Accounts IAM role
(
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init -
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the App Lifecycle Manager, Artifact Registry, Cloud Build, Cloud Storage, Developer Connect, Infrastructure Manager, Design Center, App Hub, Cloud Resource Manager, Identity and Access Management, Cloud Asset Inventory, Cloud Monitoring, Cloud Logging, and Service Health APIs, if any are not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
Create a service account:
-
Ensure that you have the Create Service Accounts IAM role
(
roles/iam.serviceAccountCreator) and the Project IAM Admin role (roles/resourcemanager.projectIamAdmin). Learn how to grant roles. -
In the Google Cloud console, go to the Create service account page.
Go to Create service account - Select your project.
-
In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.
In the Service account description field, enter a description. For example,
Service account for quickstart. - Click Create and continue.
-
Grant the Project > Owner role to the service account.
To grant the role, find the Select a role list, then select Project > Owner.
- Click Continue.
-
Click Done to finish creating the service account.
-
Ensure that you have the Create Service Accounts IAM role
(
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init - Berikan izin yang diperlukan kepada akun layanan App Lifecycle Manager:
Buka App Lifecycle Manager > Ringkasan Mulai.
- Di banner dengan pesan Izin yang diperlukan untuk akun App Lifecycle Manager belum diberikan, klik Berikan izin.
Membuat model penawaran Cloud SQL Anda menggunakan template komposit
Di bagian ini, Anda akan menggunakan App Lifecycle Manager untuk memodelkan template komposit
(sql-quickstart-template) yang terdiri dari instance Cloud SQL menggunakan
Application Design Center.
Di konsol Google Cloud , buka App Lifecycle Manager > Penawaran aplikasi.
Klik Create.
Di kolom Nama penawaran Aplikasi, ketik:
my-sql-quickstart-saas-offering.Di drop-down Region, pilih region:
us-central1us-east1us-east5
Klik Ok.
Klik Create. Mungkin perlu waktu beberapa menit untuk membuat
my-sql-quickstart-saas-offering.Halaman Detail penawaran aplikasi akan terbuka.
Di halaman Detail penawaran aplikasi, klik Buat template baru.
Di halaman Create a new composite template:
- Di kotak Template ID, masukkan
sql-quickstart-template. Klik Create template. App Lifecycle Manager akan memerlukan waktu beberapa menit untuk membuat template gabungan.
Setelah App Lifecycle Manager berhasil membuat template, Anda akan melihat detailnya di bagian Connected application template pada halaman App offering details.
- Di kotak Template ID, masukkan
Di bagian Template aplikasi terhubung, buka Kelola template > Konfigurasi di kanvas.
App Design Center akan terbuka di jendela konsol Google Cloud .
Di area Components, temukan dan klik template Cloud SQL (My SQL).
Komponen Cloud SQL (MySQL) ditambahkan ke kanvas.
Klik Lanjutkan > Deploy dalam skala besar dengan App Lifecycle Manager.
App Lifecycle Manager akan terbuka di jendela konsol Google Cloud .
Di bagian Connected application template, klik Update template revision.
Di halaman Update template revision, pilih
r-2di drop-down Revision.Klik Update. Bagian Connected application template menampilkan Importing Application Template.
Mungkin perlu waktu beberapa menit bagi App Lifecycle Manager untuk mengimpor revisi template. Setelah revisi selesai diimpor, Anda akan melihat daftar jenis unit yang diisi di tab Jenis unit.
Menyediakan instance Cloud SQL menggunakan App Lifecycle Manager
Di bagian ini, Anda akan membuat dan menyediakan unit (my-sql-quickstart-unit)
dengan instance Cloud SQL di region us-central1.
Di halaman App offering details di
my-sql-quickstart-saas-offering, klik Provision.Halaman Provision akan terbuka.
Di halaman Provision, pilih
us-central1di drop-down Region.Klik Tambahkan untuk menambahkan unit ke penawaran Aplikasi Anda.
Di panel Add unit to provision:
- Di kotak Unit name, ketik
my-sql-quickstart-unit-1. - Di menu drop-down Unit kind, pilih jenis unit
sql-quickstart-template. - Di drop-down Release, pilih (
r-3). - Di menu drop-down Service account, pilih akun layanan yang Anda buat di bagian Sebelum memulai.
- Di kotak Unit name, ketik
Klik Tambahkan variabel project tenant.
- Pilih project Anda untuk menyediakan resource.
Di bagian Other input variables pada panel Add unit to provision:
Klik drop-down
sql-my-sql-1_database_version.- Di kotak Variable value, ketik
MYSQL_8_0.
Klik Done.
- Di kotak Variable value, ketik
Klik drop-down
sql-my-sql-1_name.- Di kotak Variable value, ketik
my-sql-db-1.
Klik Done.
- Di kotak Variable value, ketik
Klik drop-down
sql-my-sql-1_project_id.- Di kotak Nilai variabel, ketik project ID Anda.
Klik Done.
Klik drop-down
sql-my-sql-1_region.- Di kotak Variable value, ketik
us-central1.
Klik Done.
- Di kotak Variable value, ketik
Klik Tambahkan. Anda akan melihat
my-sql-quickstart-unit-1di tabel Unit yang akan disediakan.Klik Sediakan untuk menyediakan
my-sql-quickstart-unit-1yang akan membuat instance Cloud SQL aktif di penawaran Aplikasi Anda.Mungkin perlu waktu beberapa menit hingga App Lifecycle Manager menyediakan
my-sql-quickstart-unit-1.
Melihat instance Cloud SQL yang di-deploy
Sekarang Anda telah menggunakan App Lifecycle Manager untuk men-deploy instance Cloud SQL.
Untuk melihat instance Cloud SQL yang Anda deploy dalam panduan memulai ini:
Di konsol Google Cloud , buka halaman App Lifecycle Manager > Units > Unit details.
Klik nama unit Anda:
my-sql-quickstart-unit-1.Di halaman Detail unit:
Pastikan State adalah:
- Ready jika instance Cloud SQL disediakan.
- Provisioning jika operasi masih berlangsung.
Pembersihan
Agar akun Google Cloud Anda tidak dikenai biaya untuk resource yang digunakan pada halaman ini, ikuti langkah-langkah berikut.
Menghapus project
Jika Anda men-deploy instance Cloud SQL di project Google Cloud baru, dan tidak lagi memerlukan project tersebut, hapus dengan melakukan langkah-langkah berikut:
- Di konsol Google Cloud , buka halaman Manage resources.
- Pada daftar project, pilih project yang ingin Anda hapus, lalu klik Hapus.
- Pada layar perintah, ketik project ID, lalu klik Matikan.
Langkah berikutnya
- Untuk memahami App Lifecycle Manager lebih lanjut, lihat Ringkasan App Lifecycle Manager.
- Untuk mulai menggunakan App Lifecycle Manager, mulailah dengan Membuat penawaran Aplikasi.
- Untuk memahami cara penggunaan akun layanan dan cara memberikan izin yang diperlukan untuk akun ini, lihat Akun layanan App Lifecycle Manager.
- Untuk mengetahui langkah-langkah mengupdate rilis, lihat Meluncurkan rilis.