# Google Cloud deployment guide

Authorize on the platform <https://console.cloud.google.com/>

{% embed url="<https://youtu.be/6U3XDAI9bHQ?si=FVmBwEByRyytRHVT>" %}

Let's start configuring

{% hint style="info" %}
For quick and convenient navigation on the Google Cloud platform, use the search pane
{% endhint %}

### Creating storage

1. Open Navigation menu / Products & solutions / Storage / **Cloud Storage**
2. On the Cloud Storage tab select **Create**
3. Enter the storage name, for example *miko-images*
4. Use default values for other fields
5. After entering the values, click the **Create** button

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FkwjDRiCwxUjAkgP3M18L%2FMikoPBXGoogleCloudInstallation_1.png?alt=media&#x26;token=45dcddad-8053-4188-af64-8e126c20cfaf" alt=""><figcaption></figcaption></figure>

6. Open the created *miko-images* storage
7. On the opened tab select **UPLOAD FILES**
8. Upload the file from the MikoPBX distribution with the **.vhd** extension
9. Wait for the file upload to complete

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2F2ZTF7dWuDUUws6pzdjA9%2FMikoPBXGoogleCloudInstallation_2.png?alt=media&#x26;token=fcc95810-26df-466e-9741-27cc8771f649" alt=""><figcaption></figcaption></figure>

### Connecting Cloud Build API

1. Open Navigation menu / APIs & Services / Library / Google Enterprise API / **Cloud Build API**
2. On the opened tab select **ENABLE**

{% hint style="info" %}
Check the roles for the Cloud Build service account:

1. Open the IAM page <https://console.cloud.google.com/projectselector2/iam-admin/iam>.
2. Select your Google Cloud project
3. Check the **Include Google-provided role grants** checkbox
4. In the table, find the row with the email address ending with @cloudbuild.gserviceaccount.com
5. Select Edit principal
6. The roles to be granted to the Cloud Build service account are **Compute Admin** and **Service Account User**

If the required roles are not present, add them and click **SAVE**
{% endhint %}

### Connecting Compute Engine API

1. Open Navigation menu / APIs & Services / Library / Google Enterprise API / **Compute Engine API**
2. On the opened tab select **ENABLE**

### Creating an image

1. Open Navigation menu / Products & solutions / Compute / **Compute Engine**
2. Go to the Storage / Images section
3. Select **CREATE IMAGE** to create a new image
4. Enter the image name, for example *mikopbx-new-image*
5. Specify the source type - **Virtual disk (VMDK, VHD)**
6. Select Virtual disk file under the **BROWSE** link, *Browse / miko-images / .vhd*
7. Uncheck the Install guest packages checkbox
8. In the Operating system on virtual disk field specify - **No operating system. Data only.**
9. Use default values for other fields
10. After entering the values, click the **Create** button and wait for the image creation to complete

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2F2mxkIjjCc4Wy2imHV0gA%2FMikoPBXGoogleCloudInstallation_3.png?alt=media&#x26;token=8634d896-ab1b-4f0c-b58a-ad08d3a44735" alt=""><figcaption></figcaption></figure>

### Creating a virtual machine

1. In the **Compute Engine** tab go to the Virtual machines / VM Instance section
2. Select **CREATE INSTANCE**
3. Enter the virtual machine name, for example *mikopbx-vm*

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FDpEOmG3gCs4ySd7JYx9R%2FMikoPBXGoogleCloudInstallation_4.png?alt=media&#x26;token=a8dd31a0-8075-4440-b325-14da52a22480" alt=""><figcaption></figcaption></figure>

4. In the Machine configuration / General purpose table select Series - **N1**

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FcyPuNed7J7hAJkX50lky%2FMikoPBXGoogleCloudInstallation_5.png?alt=media&#x26;token=566d10d3-90ee-424e-bd28-e17b906d1b18" alt=""><figcaption></figcaption></figure>

5. In the Machine type section choose **Shared-core / f1-micro** from the dropdown menu

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FOOrhRb42l2f9kpwyfmkt%2FMikoPBXGoogleCloudInstallation_6.png?alt=media&#x26;token=8f546469-e884-496a-baa2-bd2575e8e9b8" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
To deploy the PBX use **two** disks:

* A **1 Gb** disk for the main system
* A **50+ Gb** disk for storing call recordings
  {% endhint %}

6. In the Boot disk section select **CHANGE**
7. On the opened tab go to CUSTOM IMAGES
8. In the Image field select the previously created *mikopbx-new-image*
9. Use default values for other fields on the tab
10. Click the **SELECT** button

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FyTOWI2rMlSkCQhRMe4zF%2FMikoPBXGoogleCloudInstallation_7.png?alt=media&#x26;token=11135066-7408-431d-83ee-0eb17e4686c1" alt=""><figcaption></figcaption></figure>

