安裝指南
此 Site-Wide Analysis Tool 提供7天24小時的即時效能監控、報告和建議,以確保Adobe Commerce在雲端基礎結構安裝上的安全性和可操作性。 此外,也提供可用和已安裝修補程式、協力廠商擴充功能及Adobe Commerce安裝的詳細資訊。
如果您有內部部署的Adobe Commerce,請在您的基礎結構上安裝代理程式以使用此工具。 您不需要在雲端基礎結構專案上安裝Adobe Commerce代理程式。
代理程式
此 Site-Wide Analysis Tool 代理程式可讓您使用 Site-Wide Analysis Tool 用於Adobe Commerce的內部安裝。
此 Site-Wide Analysis Tool 代理程式會收集應用程式和業務資料、分析這些資料,並提供有關您安裝狀況的額外深入分析,以便您改善客戶體驗。 它可以監視您的應用程式,並協助您識別效能、安全性、可用性以及應用程式問題。
安裝代理程式需要下列步驟:
-
驗證系統需求。
-
在中設定API金鑰 Commerce Services Connector 副檔名。
-
安裝代理程式
-
執行代理程式
系統需求
安裝代理程式之前,您的內部部署基礎結構必須符合下列需求:
-
作業系統
- Linux x86-64 分配,例如 Red Hat® Enterprise Linux (RHEL), CentOS, Ubuntu, Debian,和類似專案
note important IMPORTANT Adobe Commerce不受支援 Microsoft Windows 或 macOS. -
Adobe Commerce 2.4.5-p1或更新版本(因為依賴Service Connector)
-
Commerce Services Connector extension
-
PHP CLI
-
Bash/殼層公用程式
-
php
-
wget
-
awk
-
nice
-
grep
-
openssl
-
Commerce Services Connector
代理程式需要 Commerce Services Connector 擴充功能將安裝在您的系統和 已設定 使用API金鑰。 若要驗證是否已安裝擴充功能,請執行以下命令:
bin/magento module:status Magento_ServicesId
如果您已安裝擴充功能,並使用不同服務的現有API金鑰進行設定,則 必須重新產生API金鑰 並在代理程式的Adobe Commerce管理員中更新。
-
將您的網站放入 維護模式.
-
note note NOTE 如果您無法存取帳戶,請參閱 無法登入Adobe Commerce支援或雲端帳戶 以取得疑難排解說明。 -
按一下 API Portal.
-
按一下 Delete 位於現有API金鑰旁。
-
設定 新的API金鑰。
如果未安裝擴充功能,請依照下列指示進行安裝:
-
將擴充功能新增至
composer.json
檔案並安裝。code language-bash composer require magento/services-id
-
啟用擴充功能。
code language-bash bin/magento module:enable Magento_ServicesId
-
更新資料庫結構。
code language-bash bin/magento setup:upgrade
-
清除快取。
code language-bash bin/magento cache:clean
-
設定API金鑰 將擴充功能連線至您的系統。
安裝代理程式
我們已建立 殼層指令碼 以簡化安裝。 我們建議您使用Shell指令碼,但您可以遵循 手動安裝 方法(如有需要)。
指令碼
-
下載並執行殼層指令碼。
code language-bash bash -c "$(wget -qO - https://raw.githubusercontent.com/magento-swat/install-agent-helpers/main/install.sh)"
note tip TIP 我們建議您在根Adobe Commerce專案目錄外部安裝代理程式。 -
驗證安裝。
code language-bash ./scheduler -v
code language-bash Version: 1.0.1 Success exit.
-
下載並安裝代理程式之後, 將其設定為執行 使用下列其中一種方法:
手動 manual
如果您不想使用我們的 殼層指令碼 若要安裝代理程式,您必須依照下列步驟手動安裝:
-
建立您要下載代理程式的目錄。
note tip TIP 我們建議您在根Adobe Commerce專案目錄外部安裝代理程式。 -
下載二進位檔案並將其解壓縮。
note info INFO 若要使用 Site-Wide Analysis Tool,您必須先閱讀並接受您從Adobe Commerce管理員存取控制面板時顯示的使用條款。 對於 AMD64 架構:
-
下載啟動器封存。
code language-bash curl -O https://updater.supportinsights.adobe.com/launcher/launcher.linux-amd64.tar.gz
-
將啟動器封存解壓縮。
code language-bash tar -xf launcher.linux-amd64.tar.gz
對於 ARM64 架構:
-
下載啟動器封存。
code language-bash curl -O https://updater.supportinsights.adobe.com/launcher/launcher.linux-arm64.tar.gz
-
將啟動器封存解壓縮。
code language-bash tar -xf launcher.linux-arm64.tar.gz
-
-
(可選) 驗證總和檢查碼的簽章。
code language-bash echo -n "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQ0lqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FnOEFNSUlDQ2dLQ0FnRUE0M2FBTk1WRXR3eEZBdTd4TE91dQpacG5FTk9pV3Y2aXpLS29HendGRitMTzZXNEpOR3lRS1Jha0MxTXRsU283VnFPWnhUbHZSSFhQZWt6TG5vSHVHCmdmNEZKa3RPUEE2S3d6cjF4WFZ3RVg4MEFYU1JNYTFadzdyOThhenh0ZHdURVh3bU9GUXdDcjYramFOM3ErbUoKbkRlUWYzMThsclk0NVJxWHV1R294QzBhbWVoakRnTGxJUSs1d1kxR1NtRGRiaDFJOWZqMENVNkNzaFpsOXFtdgorelhjWGh4dlhmTUU4MUZsVUN1elRydHJFb1Bsc3dtVHN3ODNVY1lGNTFUak8zWWVlRno3RFRhRUhMUVVhUlBKClJtVzdxWE9kTGdRdGxIV0t3V2ppMFlrM0d0Ylc3NVBMQ2pGdEQzNytkVDFpTEtzYjFyR0VUYm42V3I0Nno4Z24KY1Q4cVFhS3pYRThoWjJPSDhSWjN1aFVpRHhZQUszdmdsYXJSdUFacmVYMVE2ZHdwYW9ZcERKa29XOXNjNXlkWApBTkJsYnBjVXhiYkpaWThLS0lRSURnTFdOckw3SVNxK2FnYlRXektFZEl0Ni9EZm1YUnJlUmlMbDlQMldvOFRyCnFxaHNHRlZoRHZlMFN6MjYyOU55amgwelloSmRUWXRpdldxbGl6VTdWbXBob1NrVnNqTGtwQXBiUUNtVm9vNkgKakJmdU1sY1JPeWI4TXJCMXZTNDJRU1MrNktkMytwR3JyVnh0akNWaWwyekhSSTRMRGwrVzUwR1B6LzFkeEw2TgprZktZWjVhNUdCZm00aUNlaWVNa3lBT2lKTkxNa1cvcTdwM200ejdUQjJnbWtldm1aU3Z5MnVMNGJLYlRoYXRlCm9sdlpFd253WWRxaktkcVkrOVM1UlNVQ0F3RUFBUT09Ci0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQ==" | base64 -d > release.pub
code language-bash openssl dgst -sha256 -verify release.pub -signature launcher.sha256 launcher.checksum
-
(可選) 驗證總和檢查碼。
code language-bash shasum -a 512 -c launcher.checksum
-
建立
config.yaml
檔案包含下列內容。code language-yaml project: appname: "Acme Inc" # Company or site name that you provided when installing the agent application: phppath: php # Path to your PHP CLI interpreter (usually /usr/bin/php) magentopath: /var/www/html/example.com # Root directory where your Adobe Commerce application is installed (usually /var/www/html) checkregistrypath: /path/to/swat-agent/tmp # Temporary directory for the agent (usually /usr/local/swat-agent/tmp) issandbox: false # Enabling sandbox mode to use the agent on staging environment (true or false) database: user: your-adobe-commerce-db-username # Database user for your Adobe Commerce installation password: your-password # Database password for the specified user for your Adobe Commerce installation host: 127.0.0.1 # Database host for your Adobe Commerce installation dbname: your-adobe-commerce-db-name # Database name for your Adobe Commerce installation port: 3306 # Database port for your Adobe Commerce installation (usually 3306) tableprefix: # Table Prefix for your Adobe Commerce installation (default value: empty) enableautoupgrade: true # Enables automatic upgrade (restart required after an upgrade; agent does not check for upgrades if the option is disabled; true or false) runchecksonstart: true # Collect data on the first run (Usually 1) loglevel: error # Determines what events are logged based on severity (usually error)
-
驗證安裝。
code language-bash scheduler -v
code language-bash Version: 1.0.1 Success exit.
-
下載及安裝代理程式之後,您必須 將其設定為執行 使用下列其中一種方法:
執行代理程式 run-the-agent
我們建議將代理程式設定為以服務方式執行。 如果您對基礎結構的存取權有限,且不具備root許可權,則您必須使用 cron 而非。
服務 service
-
建立系統單位檔案
(/etc/systemd/system/scheduler.service)
搭配以下設定(取代<filesystemowner>
擁有安裝代理程式和Adobe Commerce軟體之目錄的UNIX®使用者)。 如果您以root使用者身份下載代理程式,請變更目錄和巢狀檔案擁有者。code language-config [Unit] Wants=network.target After=network.target [Service] Type=simple User=<filesystemowner> ExecStart=/path/to/agent/scheduler Restart=always RestartSec=3 [Install] WantedBy=multi-user.target
-
啟動服務。
code language-bash systemctl daemon-reload
code language-bash systemctl start scheduler
code language-bash systemctl enable scheduler
-
驗證服務是否已啟動且執行中。
code language-bash journalctl -u scheduler | grep "Application is going to update" | tail -1 && echo "Agent is successfully installed"
Cron cron
如果您沒有root許可權或沒有將服務設定為root的許可權,則可以改用cron。
更新您的cron排程:
( crontab -l ; echo "* * * * * flock -n /tmp/swat-agent.lockfile -c '/path/to/agent/scheduler' >> /path/to/agent/errors.log 2>&1" ) | sort - | uniq - | crontab -
解除安裝
執行以下命令,從您的系統解除安裝服務,並移除所有產生的檔案:
-
停止排程器。
code language-bash systemctl stop scheduler
-
停用排程器。
code language-bash systemctl disable scheduler
-
移除排程器服務的
systemd
單位檔案。code language-bash rm /etc/systemd/system/scheduler.service
-
重新載入
systemd
管理員設定。code language-bash systemctl daemon-reload
-
重設任何
systemd
來自失敗狀態的單位。code language-bash systemctl reset-failed
-
移除排程器服務目錄。
code language-bash rm -rf <CHECK_REGISTRY_PATH> #see SWAT_AGENT_APPLICATION_CHECK_REGISTRY_PATH in /etc/systemd/system/scheduler.service
-
移除排程器二進位檔案。
code language-bash rm /usr/local/bin/scheduler
如果您將代理程式設定為使用cron執行,請使用下列指示:
-
從crontab清單中移除代理程式。
code language-bash crontab -e
-
停止執行中的工作。
code language-bash ps aux | grep scheduler
-
移除安裝代理程式的目錄。
code language-bash rm -rf swat-agent
疑難排解
存取金鑰未正確剖析
如果您的存取金鑰未正確剖析,您可能會看到以下錯誤:
ERRO[2022-10-10 00:01:41] Error while refreshing token: error while getting jwt from magento: invalid character 'M' looking for beginning of value
FATA[2022-12-10 20:38:44] bad http status from https://updater.supportinsights.adobe.com/linux-amd64.json: 403 Forbidden
若要解決此錯誤,請嘗試下列步驟:
- 執行 指令碼安裝,儲存輸出,並檢閱輸出是否有錯誤。
- 檢閱產生的
config.yaml
並驗證Commerce執行個體和PHP的路徑是否正確。 - 請確定正在執行排程器的使用者位於 檔案系統擁有者 Unix群組或與檔案系統擁有者相同的使用者。
- 確定 Commerce服務聯結器 金鑰已正確安裝,並嘗試更新金鑰,以將擴充功能連線至您的系統。
- 解除安裝 代理程式在更新金鑰並使用 安裝指令碼.
- 執行排程器,檢視您是否仍收到相同的錯誤。
- 如果您還是收到相同的錯誤,請在中提高記錄層級
config.yaml
以偵錯並開啟支援票證。
SIGFAULT 錯誤
如果您看到 SIGFAULT 執行二進位檔時發生錯誤,您可能不會以Adobe Commerce和Agent檔案的檔案擁有者的身分執行此命令。
若要解決問題,請檢查代理程式目錄中所有與Adobe Commerce檔案擁有者具有相同使用者,以及二進位檔案的檔案,是否也應該在該使用者下執行。
您可以使用 chown
命令變更檔案擁有者並切換到適當的使用者。
請確定您的模組化機制(Cron或System.d)在適當的使用者下執行流程。