# Aliyun public beta version migrated to the official version

To make it easier for developers to migrate their business from the public beta version to the official version, we provide the function of one-click migration from the public beta version to the official version. Developers can log in to the [uniCloud console](https://unicloud.dcloud.net. cn) operation migration, the process is as follows:

# Purchase official version migration space

To migrate from the beta version to the official version, you need to place an order to purchase the official version space to be migrated through the migrate official version operation. This operation will add a migration binding relationship for the two spaces to facilitate subsequent migration configurations.

When migrating, you can choose the new space to use As you go or Monthly package.

If you choose a package, at present, based on the average usage level of the public beta version of the old service space in the last 30 days, a total of 12 billing indicators will be compared with the thresholds of different packages. The minimum package meets every indicator without exceeding the limit.

After coordination with Alibaba Cloud, a new version of the recommended package plan has been launched, and only 5 billing indicators are mandatory to be verified:

  • Cloud database capacity
  • Cloud storage capacity
  • Front-end web hosting capacity
  • Cumulative CDN traffic of cloud storage in the past 30 days
  • Cumulative CDN traffic of front-end web hosting in the past 30 days

Satisfy these 5 indicators, you can migrate. Packages whose other metrics exceed usage will warn, but also allow migration.

If your migration options only have pay-as-you-go and no packages, it means that even the most advanced packages are not enough.

Because the old space does not provide traffic statistics, and has always been free. As a result, many developers do not know how much their traffic and storage consumption is, and they may be surprised by the standard of the lowest package.

For developers who think that the package exceeds expectations, it may be that there are too many useless files in the storage or the code needs to be optimized. It is recommended to switch to pay-as-you-go. Run for a day to see where the usage is consumed and where the problem is, and then optimize the code. and storage to keep costs down.

Although the number of users is small, the packages are highly recommended. Common problems include:

  1. The size of the storage file is too large, and the storage of the low-end package is not enough, so it cannot be migrated
  2. Timing tasks lead to high cloud function usage and database read and write volume
  3. Unreasonable code design, one page initiates too many requests
  4. The running memory of the cloud function is set too high. Under normal circumstances, 256M memory is enough. It can be adjusted in cloud function package.json or web console.
  5. If you used uni statistics before, it is recommended to adjust the data reporting frequency and cloud batch running frequency of the statistics. Don't create too many resources. See details

DCloud is always a product service company that provides developers with more cost-effective solutions. DCloud will not deliberately recommend high-end packages that developers do not need in order to make money.

At present, the monthly package can be converted to pay-as-you-go, but the pay-as-you-go package cannot be converted to a monthly package. We will push Alibaba Cloud to solve it as soon as possible.

Before purchasing the space to be migrated, you can already obtain the domain name uploaded and downloaded by the cloud storage after migration. If you want to develop a MiniApp, since the white list of the security domain name of the MiniApp is cached on the client, it is recommended to change the cloud storage domain name to Add to whitelist**.

When placing an order, you can set the execution time of the migration task. The migration time only supports a time point within two hours to three days. You can change the migration time before the execution starts.

Since the official version space to be migrated is a brand new and independent space, a new SpaceId will be assigned after creation, and the rule is mp-public beta version SpaceId.

In order to be more compatible in cloud functions/cloud objects, when purchasing the official space to be migrated, you can choose Whether to be compatible with SpaceID in cloud functions/cloud object codes, if this option is enabled, the cloud functions/cloud objects after migration The context.SPACEINFO.spaceId obtained in context.SPACEINFO.spaceId and the SpaceId in cloudInfo will remain unchanged, and will still be the SpaceId of the original beta version. Developers can use context.SPACEINFO.useOldSpaceId or cloudInfo.useOldSpaceId to judge whether the currently obtained spaceId is before migration. true means that the service space id obtained by the current service space in the cloud function is the service space id before migration , otherwise it is the new space id. For running local cloud functions, this feature is supported starting from HBuilderX 3.6.13, and the cloud supports this feature by default. **The new service space id after migration is prefixed with mp- to the old space id. **

Notice:

  • The public beta version cannot be migrated to the free version (developer version) of the official version
  • If there is a need for cross-account migration, you need to use the email address of the account to which the space belongs to send an email to service@dcloud.io explaining the new account and service space to apply
  • After purchasing the official version space to be migrated, in order to ensure the consistency of data migration, the official version space at this time cannot be associated with HBuilderX, cannot create data tables in the console, cannot upload files in cloud storage and front-end web hosting, etc., until The migration is complete.
  • After purchasing the official version space to be migrated, the cloud storage and front-end web hosting cdn traffic will start to be billed and paid to the official version space
  • The cloud storage and CDN traffic hosted by the front-end web page generated by using the link of the old space will be counted and added to the official space at a certain time on the next day
  • Only the official version service space created through Migrate Official Version supports one-click migration, and the original official version space cannot use this function.
  • If the client is a MiniApp, please go to the background of the MiniApp to configure a new upload domain name to the white list of upload domain names before migrating (be careful not to remove the upload and download domain names of the public beta service space), because the MiniApp security domain name is in There is a cache in the WeChat client, it is recommended to configure it two days before the migration
  • If there are many files, it is recommended to migrate them in the middle of the night and other times when users do not access them. The migration process takes several minutes (depending on the amount of files stored in the cloud), and most functions can still be used during the migration, but the upload function of the cloud storage will be turned off during the migration. If there are not many files, it is recommended to migrate during working hours. In case of any problems, you can contact the technical support of DCloud and Alibaba Cloud in time.
  • The official version's fixed IP proxy export IP is different from the public beta version. If you have configured a domain name whitelist on a third-party platform, please modify it yourself. Refer to: Aliyun Fixed IP
  • After migrating to the official version, the database backup of the public beta service space will not be migrated
  • After migrating to the official version, the developer will use the service space ID of the official version when packaging and releasing HBuilderX next time. Please note that at this time, you need to modify the MiniApp request domain name whitelist, and add api.next.bspapp.com to the request domain name whitelist
  • After migrating to the official version, the default domain name of the front-end web hosting of the public beta service space will be automatically recycled after the public beta ends
  • After migrating to the official version, the service space of the public beta version cannot be deleted, and it needs to be automatically recovered after the public beta is over

# Migration started

The system will automatically start the migration task at the set migration time. The migration logic and precautions are as follows:

# Cloud Database

  • The cloud database does not need to be migrated, and the database of the public beta version service space will be associated with the official version, so do not delete the public beta version data

Whether the service can be normal during the migration: Yes

Migration type: Senseless migration

Migration time-consuming: none

# Cloud Functions

  • Cloud function scheduled tasks, urlization configuration and custom domain names will be migrated together, and urlization requests of the public beta service space will be automatically forwarded to the official version of the service space
  • If a custom domain name is bound, the request will still be made to the public beta space and then forwarded to the official version space. You can also resolve the domain name to the official version service space, eliminating the logic of request forwarding

Alibaba Cloud public beta version callFunction requests and cloud object calls use the domain name api.bspapp.com, and the official version is api.next.bspapp.com. In order to prevent old clients (clients released before migration) from being unable to access the new service space after migration, Alibaba Cloud forwards the request. After the migration is complete, the old client will still request api.bspapp.com and Alibaba Cloud will send Requests sent to the old space are forwarded to the new space. In order to ensure that the old version of the client can normally request the cloud function before and after the migration

Whether it is the default domain name or a custom domain name, the urlization access is similar to the above forwarding logic. Developers can also resolve custom domain names to new spaces, eliminating the logic of request forwarding.

Whether the service can be normal during the migration: Yes

Migration type: Senseless migration

Migration time-consuming: about 3-5 minutes

# Cross domain configuration

  • Due to the upper limit of 9 cross-domain configuration records in the official version, cross-domain configuration records may exceed the upper limit after migration, and new additions cannot be made at this time. The official version of the cross-domain configuration supports pan-domain names. You can delete multiple sub-domain names configured in the public beta version and add a pan-domain name.
  • The cross-domain configuration will also take effect for the front-end web page hosting, if you configured a custom domain name for the front-end web page hosting before the migration. After migration, you need to rebind the custom domain name hosted by the front-end web page before adding new cross-domain configurations.
  • After migration, if the website is republished without associating with the new space, accessing the cloud function will use the cross-domain configuration of the old space. If you need to use the cross-domain configuration of the new space, you need to associate the new space and republish
  • The official version allows all ports of 127.0.0.1 to cross-domain by default

Whether the service can be normal during the migration: Yes

Migration type: Senseless migration

Migration time-consuming: very short, negligible

# Cloud Storage

  • After the cloud storage migration starts, the function of uploading files is unavailable, and the access will not be affected
  • 原云存储链接仍可正常访问,流量费用会计到正式版空间,正式版空间如果是包年包月则从资源用量中扣除,如果是按量计费则会出账并从余额中扣除,出账时间为T+2
  • 使用HBuilderX 3.6.10-Alpha或3.6.5-正式版之前的版本发布的应用,迁移后上传文件会报错(错误信息为:文件上传失败,web端上传请求会返回403错误码),需要使用更新的HBuilderX版本重新发布应用(不管是app、小程序、web均需要重新发布,app端可使用wgt更新)。cli创建的项目需要更新项目依赖,参考:修改依赖为指定版本
  • For the newly uploaded video files of the official version, the video frame capture only supports the H.264 encoding format, not the H.265 encoding format, and the videos uploaded by the original public beta version will not be affected

Whether the service can be normal during the migration: can be accessed normally, but cannot be uploaded

Migration type: Feeling migration, no files can be uploaded during migration

Migration time-consuming: a single file is large in size, and it takes about 1 minute to migrate 1GB; a single file is small in size and there are many files, and it takes about 30 minutes for 10,000 files

# Front-end web hosting

  • Front-end web page hosting files and custom domain names will be migrated together, and access will not be affected during the migration
  • The homepage of the website needs to be set to index.html, if it is set to another subdirectory (xxx/index.html), the migration may fail
  • The single-page application configuration is canceled and replaced by an error page. When migrating, the single-page application directory configured by the developer will be automatically converted into an error page configuration item, and the developer does not need to operate
  • The default domain name and custom domain name will still request to the public beta space at this time, unlike cloud storage, it will not be forwarded to the official version space
  • If the official version space is billed by volume, the front-end web page hosting will be automatically activated when the migration task is executed

Whether the service can be normal during the migration: Yes

Migration type: Feeling migration, after the migration is completed, the custom domain name needs to be re-bound and resolved to the official version

Migration time-consuming: a single file is large in size, and it takes about 1 minute to migrate 1GB; a single file is small in size and there are many files, and it takes about 30 minutes for 10,000 files

# Migration complete

After the migration task is completed, the data related to the service space of the public beta version in the business will be migrated to the official version:

  1. Paid plug-ins purchased from the plug-in market
  2. Redis purchased from public beta service space
  3. Collaborators added to the public beta service space
  4. The security network and IP anti-brush configuration added to the service space of the public beta version

At this time, the public beta version of the service space will not be able to operate in the uniCloud console, and cannot be associated with HBuilderX. The official version of the service space has completely replaced the public beta version, and can be associated with HBuilderX for packaging .

# TODO after the migration is complete

  • Check whether the cloud function is running normally, such as whether the scheduled task and urlization are normal, whether the SpaceId obtained in the cloud function/cloud object meets expectations
  • Check whether the cloud storage upload is normal, the upload request of the public beta service space will be forwarded to the official version, so the uploaded files will be reflected in the official version
  • Check whether the front-end web page hosting is normal, such as access to custom domain names. If you use the default domain name, please replace it with the official domain name as soon as possible

# Front-end web hosting is bound to a custom domain name

If a custom domain name is bound, the service space of the public beta version will still be requested. At this time, the files uploaded from the official version will not be reversely synchronized to the public beta version, resulting in the custom domain name being unable to access newly uploaded files.

Since the custom domain name is still bound to the service space of the public beta version, the status of the domain name hosted on the front-end webpage of the official version space is Need to unbind and rebind

The developer needs to delete the custom domain name in the uniCloud console and then bind it again. After obtaining the new CNAME through this operation, replace the domain name resolution to the new CNAME to complete the domain transfer. During this period, access to the custom domain name hosted on the front-end webpage will be interrupted. It is recommended to deal with it when the traffic volume is low.

# Description of uniCloud special business consumption fee after migration

Many developers use uniCloud because of services such as text messaging, one-click app login, iOS universal links, app uni-upgrade-center, and uni statistics.

After Alibaba Cloud bills, how much do developers care about the costs caused by these businesses? We conduct calculations for developers, and the specific results are as follows:

uni statistics 2.0

uni-upgrade-center

短信

App一键登录

Rewarded video server callback

uni-push2.0

[iOS Universal Links](https://uniapp.dcloud.net.cn/api/plugins/universal-links.html#%E4%BA%91%E8%B5%84%E6%BA%90%E6%B6 %88%E8%80%97%E8%AF%B4%E6%98%8E)