11. In the Advanced options / Disks section select **ADD NEW DISK**
12. On the opened tab enter the disk name for data storage, for example *disk-storage-mikopbx*
13. Specify the disk size of at least 50GB
14. Use default values for other fields on the tab
15. Click the **SAVE** button

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FEgjsPqUHX1c6KIMKGAmN%2FMikoPBXGoogleCloudInstallation_9.png?alt=media&#x26;token=97b79de5-dc92-4446-8995-19e27d0481e0" alt=""><figcaption></figcaption></figure>

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FgpSTO8QVEAk16EQlomc9%2FMikoPBXGoogleCloudInstallation_10.png?alt=media&#x26;token=028eb200-74cc-4efa-8031-824e30660a6a" alt=""><figcaption></figcaption></figure>

If you have an SSH key, proceed as follows:

16. In the Advanced options / Security / MANAGE ACCESS section, select **ADD ITEM**
17. Specify it in the SSH key field

If you don't have an SSH key, proceed directly to step 18

18. Use default values for other fields
19. After entering the values, click the **CREATE** button

### Configuring ports for incoming connections

1. Open Navigation menu / VPC network / **Firewall**
2. Select **CREATE FIREWALL RULE** to create a new rule for incoming connections
3. Enter the name of the new rule, for example *internal-allow*

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2F6YxWeaebcJOiismv40cD%2FMikoPBXGoogleCloudInstallation_11.png?alt=media&#x26;token=8a137a16-0007-4af7-a26c-0c6ca188fad1" alt=""><figcaption></figcaption></figure>

4. Specify Direction of traffic - **Ingress**
5. Specify Targets
6. From the Source filter dropdown menu select **IPV4 ranges** and in the Source IPv4 ranges field enter **0.0.0.0/0**

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FMGWQ9a2rBzAXa6LkBbnp%2FMikoPBXGoogleCloudInstallation_12.png?alt=media&#x26;token=6b5c623b-31cb-446a-899f-861672c8dde4" alt=""><figcaption></figcaption></figure>

7. In the Protocols and ports section check the **TCP** (Ports - **0-65535**) and **UDP** (Ports - **0-65535**) checkboxes

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2Fr2p2rgzE5CCFmz6W2nyp%2FMikoPBXGoogleCloudInstallation_13.png?alt=media&#x26;token=eae3966d-b252-4614-af45-0bdd7877312d" alt=""><figcaption></figcaption></figure>

8. Use default values for other fields
9. After entering the values, click the **CREATE** button

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FtIETWpzmIvpZFcONfFt7%2FMikoPBXGoogleCloudInstallation_14.png?alt=media&#x26;token=9456857c-a56d-4518-a6d9-f0855c3a9de3" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
Make sure to configure the Firewall on the MikoPBX
{% endhint %}

### Starting MikoPBX

1. Open the Compute Engine tab and go to the Virtual machines / VM Instance section
2. Go to the created virtual machine *mikopbx-vm*
3. On the opened tab navigate to Logs / Serial port 1 (console)

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2F7P2PgWHaYlXhIjUoHKuP%2FMikoPBXGoogleCloudInstallation_17.png?alt=media&#x26;token=a3bfb1d9-8556-442d-8040-6f2e25704ae9" alt=""><figcaption></figcaption></figure>

4. Copy the external address of the created virtual machine and enter it in the browser's address bar
5. For login use the login and password provided in Serial port 1 (console)

Авторизуйтесь на платформе <https://console.cloud.google.com/>

Приступим к настройке

{% hint style="info" %}
Для быстрого и удобного поиска на платформе Google Cloud используйте панель поиска
{% endhint %}

### **Создание** хранилища

1. Откройте Navigation menu / Products & solutions / Storage / **Cloud Storage**
2. На вкладке Cloud Storage выберите **Create**
3. Введите имя хранилища, например *miko-images*
4. Для других полей используйте значения по умолчанию
5. Завершив ввод значений, нажмите кнопку **Create**
6. Откройте созданное хранилище *miko-images*
7. На открывшейся вкладке выберите **UPLOAD FILES**
8. Загрузите файл из дистрибутива MikoPBX с расширением **.vhd**
9. Дождитесь окончания загрузки файла

### **Подключение C**loud Build API

1. Откройте Navigation menu / APIs & Services / Library / Google Enterprise API / **Cloud Build API**
2. На открывшейся вкладке выберите **ENABLE**

{% hint style="info" %}
Проверьте роли учетной записи службы Cloud Build, для этого

1. Откройте страницу IAM <https://console.cloud.google.com/projectselector2/iam-admin/iam>
2. Выберите свой проект Google Cloud
3. Установите флажок **Include Google-provided role grants**
4. В таблице найдите строку с адресом электронной почты, заканчивающимся на @cloudbuild.gserviceaccount.com
5. Выберите **Править (Edit principal)**
6. Роли, которые должны быть предоставлены учетной записи службы Cloud Build, - **Сompute Admin** и **Service Account User**

