LoginSignup
6
1

[UiPath] オンプレ版Orchestratorのデータベースを別サーバーに移行する手順

Last updated at Posted at 2023-06-28

前提

使用した環境 バージョン 
IIS Windows Server 2019 Standard Edition
SQLServer Windows Server 2012 Standard Edition / SQL Server 2016 Standard Edition(64-bit)
Orchestrator 2020.10.11

イントロ

  • 今回想定するのは、例えば下記のようなケースです。本記事では、このうち4.の手順を説明します。
    1. 開発環境に新規でIISサーバ1とSQLサーバ2を構築する。
    2. 構築したIISサーバに、Orchestratorを新規インストールする。
    3. 開発環境のIISサーバを、本番昇格させる。3
    4. 本番に上がった新IISサーバに、現行のDB4を繋げる。←ここを説明します。
  • これを試すまで、OCに出自の異なる(別のインストーラーで作られた)DBを繋げるってできるのかな?と思ってましたが、できました。
  • やることは、おおまかにいうと下記の3つです。
    1. OCの設定ファイルから、繋ぎ先のDBを変更する。
    2. DBのOAuth関連のテーブルを修正し、RedirectUriを新IISサーバのURLに合わせる。
    3. OCの設定ファイルに書かれたOAuthのClientIdを、現行DBで設定された値に合わせる。

関連するドキュメント

手順

OCの設定ファイルから、繋ぎ先のDBを変更する。

1. IISを停止する。

2. UiPath.Orchestrator.dll.config (C:\Program Files (x86)\UiPath\Orchestrator) を修正する。ConnectionString(SQL database 名や SQL ホスト名)を移行先データベースサーバのものに修正。

<connectionStrings>
<add name="Default" providerName="System.Data.SqlClient" connectionString="Data Source=DatabaseServerName;Initial Catalog=UiPath;User ID=********;Password=******" />
</connectionStrings>

"DatabaseServerName"は、IPアドレスでも可。(RDSの場合、エンドポイントを記述する。)

3. appsettings.Production.json(C:\Program Files (x86)\UiPath\Orchestrator\Identity)を修正する。同じく、ConnectionStringを移行先データベースサーバのものに修正。

4. appsettings.Production.json(C:\Program Files (x86)\UiPath\Orchestrator\Webhooks)を修正する。同じく、ConnectionStringを移行先データベースサーバのものに修正。

DBのRedirectUriを、新IISサーバのURLに合わせる。

5. SSMSでidentity.ClientRedirectUris テーブルを開き、https://[OldOrchestratorAddress]/signinsystemopenidconnect の値を持つ [RedirectUri] フィールドを探す。
⇒デフォルトだと、Id=2,5の2件。(Id=2は「http://」なので、手順的には変えなくてもいいのかもしれませんが、今回は変えました。)
image.png

6. 下記のクエリを実行し、https://[NewOrchestratorAddress]/signinsystemopenidconnect に変更する。

UPDATE [UiPath].[identity].[ClientRedirectUris] SET RedirectUri = 'http://[NewOrchestratorAddress]/signinsystemopenidconnect' WHERE Id = 2;
UPDATE [UiPath].[identity].[ClientRedirectUris] SET RedirectUri = 'https://[NewOrchestratorAddress]/signinsystemopenidconnect' WHERE Id = 5;

7. 値が正しく書き換わっていることを確認する。
image.png

8. identity.ClientPostLogoutRedirectUris テーブルを開き、https://[OldOrchestratorAddress]/ の値を持つ [PostLogoutRedirectUri] フィールドを探す。
⇒デフォルトだと、Id=3,4,5,8の4件。(Id=5は「http://」なので、手順的には変えなくてもいいのかもしれませんが、今回は変えました。)
image.png

9. 下記のクエリを実行し、https://[NewOrchestratorAddress]/ に変更する。

UPDATE [UiPath].[identity].[ClientPostLogoutRedirectUris] SET PostLogoutRedirectUri = 'https://[NewOrchestratorAddress]' WHERE Id = 3;
UPDATE [UiPath].[identity].[ClientPostLogoutRedirectUris] SET PostLogoutRedirectUri = 'https://[NewOrchestratorAddress]/' WHERE Id = 4;
UPDATE [UiPath].[identity].[ClientPostLogoutRedirectUris] SET PostLogoutRedirectUri = 'http://[NewOrchestratorAddress]/' WHERE Id = 5;
UPDATE [UiPath].[identity].[ClientPostLogoutRedirectUris] SET PostLogoutRedirectUri = 'https://[NewOrchestratorAddress]/account/login' WHERE Id = 8;

10. 値が正しく書き換わっていることを確認する。
image.png

OAuthのClientIdを、現行DBで設定された値に合わせる。

ポイント
OCに出自の異なる(別のインストーラーで作られた)DBを繋げる場合、この手順が必要です。

11. identity.Clients テーブルを開き、ClientName = "Orchestrator.OpenId"のClientIdを確認する。
image.png

12. UiPath.Orchestrator.dll.config (C:\Program Files (x86)\UiPath\Orchestrator) を修正する。"ExternalAuth.System.OpenIdConnect.ClientId"で検索し、valueを11で確認したClientIdに修正する。

13. IISを起動する。

トラブルシューティング

  • dll.config上のClientIdと、DB上のClientIdが一致していないと、下記のエラーが発生します。

{"Error":"unauthorized_client", "ErrorDescription":"Unknown client or client not enabled", "RequestId":"xxxxxxxxxx", "ClientId":"xxxxxxxxxx"}

image.png

  1. 今回はAWS EC2上に構築。

  2. 同じくAWS EC2。

  3. EC2なのでAMIから複製しました。

  4. 今回はAWS RDSで試しました。EC2上のデータベースをRDSに移行する手順はまた後日まとめます・・・。

6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1