פריסת מכונה של MySQL באמצעות App Lifecycle Manager
איך פורסים מופע של Cloud SQL באמצעות App Lifecycle Manager
לפני שמתחילים
-
נכנסים לחשבון Google.
אם עדיין אין חשבון, יוצרים חשבון חדש.
-
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 - נותנים לחשבון השירות App Lifecycle Manager את ההרשאות הנדרשות:
עוברים אל App Lifecycle Manager > Overview Get started.
- בבאנר עם ההודעה The required permissions for App Lifecycle Manager account haven't been granted, לוחצים על Grant permissions.
יצירת מודל של מוצר Cloud SQL באמצעות תבנית מורכבת
בקטע הזה תשתמשו ב-App Lifecycle Manager כדי ליצור מודל של תבנית מורכבת (sql-quickstart-template) שמורכבת ממכונה של Cloud SQL באמצעות Application Design Center.
במסוף Google Cloud , עוברים אל App Lifecycle Manager > הצעת האפליקציה.
לוחצים על יצירה.
בשדה שם האפליקציה, מקלידים:
my-sql-quickstart-saas-offering.בתפריט הנפתח Region, בוחרים את האזורים:
us-central1us-east1us-east5
לוחצים על אישור.
לוחצים על יצירה. יכול להיות שיחלפו כמה דקות עד ש
my-sql-quickstart-saas-offeringייווצר.נפתח הדף פרטי המוצר של האפליקציה.
בדף פרטי האפליקציה, לוחצים על יצירת תבנית חדשה.
בדף Create a new composite template (יצירת תבנית מורכבת חדשה):
- בתיבה Template ID (מזהה התבנית), מזינים
sql-quickstart-template. לוחצים על יצירת תבנית. יחלפו כמה דקות עד שכלי App Lifecycle Manager ייצור את התבנית המורכבת.
אחרי ש-App Lifecycle Manager יוצר את התבנית בהצלחה, הפרטים שלה מופיעים בקטע Connected application template בדף App offering details.
- בתיבה Template ID (מזהה התבנית), מזינים
בקטע Connected application template (תבנית של אפליקציה מקושרת), עוברים אל Manage template (ניהול התבנית) > Configure in canvas (הגדרה באזור העריכה).
מרכז עיצוב האפליקציות ייפתח בחלון המסוף Google Cloud .
באזור רכיבים, מוצאים את התבנית Cloud SQL (My SQL) ולוחצים עליה.
רכיב Cloud SQL (My SQL) נוסף לאזור העריכה.
לוחצים על המשך > פריסה בהיקף נרחב באמצעות App Lifecycle Manager.
App Lifecycle Manager נפתח בחלון המסוף של Google Cloud .
בקטע Connected application template (תבנית של אפליקציה מקושרת), לוחצים על Update template revision (עדכון של גרסת התבנית).
בדף Update template revision, בוחרים באפשרות
r-2בתפריט הנפתח Revision.לוחצים על עדכון. בקטע Connected application template מופיע הכיתוב Importing Application Template.
יכול להיות שיעברו כמה דקות עד ש-App Lifecycle Manager ייבא את גרסת התבנית. כשהייבוא של הגרסה יסתיים, רשימת סוגי היחידות תופיע בכרטיסייה Unit kinds.
הקצאת מכונה של Cloud SQL באמצעות App Lifecycle Manager
בקטע הזה, יוצרים יחידה (my-sql-quickstart-unit) ומקצים לה מכונת Cloud SQL באזור us-central1.
בדף פרטי האפליקציה של
my-sql-quickstart-saas-offering, לוחצים על הקצאה.הדף Provision נפתח.
בדף Provision, בוחרים באפשרות
us-central1בתפריט הנפתח Region.לוחצים על הוספה כדי להוסיף יחידה לאפליקציה.
בחלונית הוספת יחידה להקצאה:
- בתיבה Unit name, מקלידים
my-sql-quickstart-unit-1. - בתפריט הנפתח Unit kind, בוחרים את סוג היחידה
sql-quickstart-template. - בתפריט הנפתח גרסה, בוחרים באפשרות (
r-3). - בתפריט הנפתח Service account, בוחרים את חשבון השירות שיצרתם בקטע לפני שמתחילים.
- בתיבה Unit name, מקלידים
לוחצים על הוספת משתנים של פרויקט דייר.
- בוחרים את הפרויקט כדי להקצות את המשאבים.
בקטע Other input variables (משתני קלט אחרים) בחלונית Add unit to provision (הוספת יחידה להקצאה):
לוחצים על התפריט הנפתח
sql-my-sql-1_database_version.- בתיבה ערך המשתנה, מקלידים
MYSQL_8_0.
לוחצים על סיום.
- בתיבה ערך המשתנה, מקלידים
לוחצים על התפריט הנפתח
sql-my-sql-1_name.- בתיבה ערך המשתנה, מקלידים
my-sql-db-1.
לוחצים על סיום.
- בתיבה ערך המשתנה, מקלידים
לוחצים על התפריט הנפתח
sql-my-sql-1_project_id.- בתיבה Variable value, מקלידים את מזהה הפרויקט.
לוחצים על סיום.
לוחצים על התפריט הנפתח
sql-my-sql-1_region.- בתיבה Variable value, מקלידים
us-central1.
לוחצים על סיום.
- בתיבה Variable value, מקלידים
לוחצים על הוספה. הערך
my-sql-quickstart-unit-1יופיע בטבלה Units to be provisioned.לוחצים על Provision כדי להקצות את
my-sql-quickstart-unit-1, שיצור מכונה פעילה של Cloud SQL בחבילת האפליקציות שלכם.יכול להיות שיחלפו כמה דקות עד ש-App Lifecycle Manager יקצה את
my-sql-quickstart-unit-1.
צפייה במכונה של Cloud SQL שנפרסה
עכשיו השתמשתם ב-App Lifecycle Manager כדי לפרוס מכונה של Cloud SQL.
כדי לראות את המכונה של Cloud SQL שפרסתם במדריך למתחילים הזה:
במסוף Google Cloud , עוברים אל App Lifecycle Manager > Units > Unit details.
לוחצים על השם של היחידה:
my-sql-quickstart-unit-1.בדף פרטי היחידה:
מוודאים שהערך של State הוא:
- Ready אם המכונה של Cloud SQL הוקצתה.
- הקצאת הרשאות אם הפעולה עדיין מתבצעת.
הסרת המשאבים
כדי לא לצבור חיובים לחשבון Google Cloud על המשאבים שבהם השתמשתם בדף הזה:
מחיקת הפרויקט
אם פרסתם את המכונה של Cloud SQL בפרויקט חדש ב- Google Cloud , ואתם לא צריכים יותר את הפרויקט, אתם יכולים למחוק אותו:
- נכנסים לדף Manage resources במסוף Google Cloud .
- ברשימת הפרויקטים, בוחרים את הפרויקט שרוצים למחוק ולוחצים על Delete.
- בהנחיה, מקלידים את מזהה הפרויקט ולוחצים על Shut down (סגירה).
המאמרים הבאים
- סקירה כללית על App Lifecycle Manager
- כדי להתחיל להשתמש ב-App Lifecycle Manager, כדאי להתחיל עם יצירת מוצר אפליקציה.
- במאמר חשבונות שירות של App Lifecycle Manager מוסבר איך משתמשים בחשבונות שירות ואיך נותנים את ההרשאות הנדרשות לחשבונות האלה.
- במאמר הפצת גרסה מוסבר איך לעדכן את הגרסה.