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, Infrastructure Manager, Developer Connect, Cloud Build, and Cloud Storage APIs.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. 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
(
-
Instal Google Cloud CLI.
-
Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.
-
Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:
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, Infrastructure Manager, Developer Connect, Cloud Build, and Cloud Storage APIs.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. 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
(
-
Instal Google Cloud CLI.
-
Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.
-
Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:
gcloud init - Beri akun layanan App Lifecycle Manager izin yang diperlukan:
Buka App Lifecycle Manager > Overview Get started.
- 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 Google Cloud konsol, buka App Lifecycle Manager > SaaS Offering.
Klik Create.
Di kolom Name of the SaaS offering, ketik:
my-sql-quickstart-saas-offering.Di drop-down Region, pilih wilayah:
us-central1us-east1us-east5
Klik Ok.
Klik Create. Mungkin diperlukan waktu beberapa menit untuk membuat
my-sql-quickstart-saas-offering.Halaman Detail penawaran SaaS akan terbuka.
Di halaman SaaS offering details, klik Create new template.
Di halaman Buat template gabungan baru:
- Di kotak Template ID, masukkan
sql-quickstart-template. Klik Buat template. App Lifecycle Manager akan memerlukan waktu beberapa menit untuk membuat template komposit.
Setelah App Lifecycle Manager berhasil membuat template, Anda akan melihat detailnya di bagian Template aplikasi yang terhubung di halaman Detail penawaran SaaS.
- Di kotak Template ID, masukkan
Di bagian Template aplikasi terhubung, buka Kelola template > Konfigurasi di kanvas.
Pusat Desain Aplikasi akan terbuka di jendela konsol Google Cloud .
Di area Components, temukan dan klik template Cloud SQL (MySQL).
Komponen Cloud SQL (MySQL) ditambahkan ke kanvas.
Klik Lanjutkan > Deploy at scale with App Lifecycle Manager.
Pengelola Siklus Proses Aplikasi akan terbuka di jendela konsol Google Cloud .
Di bagian Template aplikasi terhubung, klik Perbarui revisi template.
Di halaman Perbarui revisi template, pilih
r-2di drop-down Revisi.Klik Update. Bagian Connected application template menampilkan Importing Application Template.
Mungkin perlu waktu beberapa menit bagi App Lifecycle Manager untuk mengimpor revisi template. Setelah impor revisi selesai, Anda akan melihat daftar jenis unit yang terisi 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 Detail penawaran SaaS
my-sql-quickstart-saas-offering, klik Sediakan.Halaman Provision akan terbuka.
Di halaman Provision, pilih
us-central1di drop-down Region.Klik Tambahkan untuk menambahkan unit ke penawaran SaaS Anda.
Di panel Tambahkan unit untuk penyediaan:
- Di kotak Unit name, ketik
my-sql-quickstart-unit-1. - Di drop-down Unit kind, pilih jenis unit
sql-quickstart-template. - Di drop-down Rilis, 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
MY_SQL_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 Variable value, 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 dalam penawaran SaaS Anda.Mungkin perlu waktu beberapa menit agar App Lifecycle Manager dapat 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 Status adalah:
- Siap jika instance Cloud SQL disediakan.
- Penyediaan 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 jika Anda tidak lagi memerlukan project tersebut, hapus dengan menyelesaikan 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 lebih lanjut Pengelola Siklus Proses Aplikasi, lihat Ringkasan Pengelola Siklus Proses Aplikasi.
- Untuk mulai menggunakan App Lifecycle Manager, mulailah dengan Membuat penawaran SaaS.
- 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 memperbarui rilis, lihat Meluncurkan rilis.