Men-deploy instance MySQL dengan App Lifecycle Manager

Pelajari cara men-deploy instance Cloud SQL menggunakan App Lifecycle Manager.

Sebelum memulai

  1. Login ke Akun Google Anda.

    Jika Anda belum memilikinya, Daftar untuk membuat akun baru.

  2. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. 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 the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the APIs

  5. Create a service account:

    1. 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.
    2. In the Google Cloud console, go to the Create service account page.

      Go to Create service account
    3. Select your project.
    4. 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.

    5. Click Create and continue.
    6. Grant the Project > Owner role to the service account.

      To grant the role, find the Select a role list, then select Project > Owner.

    7. Click Continue.
    8. Click Done to finish creating the service account.

  6. Instal Google Cloud CLI.

  7. Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.

  8. Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:

    gcloud init
  9. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  10. Verify that billing is enabled for your Google Cloud project.

  11. 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 the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the APIs

  12. Create a service account:

    1. 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.
    2. In the Google Cloud console, go to the Create service account page.

      Go to Create service account
    3. Select your project.
    4. 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.

    5. Click Create and continue.
    6. Grant the Project > Owner role to the service account.

      To grant the role, find the Select a role list, then select Project > Owner.

    7. Click Continue.
    8. Click Done to finish creating the service account.

  13. Instal Google Cloud CLI.

  14. Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.

  15. Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:

    gcloud init
  16. Beri akun layanan App Lifecycle Manager izin yang diperlukan:
    1. Buka App Lifecycle Manager > Overview Get started.

      Buka Memulai penggunaan App Lifecycle Manager

    2. 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.

  1. Di Google Cloud konsol, buka App Lifecycle Manager > SaaS Offering.

    Buka Penawaran SaaS

  2. Klik Create.

  3. Di kolom Name of the SaaS offering, ketik: my-sql-quickstart-saas-offering.

  4. Di drop-down Region, pilih wilayah:

    • us-central1
    • us-east1
    • us-east5

    Klik Ok.

  5. Klik Create. Mungkin diperlukan waktu beberapa menit untuk membuat my-sql-quickstart-saas-offering.

    Halaman Detail penawaran SaaS akan terbuka.

  6. Di halaman SaaS offering details, klik Create new template.

  7. Di halaman Buat template gabungan baru:

    1. Di kotak Template ID, masukkan sql-quickstart-template.
    2. 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.

  8. Di bagian Template aplikasi terhubung, buka Kelola template > Konfigurasi di kanvas.

    Pusat Desain Aplikasi akan terbuka di jendela konsol Google Cloud .

  9. Di area Components, temukan dan klik template Cloud SQL (MySQL).

    Komponen Cloud SQL (MySQL) ditambahkan ke kanvas.

  10. Klik Lanjutkan > Deploy at scale with App Lifecycle Manager.

    Pengelola Siklus Proses Aplikasi akan terbuka di jendela konsol Google Cloud .

  11. Di bagian Template aplikasi terhubung, klik Perbarui revisi template.

  12. Di halaman Perbarui revisi template, pilih r-2 di drop-down Revisi.

  13. 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.

  1. Di halaman Detail penawaran SaaS my-sql-quickstart-saas-offering, klik Sediakan.

    Halaman Provision akan terbuka.

  2. Di halaman Provision, pilih us-central1 di drop-down Region.

    Klik Tambahkan untuk menambahkan unit ke penawaran SaaS Anda.

  3. Di panel Tambahkan unit untuk penyediaan:

    1. Di kotak Unit name, ketik my-sql-quickstart-unit-1.
    2. Di drop-down Unit kind, pilih jenis unit sql-quickstart-template.
    3. Di drop-down Rilis, pilih (r-3).
    4. Di menu drop-down Service account, pilih akun layanan yang Anda buat di bagian Sebelum memulai.
  4. Klik Tambahkan variabel project tenant.

    1. Pilih project Anda untuk menyediakan resource.
  5. Di bagian Other input variables pada panel Add unit to provision:

    1. Klik drop-down sql-my-sql-1_database_version.

      • Di kotak Variable value, ketik MY_SQL_8_0.

      Klik Done.

    2. Klik drop-down sql-my-sql-1_name.

      • Di kotak Variable value, ketik my-sql-db-1.

      Klik Done.

    3. Klik drop-down sql-my-sql-1_project_id.

      • Di kotak Variable value, ketik project ID Anda.

      Klik Done.

    4. Klik drop-down sql-my-sql-1_region.

      • Di kotak Variable value, ketik us-central1.

      Klik Done.

    Klik Tambahkan. Anda akan melihat my-sql-quickstart-unit-1 di tabel Unit yang akan disediakan.

  6. Klik Sediakan untuk menyediakan my-sql-quickstart-unit-1 yang 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:

  1. Di konsol Google Cloud , buka halaman App Lifecycle Manager > Units > Unit details.

    Buka Unit

  2. Klik nama unit Anda: my-sql-quickstart-unit-1.

  3. Di halaman Detail unit:

    1. 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:

  1. Di Konsol Google Cloud , buka halaman Manage resources.

    Buka Kelola resource

  2. Pada daftar project, pilih project yang ingin Anda hapus, lalu klik Hapus.
  3. Pada layar perintah, ketik project ID, lalu klik Matikan.

Langkah berikutnya