skygear server
v2.2.0

接下來是旨在跟隨的Skygear的V2
.
├── pkg
│ ├── server <-- original skygear-server code
│ ├── auth
│ ├── gateway
│ └── core
└── cmd
├── auth
│ └── main.go
└── gateway
└── main.go
如果遇到構建錯誤,則看起來像invalid flag in pkg-config --cflags: -Xpreprocessor , export CGO_CFLAGS_ALLOW=-Xpreprocessor 。
如果您打算在本地構建和運行,則需要安裝以下依賴項。
如果您是MacOS和Homebrew的用戶,則可以通過
brew install pkgconfig vipsgateway用於module 。pkg/gateway/model/app.go使用新的Gear , App和GetGearVersion 。pkg/gateway/db/app.go中更新GetAppByDomain ,並使用新的Gear版本列。pkg/gateway/model/plan.go中的Plan結構和CanAccessGear funcpkg/gateway/config/config.go中的GearURLConfig和GetGearURL func 以下部分是關於網關和齒輪數據庫遷移的。
如果您來自SkyGear-Server 0.x至1.x,最大的區別是SkyGear中的Gears Next不支持服務器啟動時間中的自動數據庫遷移。
DB遷移必須在服務器啟動之前運行。而且,由於我們還沒有SkyGear的全功能DB管理工具,因此這裡是SkyGear Next Next用戶的新啟動者的一般指南。
例如,應用程序名稱是helloworld ,您想運行auth Gear。
# Base app_config schema for core gateway
CREATE SCHEMA app_config;
# Create shared schema for apps
# Run the following SQL in any postgresql client, like Postico
CREATE SCHEMA app;
# If you have psql cli
$ psql ${DATABASE_URL} -c "CREATE SCHEMA app;"
# Run core and auth migration
$ make -C migrate migrate MIGRATE_CMD=up DATABASE_URL=${DATABASE_URL} SCHEMA=app
有關數據庫遷移的更多命令,請參見下文部分。
添加一個版本
# MODULE can be gateway, core, auth...
$ export MODULE= < module_name >
$ export REVISION= < revision_description >
$ make -C migrate add-version MODULE= ${MODULE} REVISION= ${REVISION}檢查當前DB版本
$ make -C migrate
dry
交易將是回滾
$ make -C migrate MIGRATE_CMD=up DRY_RUN=1
使用github源運行遷移
$ make -C migrate migrate
CORE_SOURCE=github://:@skygeario/skygear-server/migrations/core#6918eed
AUTH_SOURCE=github://:@skygeario/skygear-server/migrations/auth#6918eed
MIGRATE_CMD=up
在集群中運行數據庫遷移到所有應用程序(多租戶模式)
運行核心和身份驗證遷移到實時驗證版本的應用
$ make -C migrate migrate
APP_FILTER_KEY=auth_version
APP_FILTER_VALUE=live
CONFIG_DATABASE=postgres://postgres:@localhost/postgres?sslmode=disable
HOSTNAME_OVERRIDE=localhost
MIGRATE_CMD=up
在HTTP服務器模式下啟動遷移服務器
$ make -C migrate http
調用遷移服務器
POST /migrate
請求示例
{
"migration" : " auth " ,
"schema" : " app_config " ,
"database" : " postgres://postgres:@localhost:5432/postgres?sslmode=disable " ,
"command" : " version "
}響應示例
{
"result" : " 1563434450 "
} Copyright (c) 2015-present, Oursky Ltd.
All rights reserved.
This source code is licensed under the Apache License version 2.0
found in the LICENSE file in the root directory of this source tree.
An additional grant of patent rights can be found in the PATENTS
file in the same directory.