本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
将服务管理的队列连接到自定义许可证服务器
您可以自带许可证服务器与 Deadline Cloud 服务管理的队列一起使用。要自带许可证,您可以使用农场中的队列环境配置许可证服务器。要配置许可证服务器,您应该已经设置了农场和队列。
Service-managed 舰队工作人员在您的 VPC 外部 AWS 管理的基础设施中运行,因此他们通过以下三种方式之一到达许可证服务器:
-
通过 VPC 资源终端节点。工作人员使用私有域名通过 VPC Lattice 连接到您的 VPC 中的许可证服务器,无需队列环境或端口转发。有关设置步骤,请参阅使用 VPC 资源终端节点将 VPC 资源连接到您的 SMF。将应用程序的许可证环境变量设置为资源端点的域名,方法与中的服务器地址相同第 3 步:将渲染应用程序连接到端点。
-
通过亚马逊 EC2 系统管理器 (SSM) 端口转发。队列环境将许可证端口从每个工作人员转发到您账户中托管许可证服务器或代理流量的 Amazon EC2 实例。本页的其余部分涵盖了此选项。
-
直接通过互联网。您的员工使用互联网从软件供应商的许可证服务器获得许可证。
使用资源终端节点和端口转发选项,许可证服务器不必与资源网关或代理实例位于同一 VPC 或账户中。网关或代理只需要通过网络访问服务器,例如通过 VPC 对等、中转网关或 VPN 连接。
按照以下说明,您可以使用 SSM 将端口从工作实例转发到许可证服务器或代理实例。在此示例中,如果您的许可证服务器无法提供许可证,则使用基于Deadline Cloud使用量的许可作为备用许可。移除不适用于您的管道或在用尽许可证后不想使用基于使用量许可的产品的部分。
步骤 1:配置队列环境
您可以在队列中配置队列环境以访问许可证服务器。首先,确保使用以下方法之一配置了具有许可证服务器访问权限的 AWS 实例:
-
许可证服务器-该实例直接托管许可证服务器。
-
许可证代理-该实例具有对许可证服务器的网络访问权限,并将许可证服务器端口转发到许可证服务器。有关如何配置许可证代理实例的详细信息,请参阅步骤 2:(可选)许可证代理实例设置。
有关配置许可证环境变量的信息,请参阅第 3 步:将渲染应用程序连接到端点。对于自定义许可证服务器设置,许可证服务器地址仍为本地主机,而不是 Amazon VPC 终端节点。
向队列角色添加所需权限
-
在 De adline Cloud 控制台
中,选择 “转到控制面板” 。 -
在仪表板中,选择农场,然后选择要配置的队列。
-
从队列详情 > 服务角色中,选择角色。
-
选择 “添加权限”,然后选择 “创建内联策略” 。
-
选择 JSON 策略编辑器,然后将以下文本复制并粘贴到编辑器中。
-
在保存新策略之前,替换策略文本中的以下值:
-
region替换为您的农场所在的 AWS 区域 -
instance_id替换为你正在使用的许可证服务器或代理实例的实例 ID -
account_id替换为包含您的农场的 AWS 账号
-
-
选择下一步。
-
对于策略名称,请输入
LicenseForwarding。 -
选择创建策略以保存您的更改并创建具有所需权限的策略。
向队列添加新的队列环境
-
如果您还没有,请在 Deadl
ine Cloud 控制台中选择 “转到控制面板”。 -
在仪表板中,选择农场,然后选择要配置的队列。
-
选择队列环境 > 操作 > 使用 YAML 新建。
-
将以下文本复制并粘贴到 YAML 脚本编辑器中。
-
在保存队列环境之前,请根据需要对环境文本进行以下更改:
-
更新以下参数的默认值以反映您的环境:
-
LicenseInstanceID — 您的许可证服务器或代理实例的 Amazon EC2 实例 ID
-
LicenseInstanceRegion— 包含您的农场 AWS 的地区
-
LicensePorts— 要转发到许可证服务器或代理实例的以逗号分隔的端口列表(例如 2700,2701)
-
-
如果您想在自带许可证 (BYOL) 用尽后使用基于使用量的许可 (UBL),请确保许可证服务器的端口是正确的。如果在 BYOL 用完后不想使用 UBL,请将所有必需的许可环境变量添加到变量部分。
这些变量应将 DCC 定向到许可证服务器端口上的本地主机。例如,如果您的 Foundry 许可证服务器正在监听端口 6101,则应将变量添加为
foundry_LICENSE: 6101@localhost。
-
-
(可选)您可以将 Pri or ity 设置为 0,也可以将其更改为在多个队列环境中以不同的优先级排序。
-
选择 “创建队列环境” 以保存新环境。
设置队列环境后,提交到该队列的作业将从配置的许可证服务器检索许可证。
步骤 2:(可选)许可证代理实例设置
除了使用许可证服务器之外,您还可以使用许可证代理。要创建许可证代理,请创建一个可通过网络访问许可证服务器的新的 Amazon Linux 2023 实例。如果需要,您可以使用 VPN 连接配置此访问权限。有关更多信息,请参阅 Amazon VPC 用户指南中的 VPN 连接。
要为 Deadline Cloud 设置许可证代理实例,请按照此过程中的步骤进行操作。在此新实例上执行以下配置步骤,以启用将许可证流量转发到您的许可证服务器
-
要安装 HAProxy 软件包,请输入
sudo yum install haproxy -
使用以下内容更新/etc/haproxy/haproxy.cfg 配置文件中的监听许可证服务器部分:
-
将 LicensePort 1 和 LicensePort 2 替换为要转发到许可证服务器的端口号。添加或删除以逗号分隔的值以容纳所需数量的端口。
-
LicenseServerHost替换为许可证服务器的主机名或 IP 地址。
global log 127.0.0.1 local2 chroot /var/lib/haproxy user haproxy group haproxy daemon defaults timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout http-keep-alive 10s timeout check 10s listen license-server bind *:LicensePort1,*:LicensePort2server license-serverLicenseServerHost -
-
要启用和启动 HAProxy 服务,请运行以下命令:
sudo systemctl enable haproxysudo service haproxy start
完成这些步骤后,应将从转发队列环境发送到本地主机的许可证请求转发到指定的许可证服务器。
步骤 3: CloudFormation 模板设置
您可以使用 CloudFormation 模板将整个农场配置为使用您自己的许可。
-
修改下一步中提供的模板,将所有必需的许可环境变量添加到下方的变量部分BYOLQueueEnvironment。
-
使用以下 CloudFormation 模板。
AWSTemplateFormatVersion: 2010-09-09 Description: "Create Deadline Cloud resources for BYOL" Parameters: LicenseInstanceId: Type: AWS::EC2::Instance::Id Description: Instance ID for the license server/proxy instance LicensePorts: Type: String Description: Comma-separated list of ports to forward to the license instance Resources: JobAttachmentBucket: Type: AWS::S3::Bucket Properties: BucketName: !Sub byol-example-ja-bucket-${AWS::AccountId}-${AWS::Region} BucketEncryption: ServerSideEncryptionConfiguration: - ServerSideEncryptionByDefault: SSEAlgorithm: AES256 Farm: Type: AWS::Deadline::Farm Properties: DisplayName: BYOLFarm QueuePolicy: Type: AWS::IAM::ManagedPolicy Properties: ManagedPolicyName: BYOLQueuePolicy PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Action: - s3:GetObject - s3:PutObject - s3:ListBucket - s3:GetBucketLocation Resource: - !Sub ${JobAttachmentBucket.Arn} - !Sub ${JobAttachmentBucket.Arn}/job-attachments/* Condition: StringEquals: aws:ResourceAccount: !Sub ${AWS::AccountId} - Effect: Allow Action: logs:GetLogEvents Resource: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/deadline/${Farm.FarmId}/* - Effect: Allow Action: - s3:ListBucket - s3:GetObject Resource: - "*" Condition: ArnLike: s3:DataAccessPointArn: - arn:aws:s3:*:*:accesspoint/deadline-software-* StringEquals: s3:AccessPointNetworkOrigin: VPC BYOLSSMPolicy: Type: AWS::IAM::ManagedPolicy Properties: ManagedPolicyName: BYOLSSMPolicy PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Action: - ssm:StartSession Resource: - !Sub arn:aws:ssm:${AWS::Region}::document/AWS-StartPortForwardingSession - !Sub arn:aws:ec2:${AWS::Region}:${AWS::AccountId}:instance/${LicenseInstanceId} WorkerPolicy: Type: AWS::IAM::ManagedPolicy Properties: ManagedPolicyName: BYOLWorkerPolicy PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Action: - logs:CreateLogStream Resource: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/deadline/${Farm.FarmId}/* Condition: ForAnyValue:StringEquals: aws:CalledVia: - deadline.amazonaws.com - Effect: Allow Action: - logs:PutLogEvents - logs:GetLogEvents Resource: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/deadline/${Farm.FarmId}/* QueueRole: Type: AWS::IAM::Role Properties: RoleName: BYOLQueueRole ManagedPolicyArns: - !Ref QueuePolicy - !Ref BYOLSSMPolicy AssumeRolePolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Action: - sts:AssumeRole Principal: Service: - credentials.deadline.amazonaws.com - deadline.amazonaws.com Condition: StringEquals: aws:SourceAccount: !Sub ${AWS::AccountId} ArnEquals: aws:SourceArn: !Ref Farm WorkerRole: Type: AWS::IAM::Role Properties: RoleName: BYOLWorkerRole ManagedPolicyArns: - arn:aws:iam::aws:policy/AWSDeadlineCloud-FleetWorker - !Ref WorkerPolicy AssumeRolePolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Action: - sts:AssumeRole Principal: Service: credentials.deadline.amazonaws.com Queue: Type: AWS::Deadline::Queue Properties: DisplayName: BYOLQueue FarmId: !GetAtt Farm.FarmId RoleArn: !GetAtt QueueRole.Arn JobRunAsUser: Posix: Group: "" User: "" RunAs: WORKER_AGENT_USER JobAttachmentSettings: RootPrefix: job-attachments S3BucketName: !Ref JobAttachmentBucket Fleet: Type: AWS::Deadline::Fleet Properties: DisplayName: BYOLFleet FarmId: !GetAtt Farm.FarmId MinWorkerCount: 1 MaxWorkerCount: 2 Configuration: ServiceManagedEc2: InstanceCapabilities: VCpuCount: Min: 4 Max: 16 MemoryMiB: Min: 4096 Max: 16384 OsFamily: LINUX CpuArchitectureType: x86_64 InstanceMarketOptions: Type: on-demand RoleArn: !GetAtt WorkerRole.Arn QFA: Type: AWS::Deadline::QueueFleetAssociation Properties: FarmId: !GetAtt Farm.FarmId FleetId: !GetAtt Fleet.FleetId QueueId: !GetAtt Queue.QueueId CondaQueueEnvironment: Type: AWS::Deadline::QueueEnvironment Properties: FarmId: !GetAtt Farm.FarmId Priority: 5 QueueId: !GetAtt Queue.QueueId TemplateType: YAML Template: | specificationVersion: 'environment-2023-09' parameterDefinitions: - name: CondaPackages type: STRING description: > This is a space-separated list of conda package match specifications to install for the job. E.g. "blender=3.6" for a job that renders frames in Blender 3.6. See https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/pkg-specs.html#package-match-specifications default: "" userInterface: control: LINE_EDIT label: Conda Packages - name: CondaChannels type: STRING description: > This is a space-separated list of conda channels from which to install packages. Deadline Cloud SMF packages are installed from the "deadline-cloud" channel that is configured by Deadline Cloud. Add "conda-forge" to get packages from the https://conda-forge.org/ community, and "defaults" to get packages from Anaconda Inc (make sure your usage complies with https://www.anaconda.com/terms-of-use). default: "deadline-cloud" userInterface: control: LINE_EDIT label: Conda Channels environment: name: Conda script: actions: onEnter: command: "conda-queue-env-enter" args: ["{{Session.WorkingDirectory}}/.env", "--packages", "{{Param.CondaPackages}}", "--channels", "{{Param.CondaChannels}}"] onExit: command: "conda-queue-env-exit" BYOLQueueEnvironment: Type: AWS::Deadline::QueueEnvironment Properties: FarmId: !GetAtt Farm.FarmId Priority: 10 QueueId: !GetAtt Queue.QueueId TemplateType: YAML Template: | specificationVersion: "environment-2023-09" parameterDefinitions: - name: LicenseInstanceId type: STRING description: > The Instance ID of the license server/proxy instance default: "" - name: LicenseInstanceRegion type: STRING description: > The region containing this farm default: "" - name: LicensePorts type: STRING description: > Comma-separated list of ports to be forwarded to the license server/proxy instance. Example: "2701,2702,7075,2703,6101,1715,1716,1717,7054,7055,30304" default: "2701,2702,7075,2703,6101,1715,1716,1717,7054,7055,30304" environment: name: BYOL License Forwarding variables: example_LICENSE: 2701@localhost script: actions: onEnter: command: bash args: [ "{{Env.File.Enter}}" ] onExit: command: bash args: [ "{{Env.File.Exit}}" ] embeddedFiles: - name: Enter type: TEXT runnable: True data: | curl https://s3.amazonaws.com/session-manager-downloads/plugin/latest/linux_64bit/session-manager-plugin.rpm -Ls | rpm2cpio - | cpio -iv --to-stdout ./usr/local/sessionmanagerplugin/bin/session-manager-plugin > {{Session.WorkingDirectory}}/session-manager-plugin chmod +x {{Session.WorkingDirectory}}/session-manager-plugin conda activate python {{Env.File.StartSession}} {{Session.WorkingDirectory}}/session-manager-plugin - name: Exit type: TEXT runnable: True data: | echo Killing SSM Manager Plugin PIDs: $BYOL_SSM_PIDS for pid in ${BYOL_SSM_PIDS//,/ }; do kill $pid; done - name: StartSession type: TEXT data: | import boto3 import json import subprocess import sys import os import tempfile instance_id = "{{Param.LicenseInstanceId}}" region = "{{Param.LicenseInstanceRegion}}" license_ports_list = "{{Param.LicensePorts}}".split(",") ssm_client = boto3.client("ssm", region_name=region) pids = [] for port in license_ports_list: session_response = ssm_client.start_session( Target=instance_id, DocumentName="AWS-StartPortForwardingSession", Parameters={"portNumber": [port], "localPortNumber": [port]} ) cmd = [ sys.argv[1], json.dumps(session_response), region, "StartSession", "", json.dumps({"Target": instance_id}), f"https://ssm.{region}.amazonaws.com" ] process = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) pids.append(process.pid) print(f"SSM Port Forwarding Session started for port {port}") print(f"openjd_env: BYOL_SSM_PIDS={','.join(str(pid) for pid in pids)}") # Enabling UBL after the "bring your own license" (BYOL) has run out requires prepending the BYOL configuration to the existing license setup # Remove the sections that do not apply to your pipeline, or you do not want to use UBL after exhausting the BYOL licenses. # The port numbers used may not match what your license server is serving. # Arnold os.environ["ADSKFLEX_LICENSE_FILE"] = f"2701@localhost:{os.environ.get('ADSKFLEX_LICENSE_FILE', '')}" print(f"openjd_env: ADSKFLEX_LICENSE_FILE={os.environ['ADSKFLEX_LICENSE_FILE']}") # Nuke os.environ["foundry_LICENSE"] = f"6101@localhost:{os.environ.get('foundry_LICENSE', '')}" print(f"openjd_env: foundry_LICENSE={os.environ['foundry_LICENSE']}") # SideFX os.environ["SESI_LMHOST"] = f"localhost:1715;{os.environ.get('SESI_LMHOST', '')}" print(f"openjd_env: SESI_LMHOST={os.environ['SESI_LMHOST']}") # Redshift and Red Giant os.environ["redshift_LICENSE"] = f"7054@localhost:7055@localhost:{os.environ.get('redshift_LICENSE', '')}" print(f"openjd_env: redshift_LICENSE={os.environ['redshift_LICENSE']}") # V-Ray doesn't support multiple license servers in a single environment variable # See https://documentation.chaos.com/space/LIC5/125050770/Sharing+a+License+Configuration+in+a+Network vray_license = os.environ.get('VRAY_AUTH_CLIENT_SETTINGS', '') xml_content = """<VRLClient> <LicServer> <Host>localhost</Host> <Port>30304</Port>""" if vray_license and vray_license.startswith('licset://'): server_parts = vray_license.removeprefix('licset://').split(':') if len(server_parts) >= 2: xml_content += f""" <Host1>{server_parts[0]}</Host1> <Port1>{server_parts[1]}</Port1>""" xml_content += """ <User></User> <Pass></Pass> </LicServer> </VRLClient>""" temp_dir = tempfile.gettempdir() xml_path = os.path.join(temp_dir, 'vrlclient.xml') with open(xml_path, 'w') as f: f.write(xml_content) os.environ["VRAY_AUTH_CLIENT_FILE_PATH"] = temp_dir print(f"openjd_env: VRAY_AUTH_CLIENT_FILE_PATH={os.environ['VRAY_AUTH_CLIENT_FILE_PATH']}") # Clear the existing VRAY_AUTH_CLIENT_SETTINGS so only the vrlclient.xml file is used. os.environ["VRAY_AUTH_CLIENT_SETTINGS"] = '' print(f"openjd_env: VRAY_AUTH_CLIENT_SETTINGS={os.environ['VRAY_AUTH_CLIENT_SETTINGS']}") # Print out the created xml file's contents print(f"V-Ray configuration file: {xml_path}") with open(xml_path, 'r') as f: print(f"{f.read()}") -
部署 CloudFormation 模板时,请提供以下参数:
-
使用您的许可证服务器或代理实例的 Amazon EC2 实例 ID 更新 ID LicenseInstance
-
LicensePorts使用以逗号分隔的要转发到许可证服务器或代理实例的端口列表进行更新(例如 2700,2701)
-
通过在模板
example_LICENSE: 2700@localhost中替换来添加许可证环境变量
-
-
部署模板以使用自带许可证功能来设置您的农场。