Creating a demo Cloud Apps product
In this tutorial, you will create a basic Cloud Apps product with a Yandex Managed Service for PostgreSQL cluster and Yandex Compute Cloud VM connected to it, install the created app (product instance), and test its behavior.
Getting started
-
Upload your disk image to Yandex Compute Cloud. To complete this tutorial, you can use this Ubuntu image
. When using this image to install an app in Cloud Apps, a VM will be created automatically.Tip
For your demo app, you can create a VM from a Cloud Marketplace public image, such as Ubuntu 22.04 LTS, and build an image from that VM's disk. See also Getting started with Packer.
-
Fill out the questionnaire on the Yandex Cloud Marketplace page.
-
Register an account.
-
Create a Cloud Apps product.
Create a configuration
- Select the product for which you want to create a configuration.
- Navigate the Configurations tab.
- Click
Create configuration. - On the From scratch tab:
- Specify the following:
- Folder to save your configuration to. You need the
cloudapps.editorrole for that folder. - Configuration name, e.g.,
demo.
- Folder to save your configuration to. You need the
- Click Create. Your
democonfiguration will appear on the Configurations tab with theDraftstatus.
- Specify the following:
Set up your configuration
Add an artifact
- Select the
democonfiguration. - In the Selection of artifacts tab, click Add artifact.
- Select Disk image as the Artifact type.
- Specify a Name, e.g.,
ubuntu. - Select the disk image you created when Getting started.
- Click Add.
Create a form
-
Navigate to the Parameters tab.
-
Add the following fields one by one by clicking
Add field:-
Database username:
Parameter Value Description Variable type StringField view BasePlain string Variable name pg_usernameYou can use the variable name when creating resources to access the value entered by the user. Required Selected This field is required. Pattern ^[a-z][a-z0-9]*$The regular expression that the database username must match. Pattern error Wrong nameThe error message the user sees if the database username does not match the specified pattern. Field title (RU) Database usernameThe field name the user sees in the interface. Field title (EN) Database usernameThe field name the user sees in the interface. -
Secret with DB user password:
Parameter Value Description Variable type StringField view Lockbox SecretYandex Lockbox secret with the DB user password Variable name pg_password_secretYou can use the variable name when creating resources to access the value entered by the user. Required Selected This field is required. Field title (RU) Secret with DB user passwordThe field name the user sees in the interface. Field title (EN) Secret with DB user passwordThe field name the user sees in the interface. -
Cloud network:
Parameter Value Description Variable type StringField view VPC networkYandex Virtual Private Cloud cloud network for your app in Cloud Apps Variable name vpc_networkYou can use the variable name when creating resources to access the value entered by the user. Required Selected This field is required. Field title (RU) Cloud networkThe field name the user sees in the interface. Field title (EN) Cloud networkThe field name the user sees in the interface. -
Subnet 1:
Parameter Value Description Variable type StringField view VPC subnetYandex Virtual Private Cloud subnet Variable name vpc_subnet_0You can use the variable name when creating resources to access the value entered by the user. Required Selected This field is required. Field title (RU) Subnet 1The field name the user sees in the interface. Field title (EN) Subnet 1The field name the user sees in the interface. -
Subnet 2:
Parameter Value Description Variable type StringField view VPC subnetYandex Virtual Private Cloud subnet Variable name vpc_subnet_1You can use the variable name when creating resources to access the value entered by the user. Required Selected This field is required. Field title (RU) Subnet 2The field name the user sees in the interface. Field title (EN) Subnet 2The field name the user sees in the interface.
-
Add resources
-
Navigate to the Resources tab.
-
Add the following resources one by one by clicking
Add resource:Note
User resources are resources the user creates on their own prior to installing the app.
New resources are those automatically created in the user folder while installing the app.
-
Data source→VPC Network:Parameter Value Description Name vpc-networkClick next to the auto-generated cloud network name to change it. The resource name must be unique within the configuration. The user will see it when installing the app.Network id Parameter→vpc_networkThe cloud network ID will be retrieved from the Cloud network field as specified by the user when filling out the form. -
Data source→VPC Subnet:Subnet 1
Parameter Value Description Name vpc-subnet-0Click next to the auto-generated subnet name to change it. The resource name must be unique within the configuration. The user will see it when installing the app.Subnet id Parameter→vpc_subnet_0The subnet ID will be retrieved from the Subnet 1 field as specified by the user when filling out the form. Subnet 2
Parameter Value Description Name vpc-subnet-1Click next to the auto-generated subnet name to change it. The resource name must be unique within the configuration. The user will see it when installing the app.Subnet id Parameter→vpc_subnet_1The cloud network ID will be retrieved from the Subnet 2 field as specified by the user when filling out the form. -
Data source→Lockbox Secret:Parameter Value Description Name lockbox-secret-with-db-passwordClick next to the auto-generated Yandex Lockbox secret name to change it. The resource name must be unique within the configuration. The user will see it when installing the app.Secret id Parameter→pg_password_secretThe Lockbox secret ID will be retrieved from the Secret with DB user password field as specified by the user when filling out the form. -
New resource→Service account:Parameter Value Description Name service-accountClick next to the auto-generated service account name to change it. The resource name must be unique within the configuration. The user will see it when installing the app.Folder id Application attribute→Folder IDThe service account to use for deploying the application will be automatically created in the same folder the user selected for app installation. Name Value→my-best-appThe name of the automatically created service account will be my-best-app. -
New resource→Folder member:Parameter Value Description Name lockbox-payload-viewerClick next to the auto-generated folder user name to change it. The resource name must be unique within the configuration. The user will see it when installing the app.Folder id Application attribute→Folder IDThe specified roles will be assigned to the service account for the folder the user selected for app installation. Member Value→Service account→Reference→service-account→idThe specified roles will be assigned to the my-best-appservice account.Role Value→lockbox.payloadViewerThe service account will get the lockbox.payloadViewer role required for accessing the Yandex Lockbox secret that stores the DB user password. -
New resource→PostgreSQL Cluster:Parameter Value Description Name postgres-clusterClick next to the Yandex Managed Service for PostgreSQL cluster’s auto-generated name to change it. The resource name must be unique within the configuration. The user will see it when installing the app.Environment Value→PRODUCTIONThe environment where you want to create the cluster. The production environment is used for stable app versions. Folder id Application attribute→Folder IDThe cluster will be automatically created in the same folder the user selected for app installation. Name Value→my-best-app-pg-clusterThe new cluster’s name will be my-best-app-pg-cluster.Network id Resource→vpc-networkThe cluster will be automatically created in the cloud network named vpc-network.Config Value→Key: Version→Value→16DBMS version. Config Value→Key: Resources→Value→Key: Disk size→Value→10Disk size. Config Value→Key: Resources→Value→Key: Disk type id→Value→network-ssdDisk type. Config Value→Key: Resources→Value→Key: Resource preset id→Value→c3-c2-m4Host class Host Value→Item 1→Value→Key: Subnet id→Resource→vpc-subnet-0The cluster will include two hosts. The first host will reside in vpc-subnet-0.Host Value→Item 1→Value→Key: Zone→Reference→vpc-subnet-0→zoneThe first host will reside in the same availability zone as vpc-subnet-0.Host Value→Item 2→Value→Key: Subnet id→Resource→vpc-subnet-1The cluster will include two hosts. The second host will reside in vpc-subnet-1.Host Value→Item 2→Value→Key: Zone→Reference→vpc-subnet-1→zoneThe second host will reside in the same availability zone as vpc-subnet-1. -
New resource→PostgreSQL User:Parameter Value Description Name postgresql-userClick next to the auto-generated PostgreSQL user name to change it. The resource name must be unique within the configuration. The user will see it when installing the app.Cluster id Resource→postgres-clusterThe cluster to which pg_usernamewill have access.Name Parameter→pg_usernameThe username will be retrieved from the Database username field as specified by the user when filling out the form. Password Reference→lockbox-secret-with-db-password→entries[0].text_valueTo access the cluster, pg_usernamewill use the password retrieved fromlockbox-secret-with-db-password. -
New resource→PostgreSQL Database:Parameter Value Description Name postgresql-dbClick next to the auto-generated PostgreSQL DB name to change it. The resource name must be unique within the configuration. The user will see it when installing the app.Cluster id Resource→postgres-clusterThe cluster where the pg_usernamedatabase will be automatically created.Name Parameter→pg_usernameThe database name will be retrieved from the Database username field as specified by the user when filling out the form. The DB user name and the DB name match in the demo example. Owner Reference→postgresql-user→nameThe DB owner name will be the PostgreSQL user name, postgresql-user. -
New resource→Compute Instance:Parameter Value Description Name instanceClick next to the auto-generated VM name to change it. The resource name must be unique within the configuration. The user will see it when installing the app.Folder id Application attribute→Folder IDThe Compute Cloud VM will be automatically created in the same folder the user selected for app installation. Boot disk Value→Key: Initialize params→Value→Key: Image id→Artifact→ubuntuDisk image to create the VM from. You added it at this step. Boot disk Value→Key: Initialize params→Value→Key: Size→Value→32Disk size. Boot disk Value→Key: Initialize params→Value→Key: Type→Value→network-ssdDisk type. Network interface Value→Item 1→Value→Key: Subnet id→Resource→vpc-subnet-0The VM will reside in vpc-subnet-0.Resources Value→Key: Cores→Value→2Number of vCPUs Resources Value→Key: Memory→Value→8Amount of RAM Metadata Value→Item 1→Key: pg-host-0→Reference→postgres-cluster→host[0].fqdnSettings for connecting from the VM to the database. First cluster host. Metadata Value→Item 2→Key: pg-host-1→Reference→postgres-cluster→host[1].fqdnSettings for connecting from the VM to the database. Second cluster host. Metadata Value→Item 3→Key: pg-username→Reference→postgres-user→nameSettings for connecting from the VM to the database. Database username. Metadata Value→Item 4→Key: pg-password-lockbox-secret-id→Parameter→postgres_password_secretSettings for connecting from the VM to the database. DB user password. Platform id Value→standard-v3Platform on which the VM will run. Service account id Resource→service-accountThe service account with read permissions for the Lockbox secret that stores the DB user password. Zone Reference→vpc-subnet-0→zoneThe VM will reside in the same availability zone as vpc-subnet-0.Depends on lockbox-payload-viewerThe VM will be created after the lockbox-payload-viewerresource.
-
-
Click Save to save the configuration.
Install the app
- In the top-right corner, click Run.
- Fill out the form.
- Click Install.
- Wait for the service to verify the resources you are creating and click Confirm.
- The application list will now contain your
demo-appwith theDeployingstatus. Wait until the status switches toDeployed. This may take several minutes. - Check all newly created resources. Connect to the VM and make sure it can access the Yandex Managed Service for PostgreSQL cluster.