From c13560c9193fd0c0144b76881160420459d50254 Mon Sep 17 00:00:00 2001 From: Kerwin Bryant Date: Wed, 28 May 2025 08:24:24 +0800 Subject: [PATCH] feat: add gitpod support (#6922) --- .gitpod.yml | 76 +++++++++++++++++++++++++++++++++++++++++++------ README.ja-JP.md | 6 ++++ README.md | 5 ++++ README.zh-CN.md | 6 ++++ 4 files changed, 84 insertions(+), 9 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 85bc033275..8717cd9dfd 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,13 +1,71 @@ -# This configuration file was automatically generated by Gitpod. -# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml) -# and commit this file to your remote git repository to share the goodness with others. - -# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart - -image: gitpod/workspace-postgres +env: + DB_DIALECT: "mysql" + DB_HOST: "localhost" + DB_PORT: "5432" + DB_DATABASE: "nocobase" + DB_USER: "nocobase" + DB_PASSWORD: "nocobase" + APP_PORT: "13000" + DB_CONTAINER_NAME: "nocobase-db" tasks: - - init: yarn install && yarn run build - command: yarn run start + - name: Start MySQL + before: | + container_id=$(docker ps --all --quiet --filter "name=${DB_CONTAINER_NAME}") + if [ -z "${container_id}" ]; then + docker create --name ${DB_CONTAINER_NAME} -p "${DB_PORT}:3306" \ + -e MYSQL_ROOT_PASSWORD="${DB_PASSWORD}" \ + -e MYSQL_DATABASE="${DB_DATABASE}" \ + -e MYSQL_USER="${DB_USER}" \ + -e MYSQL_PASSWORD="${DB_PASSWORD}" \ + mysql:8 \ + --character-set-server=utf8mb4 \ + --collation-server=utf8mb4_unicode_ci + fi + docker start "${DB_CONTAINER_NAME}" + command: | + echo "Database started" + gp sync-done db-ready + exit 0 + + - name: Setup Environment + init: | + cat > .env << EOL + DB_DIALECT=mysql + DB_HOST=${DB_HOST} + DB_PORT=${DB_PORT} + DB_DATABASE=${DB_DATABASE} + DB_USER=${DB_USER} + DB_PASSWORD=${DB_PASSWORD} + NOCOBASE_PKG_USERNAME= + NOCOBASE_PKG_PASSWORD= + EOL + command: | + echo "Environment configured" + gp sync-done env-ready + exit 0 + - name: Install Dependencies + init: | + yarn install + yarn nocobase install + command: | + echo "Dependencies installed" + gp sync-done deps-ready + exit 0 + + - name: Start Application + command: | + gp sync-await db-ready + gp sync-await env-ready + gp sync-await deps-ready + yarn dev + +ports: + - port: 5432 + onOpen: ignore + visibility: private + - port: 13000 + onOpen: open-preview + visibility: public \ No newline at end of file diff --git a/README.ja-JP.md b/README.ja-JP.md index 49e5c1be42..c2296e5fe8 100644 --- a/README.ja-JP.md +++ b/README.ja-JP.md @@ -30,6 +30,12 @@ https://www.nocobase.com/ja/tutorials 顧客のストーリー: https://www.nocobase.com/ja/blog/tags/customer-stories +## クイックスタート + +Gitpodを使用すると、すぐに使える開発環境を構築できます。 + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/nocobase/nocobase) + ## リリースノート リリースノートは[ブログ](https://www.nocobase.com/ja/blog/timeline)で随時更新され、週ごとにまとめて公開しています。 diff --git a/README.md b/README.md index a2cfdb2bc4..70b2dbca4a 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,11 @@ https://www.nocobase.com/en/tutorials Use Cases: https://www.nocobase.com/en/blog/tags/customer-stories +## Quickstart + +To get a quick working development environment you could use Gitpod. + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/nocobase/nocobase) ## Release Notes diff --git a/README.zh-CN.md b/README.zh-CN.md index 728695efc7..59874785d3 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -30,6 +30,12 @@ https://www.nocobase.com/cn/tutorials 用户故事: https://www.nocobase.com/cn/blog/tags/customer-stories +## 快速入门 + +要获得快速工作的开发环境,您可以使用 Gitpod。 + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/nocobase/nocobase) + ## 发布日志 我们的[博客](https://www.nocobase.com/cn/blog/timeline)会及时更新发布日志,并每周进行汇总。