Migrate Laf to Sealos cloud development (Sealaf) with one click, all you need is a hand!

Laf cloud development has recently been officially integrated with Sealos to become Sealos cloud development (Sealaf) . Sealaf inherits the core functions of Laf, configures a dedicated database by default, and has better stability . In the future, we will shift the focus of iterations to Sealaf. It is strongly recommended to Migrate applications on Laf to Sealaf immediately !

Why migrate?

Can be linked to enrich the application ecosystem : There are a variety of applications in the Sealos application market , and these applications can be deployed with one click and used out of the box. You can directly call the capabilities provided by these applications on the intranet in cloud functions , meeting your business in one stop!

More database and middleware choices : In the past, the only cloud database provided by Laf was MongoDB. Now, various databases and middleware such as PostgreSQL, MySQL, Redis, Kafka, and ElasticSearch can be started directly on Sealos with one click , and can be called directly on the intranet . .

Unified account : In the past, users needed to register accounts at Laf and Sealos separately. Now there is no need to register and recharge separately. Sealos accounts and bills are used uniformly (for balance transfers, please contact customer service).

More flexible management : In the past, users could not independently manage the cloud database created by Laf, such as backup, log, observation, import and export, etc. Now, the database created on Sealos cloud development can be directly managed and monitored through the Sealos database management application, and can also be used Direct connection to local database management tools.

Multi-region selection : Sealos currently supports availability zones such as Hangzhou , Beijing , Guangzhou , and Singapore to meet the needs of different businesses. Recharge under one Sealos account can be used across multiple regions.

Migrate content

Laf migration contains the following multiple pieces of content. We can use laf-cli to quickly complete the migration:

  • Cloud function
  • cloud storage
  • database
  • trigger
  • environment variables
  • functional dependency
  • Custom domain name
  • Website hosting

Migration steps

1. Create PAT in laf and sealaf respectively


For detailed usage of laf-cli, please refer to laf-cli documentation

2. Download cli and initialize user

npm install -g laf-cli

laf user add laf -r https://laf.run
# 填入对应可用区的 api url
laf user add sealaf-hzh -r https://sealaf-api.hzh.sealos.run

laf user switch laf
# <PAT> 替换为刚刚创建的 PAT
laf login <PAT>
laf user switch sealaf-hzh
laf login <PAT>

The API addresses corresponding to Sealos in different availability zones of Sealos are as follows :

3. Pull the original application data

APPID="" # laf 上的 appid
mkdir $APPID && cd $APPID

laf user swicth laf
laf app init $APPID

# 拉取云存储、环境变量、依赖
laf func pull

laf env pull

laf dep pull

# 列出存储
laf storage list

# 依次拉取存储到指定目录
laf storage pull <bucketName> <path>

# 拉取数据库
laf database export ./db

# 删除 .app.yaml 以便重新 init 新应用
rm .app.yaml

4. Push data to new applications

NEW_APPID=""
laf user swicth sealaf-hzh

laf app init $NEW_APPID

laf func push

laf env push

laf dep push

# 需要先在 sealos 对象存储上手动创建桶
laf storage push <bucketName> <path>

# 导入数据库
laf database import $APPID ./db/xxx.gz

rm .app.yaml

5. Restart the application

Restart to ensure that environment variables, etc. take effect

6. (Optional) Manually create triggers and custom domain names

  • Method 1: Use laf-cli to create a trigger
# 列出触发器
laf trigger list
# 创建
laf create <name> <target> <cron>
  • Method 2: Create a trigger directly in the Sealaf interface

7. (Optional) Enable website hosting in sealos object storage

8. (Optional) cloud.storage.bucketChanges

If it is used in the original application code cloud.storage.bucket(bucketName), it needs to be manually modified to the new bucket name in the new application (note: the full bucket name must now be filled in)

The migration document has been placed in the laf official document, you can click to view it directly

Linus took it upon himself to prevent kernel developers from replacing tabs with spaces. His father is one of the few leaders who can write code, his second son is the director of the open source technology department, and his youngest son is an open source core contributor. Robin Li: Natural language will become a new universal programming language. The open source model will fall further and further behind Huawei: It will take 1 year to fully migrate 5,000 commonly used mobile applications to Hongmeng. Java is the language most prone to third-party vulnerabilities. Rich text editor Quill 2.0 has been released with features, reliability and developers. The experience has been greatly improved. Ma Huateng and Zhou Hongyi shook hands to "eliminate grudges." Meta Llama 3 is officially released. Although the open source of Laoxiangji is not the code, the reasons behind it are very heart-warming. Google announced a large-scale restructuring
{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/u/4148359/blog/11051854