你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

快速入门:更新 Azure 托管 CCF 资源上的 JavaScript 执行引擎的运行时选项

有时需要更新 CCF JavaScript 解释器的运行时选项,以延长请求执行持续时间或更新堆或堆栈分配大小。 本操作指南介绍如何更新运行时设置。 本教程基于快速入门中创建的 Azure 托管 CCF(托管 CCF)资源:使用 Azure 门户 教程创建 Azure 托管 CCF 资源。

先决条件

下载服务标识

Azure 托管 CCF 资源具有称为服务标识的唯一标识。 它由证书表示,并在资源创建期间创建。 属于 Azure 托管 CCF 资源的每个单独节点都有其自签名证书,由服务标识认可,该证书可对其建立信任。

建议客户下载服务标识证书,并在与服务交互时使用它建立 TLS 连接。 以下命令下载证书并将其保存到 service_cert.pem 中。

curl https://identity.confidential-ledger.core.azure.com/ledgerIdentity/confidentialbillingapp --silent | jq ' .ledgerTlsCertificate' | xargs echo -e > service_cert.pem

更新运行时选项

注意

在 Mac 上执行命令时,请替换为 date -Is date +%FT%T%z

  1. 准备 set_js_runtime_options.json 文件,并使用以下命令提交该文件:
    $ cat set_js_runtime_options.json
    {
      "actions": [
        {
          "name": "set_js_runtime_options",
          "args": {
            "max_heap_bytes": 1024,
            "max_stack_bytes": 1024,
            "max_execution_time_ms": 5000, // increase the request execution time
            "log_exception_details": false,
            "return_exception_details": false
          }
        }
      ]
    }
    
    $ proposal_id=$( (ccf_cose_sign1 --content set_js_runtime_options.json --signing-cert member0_cert.pem --signing-key member0_privk.pem --ccf-gov-msg-type proposal --ccf-gov-msg-created_at `date -Is` | curl https://confidentialbillingapp.confidential-ledger.azure.com/gov/proposals -H 'Content-Type: application/cose' --data-binary @- --cacert service_cert.pem | jq -r ‘.proposal_id’) )
    
  2. 下一步是通过提交投票来接受该提案。
    cat vote_accept.json
    {
      "ballot": "export function vote (proposal, proposerId) { return true }"
    }
    
    ccf_cose_sign1 --content vote_accept.json --signing-cert member0_cert.pem --signing-key member0_privk.pem --ccf-gov-msg-type ballot --ccf-gov-msg-created_at `date -Is` --ccf-gov-msg-proposal_id $proposal_id | curl https://confidentialbillingapp.confidential-ledger.azure.com/gov/proposals/$proposal_id/ballots -H 'Content-Type: application/cose' --data-binary @- --cacert service_cert.pem
    
  3. 对托管 CCF 资源中的每个成员重复上述步骤。
  4. 接受该建议后,运行时选项将应用于后续请求。

后续步骤