Если нужных ролей нет, добавьте и нажмите **SAVE**
{% endhint %}

### **Подключение Compute Engine** API

1. Откройте Navigation menu / APIs & Services / Library / Google Enterprise API / **Compute Engine API**
2. На открывшейся вкладке выберите **ENABLE**

### **Создание** образа

1. Откройте Navigation menu / Products & solutions / Compute / **Compute Engine**
2. Перейдите в раздел Storage / Images
3. Выберите **CREATE IMAGE** для создания нового образа
4. Введите имя образа (Name), например *mikopbx-new-image*
5. Укажите тип источника (Source) - **Virtual disk (VMDK, VHD)**
6. Выберите Virtual disk file по ссылке **BROWSE**, \*Browse / miko-images / *.vhd*
7. Уберите флажок Install guest packages
8. В поле Operating system on virtual disk укажите - **No operating system. Data only.**
9. Для других полей используйте значения по умолчанию
10. Завершив ввод значений, нажмите кнопку **Create** и дождитесь окончания создания образа

### **Создание виртуальной машины**

1. Во вкладке **Compute Engine** перейдите в раздел Virtual machines / VM Instance
2. Выберите **CREATE INSTANCE**
3. Введите имя виртуальной машины (Name), например *mikopbx-vm*
4. В таблице Machine configuration / General purpose \*\*\*\*выберите \*\*\*\*Series - **N1**
5. В разделе Machine type в выпадающем меню выберите **Shared-core / f1-micro**
6. В разделе Boot disk выберите **CHANGE**
7. На открытой вкладке перейдите к CUSTOM IMAGES
8. В поле Image выберите созданный ранее образ *mikopbx-new-image*
9. Для других полей на вкладке используйте значения по умолчанию
10. Нажмите кнопку **SELECT**
11. В разделе Firewall \*\*\*\*разрешите HTTP трафик, установите флажок **Allow HTTP traffic**
12. В разделе Advanced options / Disks выберите **ADD NEW DISK**
13. На открытой вкладке введите имя диска для хранения данных (Name), например *disk-storage-mikopbx*
14. Укажите размер диска (Size) не менее 50Гб
15. Для других полей на вкладке используйте значения по умолчанию
16. Нажмите кнопку **SAVE**

Если у вас есть ключ SSH, выполните следующее

17. В разделе Advanced options / Security / MANAGE ACCESS выберите **ADD ITEM**
18. Укажите его в поле SSH key

Если у вас есть нет ключа SSH, сразу перейдите к пункту 19

19. Для других полей используйте значения по умолчанию
20. Завершив ввод значений, нажмите кнопку **CREATE**

### **Настройка портов для входящих соединений**

1. Откройте Navigation menu / VPC network / **Firewall**
2. Выберите **CREATE FIREWALL RULE** для создания нового правила для входящего соединения
3. Введите имя нового правила (Name), например http-80
4. Укажите Direction of traffic - **Ingress**
5. Укажите Targets
6. Из выпадающего меню в поле Source filter выберите **IPV4 ranges** и в поле Source IPv4 ranges укажите **0.0.0.0/0**
7. В разделе Protocols and ports установите флажок **TCP** и в поле Ports укажите **80**
8. Для других полей используйте значения по умолчанию
9. Завершив ввод значений, нажмите кнопку **CREATE**
10. Аналогично создайте правило для HTTPS. Укажите имя, Direction of traffic - **Ingress,** Targets, Source filter - **IPV4 ranges,** Source IPv4 ranges - **0.0.0.0/0**, Protocols and ports - **TCP,** Ports - **443**
11. Аналогично создайте правило для SIP сигнализации TCP. Укажите имя, Direction of traffic - **Ingress,** Targets, Source filter - **IPV4 ranges,** Source IPv4 ranges - **0.0.0.0/0**, Protocols and ports - **TCP,** Ports - **5060**
12. Аналогично создайте правило для SIP сигнализации UDP. Укажите имя, Direction of traffic - **Ingress,** Targets, Source filter - **IPV4 ranges,** Source IPv4 ranges - **0.0.0.0/0**, Protocols and ports - **UDP,** Ports - **5060**
13. Аналогично создайте правило для передачи звука RTP. Укажите имя, Direction of traffic - **Ingress,** Targets, Source filter - **IPV4 ranges,** Source IPv4 ranges - **0.0.0.0/0**, Protocols and ports - **UDP,** Ports - **10000-10200**

#### **Запуск АТС MikoPBX**

1. Откройте вкладку Compute Engine перейдите в раздел Virtual machines / VM Instance
2. Скопируйте **External IP** созданной виртуальной машины
3. Введите в строке браузера External IP
4. Откройте созданную виртуальную машину
5. Скопируйте **Instance Id** - это пароль для входа в АТС по умолчанию
6. Логин для входа по умолчанию - **admin**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mikopbx.com/mikopbx/english/setup/cloud/google-cloud/google-cloud.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
