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.