斯潘8
span4
在本教程的前5部分中,we look at different stages a 亚搏在线workflow can go through and how changes (Updates & Deletes) can be deployed,migrated & rolled back on a staging (FME Server STG) 和一部作品(FME Server PROD)服务器。Now that we understand the basic functionality and capabilities of Project in FME Server we are ready to automate our Deployment to not only keep our 2 Servers in sync and reduce risk but also to save time and minimize manual interaction.
为此,让我们创建一个工作区(请下载:自动部署.fmw) that uses theFME服务器REST APIto carry out all the tasks that we completed in this tutorial so far in one single job:
To be able to use the REST API of FME Server we need to authenticate to FME Server to make sure we are authorized to use the REST API.We can generate a token for this purpose.请注意,对于具有fmesuperuser角色的用户,我们需要令牌才能使用migration rest api。Make sure to check out the FME Serversecurity documentationfor more details.在附加的工作区中,the base URLs of the 2 FME Server installations and the tokens are specified via published parameters.This way we only need to specify them once to call several different REST API calls in one workspace.Another published parameter will be used to specify the name of the project which is a parameter that is needed in all REST API calls used in this example.The last published parameter holds the location for the backups.
We can use the HTTPCaller to make FME Server REST API calls.There are 3 essential REST endpoints that are used in this workspace.Let's start with exporting our project:
/fmerest/v3/migration/backup/download
To download a project we use the migration endpoint.To only download a specific project from FME Server and not an entire FME Server project we need to make sure that we specify the project name as a form parameter.Check out the HTTPCaller transformers in for exporting fromFME Server STG&FME Server PRODin the attached workspace and make sure to check outREST API documentation更多详情。The downloaded projects can then be written to a designated location for backups of the staging & production environment with an AttributeFileWriter.To create a history of backups the @DateTimeNow() function can be used a prefix to the file names to add a unique timestamp to all backups.
/fmerest/v3/projects/projects/$(projectName)/deleteall
Before we upload/deploy our project to the production server we need to delete the existing project to make that changes that include deletions in the project will be respected.For more details on this REST endpoint check outthe documentationand the HTTPCaller deleting the project in the attached workspace.
/fmerest/v3/migration/restore/upload?importMode=INSERT&pauseNotifications=false
现在我们可以上载/部署从中导出的项目FME Server STGearlier toFME Server PROD.For this task,we will again use the migration REST API to upload the project to our production environment.一定要检查REST API documentation并将其与httpcaller中的设置进行比较,以熟悉在工作区中使用fmeserver的rest api的概念。
To capture all information if anything goes wrong and a couple of Loggers can be added.A Terminator can also help to stop a workspace at a certain point if we already know something went wrong.
The provided workspace is an example to showcase some ideas for automating deployments following the concepts we examined in this Tutorial using FME Server Projects.There are a lot of things and functionality provided by FME that can be added to this,所以请以这个例子为出发点来探索可能性。
© 2019 亚搏在线Safe Software Inc |Legal