
El siguiente es el V2 de Skygear que tiene como objetivo seguir
.
├── pkg
│ ├── server <-- original skygear-server code
│ ├── auth
│ ├── gateway
│ └── core
└── cmd
├── auth
│ └── main.go
└── gateway
└── main.go
Si se encuentra con un error de compilación, parece invalid flag in pkg-config --cflags: -Xpreprocessor , export CGO_CFLAGS_ALLOW=-Xpreprocessor .
Si planea construir y ejecutar localmente, debe instalar las siguientes dependencias.
Si está en macOS y usuario de HomeBrew, puede instalarlos por
brew install pkgconfig vipsgateway para module .pkg/gateway/model/app.go con nuevo engranaje en Gear , App y GetGearVersion .GetAppByDomain en pkg/gateway/db/app.go con la nueva columna de versión de Gear.Plan y CanAccessGear FUNC en pkg/gateway/model/plan.goGearURLConfig y GetGearURL Func en pkg/gateway/config/config.go La siguiente parte es sobre la migración de Gateway y Gears DB.
Si viene de SkyGear-Server 0.x a 1.x, la mayor diferencia es que los Gears en SkyGear a continuación no admitirían la migración de DB automática en el tiempo de arranque del servidor.
La migración de DB debe ejecutarse antes del arranque del servidor. Y dado que aún no tenemos una herramienta de administración de DB con toda su cuenta para SkyGear, aquí hay una guía general para los recién llegados del usuario del próximo usuario de Skygear.
Por ejemplo, el nombre de la aplicación es helloworld y desea ejecutar 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
Consulte las secciones a continuación para obtener más comandos sobre la migración de DB.
Agregar una versión
# MODULE can be gateway, core, auth...
$ export MODULE= < module_name >
$ export REVISION= < revision_description >
$ make -C migrate add-version MODULE= ${MODULE} REVISION= ${REVISION}Verifique la versión actual de DB
$ make -C migrate
Ejecute en seco la migración
La transacción será reversión
$ make -C migrate MIGRATE_CMD=up DRY_RUN=1
Ejecute la migración con la fuente de 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
Ejecutar la migración de DB a todas las aplicaciones en clúster (modo de inquilino múltiple)
Ejecute migraciones de núcleo y autenticación a aplicaciones que autentican la versión en vivo
$ 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
Iniciar servidor de migración en modo HTTP Server
$ make -C migrate http
Llamar al servidor de migración
POST /migrate
Ejemplo de solicitud
{
"migration" : " auth " ,
"schema" : " app_config " ,
"database" : " postgres://postgres:@localhost:5432/postgres?sslmode=disable " ,
"command" : " version "
}Ejemplo de respuesta
{
"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.