logo
2
2
Login

Introduction

This repository demonstrates how to use .cnb.yml endStages and Tencent Cloud COS to implement persistent storage for Postgres in cloud development environments.

Description

During cloud development environment shutdown phase, the tencentcom/coscli plugin is used to synchronize specified directories to COS object storage. During startup phase, data from COS object storage is restored to specified directories, achieving data persistence.

The storage path in COS object storage is: /{reponame}/{branchname}

The secret repository imported in .cnb.yml contains:

SECRET_ID: AKIDxxxxx SECRET_KEY: yyyyyy REGION: ap-guangzhou BUCKET: cnb-vvvv

After startup, you can connect to the database and test using:

docker exec -it workspace-postgres-1 psql -U testuser -d testdb

Notes

  1. Please select Guangzhou region for COS, as currently only Guangzhou region COS transfers data with CNB through internal network
  2. Database files may be large - please wait patiently for 10-20 seconds for data synchronization after startup

About

使用endstages和COS实现云开发环境中数据库的持久化存储

Language
Markdown96.7%
gitignore3.3%