Documentation
¶
Overview ¶
Package migrate moves the data of the Camunda based services into the engine (MIG-01 to MIG-09). It reads the databases of the old services and the REST API of Camunda directly (decided for M7) and writes through the controller and the store of the engine.
A run is a dry run unless Apply is set. It only creates what is missing, so it can run again after a partial failure; ids are kept, and where a new id is needed it is derived from the old one, so that a second run finds what the first one created. The report lists per step what was migrated, what existed already, what needs a decision and what failed.
Index ¶
- func Main(args []string, stdout io.Writer, stderr io.Writer) int
- type Camunda
- type CamundaDeployment
- type CamundaInstance
- type Design
- type FogDeployment
- type FogStart
- type InstanceVariable
- type IoValue
- type Item
- type Module
- type Mongo
- func (this *Mongo) Close(ctx context.Context) error
- func (this *Mongo) Designs(ctx context.Context) ([]Design, error)
- func (this *Mongo) FogDeployments(ctx context.Context) ([]FogDeployment, error)
- func (this *Mongo) FogStarts(ctx context.Context) ([]FogStart, error)
- func (this *Mongo) IoValues(ctx context.Context) ([]IoValue, error)
- func (this *Mongo) Modules(ctx context.Context) ([]Module, error)
- func (this *Mongo) ProcessDeployments(ctx context.Context) ([]ProcessDeployment, error)
- func (this *Mongo) ProcessModels(ctx context.Context) ([]ProcessModel, error)
- func (this *Mongo) Releases(ctx context.Context) ([]Release, error)
- func (this *Mongo) Schedules(ctx context.Context) ([]Schedule, error)
- func (this *Mongo) SmartServiceInstances(ctx context.Context) ([]SmartServiceInstance, error)
- func (this *Mongo) SmartServiceVariables(ctx context.Context) ([]InstanceVariable, error)
- type MongoDatabases
- type Namespaces
- type OldServices
- type Options
- type Parameter
- type PermissionsV2
- type ProcessDeployment
- type ProcessModel
- type Release
- type Report
- type Rights
- type Schedule
- type SmartServiceInstance
- type Sources
- type Status
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Camunda ¶
type Camunda struct {
// base URLs ending in /engine-rest
Urls []string
User string
Password string
Http *http.Client
}
Camunda reads deployments and running instances through the REST API of Camunda engines, e.g. the shards of the process engine; the API needs basic auth.
func (*Camunda) CamundaDeployments ¶
func (this *Camunda) CamundaDeployments(ctx context.Context) ([]CamundaDeployment, error)
CamundaDeployments lists the deployments of every engine with their first process definition and its BPMN; deployments without definition, e.g. of forms only, are left out
func (*Camunda) RunningInstances ¶
func (this *Camunda) RunningInstances(ctx context.Context, d CamundaDeployment) ([]CamundaInstance, error)
RunningInstances reads the running instances of a deployment with their current variables and, from the history, their start time
type CamundaDeployment ¶
type CamundaDeployment struct {
Engine string
Id string
Name string
Source string
TenantId string
Time time.Time
DefinitionId string
// deplid_<vid with _> for deployments of process-deployment, the process id otherwise
Key string
Bpmn string
// switched off through camunda-engine-wrapper v1.1.0, which suspends the definition
Suspended bool
}
CamundaDeployment is a deployment in a Camunda engine with its process definition.
type CamundaInstance ¶
type CamundaInstance struct {
Id string
BusinessKey string
TenantId string
DefinitionId string
Variables map[string]any
// from the history of Camunda; zero if it keeps none
StartTime time.Time
}
CamundaInstance is a running process instance with its current variables.
type Design ¶
type Design struct {
Id string
UserId string
Name string
Description string
BpmnXml string
SvgXml string
UpdatedAt int64
}
Design is a design of smart-service-repository.
type FogDeployment ¶
type FogDeployment struct {
NetworkId string
CamundaDeploymentId string
Deployment models.Deployment
}
FogDeployment is a deployment of a gateway as process-sync keeps its metadata; the id of the deployment model is the platform id.
type FogStart ¶
type FogStart struct {
NetworkId string
BusinessKey string
DeploymentId string
Parameters map[string]any
}
FogStart is a start process-sync watches over (warden); the deployment id may be the platform id or the Camunda id of the gateway.
type InstanceVariable ¶
type IoValue ¶
type IoValue struct {
UserId string
Key string
Value any
DefinitionId string
InstanceId string
Timestamp int64
}
IoValue is a value of process-io; definition and instance are those of Camunda.
type Mongo ¶
type Mongo struct {
// contains filtered or unexported fields
}
Mongo reads the collections of the old services. The services wrote with the default codec of the MongoDB driver, which stores a field without bson tag under its lower-cased Go name and an embedded struct without inline as a sub-document. The documents here are decoded into structs with the same field names, so that they read back exactly as written.
func (*Mongo) FogDeployments ¶
func (this *Mongo) FogDeployments(ctx context.Context) ([]FogDeployment, error)
func (*Mongo) ProcessDeployments ¶
func (this *Mongo) ProcessDeployments(ctx context.Context) ([]ProcessDeployment, error)
func (*Mongo) ProcessModels ¶
func (this *Mongo) ProcessModels(ctx context.Context) ([]ProcessModel, error)
func (*Mongo) Releases ¶
Releases lists the finished releases; those marked as deleted or unfinished are left out
func (*Mongo) SmartServiceInstances ¶
func (this *Mongo) SmartServiceInstances(ctx context.Context) ([]SmartServiceInstance, error)
SmartServiceInstances lists the instances; those being deleted are left out
func (*Mongo) SmartServiceVariables ¶
func (this *Mongo) SmartServiceVariables(ctx context.Context) ([]InstanceVariable, error)
type MongoDatabases ¶
type MongoDatabases struct {
ProcessModels string
ProcessDeployments string
Scheduler string
SchedulerCollection string
Io string
SmartServices string
ProcessSync string
}
MongoDatabases names the databases of the old services; the defaults are those of the platform since the move to the central MongoDB.
func DefaultMongoDatabases ¶
func DefaultMongoDatabases() MongoDatabases
type Namespaces ¶
Namespaces knows the namespaces of the engine.
type OldServices ¶
type OldServices struct {
*Mongo
*Camunda
PermissionsV2
}
OldServices are the sources of a migration on the platform: the MongoDB of the services, the Camunda engines and permissions-v2.
type Options ¶
type Options struct {
// without Apply nothing is written
Apply bool
// deployments that exist only in Camunda and are to be migrated, by Camunda deployment id;
// all others are listed for a decision (MIG-03)
CamundaOnly map[string]bool
// owners for resources whose owner is empty or invalid, e.g. releases with the creator
// placeholder-for-invalid-data (MIG-09)
Owners map[string]string
// running instances are not restarted, only listed (MIG-02)
NoRestart bool
}
Options steer a run.
type PermissionsV2 ¶
type PermissionsV2 struct {
Client permclient.Client
Token func() (string, error)
}
PermissionsV2 reads and writes rights with an admin token, for the old topics and the topics of the namespaces alike.
func (PermissionsV2) Rights ¶
func (this PermissionsV2) Rights(ctx context.Context, topic string, id string) (permmodel.ResourcePermissions, bool, error)
func (PermissionsV2) SetRights ¶
func (this PermissionsV2) SetRights(ctx context.Context, topic string, id string, permissions permmodel.ResourcePermissions) error
type ProcessDeployment ¶
type ProcessDeployment struct {
Id string
Owner string
Source string
Deployment models.Deployment
}
ProcessDeployment is a deployment of process-deployment; its id is the vid of the engine wrapper and the deployment id in the engine.
type ProcessModel ¶
type ProcessModel struct {
Id string
Name string
Owner string
BpmnXml string
SvgXml string
Description string
Publish bool
PublishDate string
Date int64
LastUpdatedUnix int64
}
ProcessModel is a model of process-model-repository.
type Release ¶
type Release struct {
Id string
DesignId string
Name string
Description string
Creator string
BpmnXml string
SvgXml string
CreatedAt int64
}
Release is a release of smart-service-repository with the BPMN of its design.
type Report ¶
type Report struct {
Items []Item `json:"items"`
}
func Run ¶
Run migrates step by step; a step that cannot read its source fails as a whole, the next steps run nevertheless.
type Rights ¶
type Rights interface {
Rights(ctx context.Context, topic string, id string) (permmodel.ResourcePermissions, bool, error)
SetRights(ctx context.Context, topic string, id string, permissions permmodel.ResourcePermissions) error
}
Rights reads and writes resources of permissions-v2 as admin.
type SmartServiceInstance ¶
type SmartServiceInstance struct {
Id string
UserId string
ReleaseId string
Name string
Description string
Parameters []Parameter
Ready bool
Error string
CreatedAt int64
UpdatedAt int64
}
SmartServiceInstance is an instance of smart-service-repository; ready means its setup process ended in Camunda.
type Sources ¶
type Sources interface {
Designs(ctx context.Context) ([]Design, error)
Releases(ctx context.Context) ([]Release, error)
SmartServiceInstances(ctx context.Context) ([]SmartServiceInstance, error)
Modules(ctx context.Context) ([]Module, error)
SmartServiceVariables(ctx context.Context) ([]InstanceVariable, error)
FogDeployments(ctx context.Context) ([]FogDeployment, error)
FogStarts(ctx context.Context) ([]FogStart, error)
ProcessModels(ctx context.Context) ([]ProcessModel, error)
ProcessDeployments(ctx context.Context) ([]ProcessDeployment, error)
Schedules(ctx context.Context) ([]Schedule, error)
IoValues(ctx context.Context) ([]IoValue, error)
// the Camunda engines of the processes namespace, all shards
CamundaDeployments(ctx context.Context) ([]CamundaDeployment, error)
RunningInstances(ctx context.Context, d CamundaDeployment) ([]CamundaInstance, error)
// rights in permissions-v2
Rights(ctx context.Context, topic string, id string) (permmodel.ResourcePermissions, bool, error)
}
Sources are the databases of the old services.
type Target ¶
type Target struct {
Store *store.Store
Engine *engine.Engine
Controller *controller.Controller
Namespaces Namespaces
// an admin token, fetched per call since a migration may outlast a token
AdminToken func() (string, error)
// nil leaves rights alone, e.g. without permissions-v2
Rights Rights
}
Target is the engine the data goes into. Writes go through the controller with an admin token, so that deployments are activated and instances started as by the API; resources the API creates with new ids (models, schedules, IO values) go into the store with their ids.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package legacyio takes the values of process-io-worker on a gateway into the engine once, when the process module is updated and the old Postgres volume is still there (MIG-06).
|
Package legacyio takes the values of process-io-worker on a gateway into the engine once, when the process module is updated and the old Postgres volume is still there (MIG-06). |
|
Package rewrite turns models written for Camunda 7 into the model format of this engine (MIG-04): JUEL becomes JavaScript, Groovy logging becomes log, external task topics become task types, the http-connector becomes a notification or an HTTP call, and message names with expressions become senergy:messageName.
|
Package rewrite turns models written for Camunda 7 into the model format of this engine (MIG-04): JUEL becomes JavaScript, Groovy logging becomes log, external task topics become task types, the http-connector becomes a notification or an HTTP call, and message names with expressions become senergy:messageName. |