安裝入口網站

私有雲 v4.18.05 的邊緣

安裝 Apigee Developer Services 入口網站 (或簡稱為入口網站) 前,請確認下列事項:

  1. 請先安裝 Postgres,再安裝入口網站。您可以在安裝 Edge 時安裝 Postgres,或單獨安裝 Postgres 供入口網站使用。
    • 如果您是單獨安裝 Postgres,則可與入口網站位於相同的節點。
    • 如果您要連線至在 Edge 中安裝的 Postgres,且 Postgres 設為主要/待命模式,請指定 Postgres 伺服器的 IP 位址。
  2. 您正在使用支援的 64 位元版本 Red Hat Enterprise Linux、CentOS 或 Oracle 版本執行安裝作業。如需支援的版本清單,請參閱支援的軟體和支援的版本
  3. 已安裝 Yum。

安裝程式只包含 Apigee Developer Services 入口網站所需的 Drupal 模組 (或簡稱為入口網站)。如要瞭解如何安裝其他提供的模組,請參閱「擴充 Drupal 7」。

安裝總覽

如要安裝入口網站,您必須完成下列步驟。以下各節將詳細說明這些步驟。

  1. 測試連線
  2. 移除 7.0 之前的 PHP 版本
  3. 安裝 Postgres
  4. 安裝入口網站
  5. 確認已啟用更新管理員
  6. (選用) 設定 Apache Solr
  7. (選用) 安裝 SmartDocs
  8. (選用) 設定 JQuery

淘汰 SMTPSSL 屬性

在先前的版本中,您透過 SMTPSSL 屬性設定連線至入口網站的 SMTP 伺服器所使用的通訊協定。該屬性已淘汰。

現在請使用 SMTP_PROTOCOL 屬性 (而非 SMTPSSL 屬性) 來設定 SMTP 伺服器連線至入口網站的通訊協定。有效值為「standard」、「ssl」或「tls」。

建立入口網站設定檔

以下是入口網站安裝的無訊息設定檔範例。根據您的設定,視需要編輯這個檔案。使用 -f 選項 setup.sh 即可加入此檔案。

IP1=IPorDNSnameOfNode

# Must resolve to IP address or DNS name of host - not to 127.0.0.1 or localhost.
HOSTIP=$(hostname -i)

# Specify the name of the portal database in Postgres.
PG_NAME=devportal

# Specify the Postgres admin credentials.
# The portal connects to Postgres by using the 'apigee' user.
# If you changed the Postgres password from the default of 'postgres'
# then set PG_PWD accordingly.
# If connecting to a Postgres node installed with Edge,
# contact the Edge sys admin to get these credentials.
PG_USER=apigee
PG_PWD=postgres

# The IP address of the Postgres server.
# If it is installed on the same node as the portal, specify that IP.
# If connecting to a remote Postgres server,specify its IP address.
PG_HOST=$IP1

# The Postgres user credentials used by the portal
# to access the Postgres database,
# This account is created if it does not already exist.
DRUPAL_PG_USER=drupaladmin
DRUPAL_PG_PASS=portalSecret

# Specify 'postgres' as the database.
DEFAULT_DB=postgres

# Specify the Drupal admin account details.
# DO NOT set DEVPORTAL_ADMIN_USERNAME=admin.
# The installer creates this user on the portal.
DEVPORTAL_ADMIN_FIRSTNAME=firstName
DEVPORTAL_ADMIN_LASTNAME=lastName
DEVPORTAL_ADMIN_USERNAME=userName
DEVPORTAL_ADMIN_PWD=PORTAL_ADMIN_PASSWORD
DEVPORTAL_ADMIN_EMAIL=foo@bar.com

# Edge connection details.
# If omitted, you can set them in the portal UI.
# Specify the Edge organization associated with the portal.
EDGE_ORG=edgeOrgName

# Specify the URL of the Edge management API.
# For a Cloud based installation of Edge, the URL is:
# https://api.enterprise.apigee.com/v1
# For a Private Cloud installation, it is in the form:
# http://ms_IP_or_DNS:8080/v1 or
# https://ms_IP_or_DNS:TLSport/v1
MGMT_URL=https://api.enterprise.apigee.com/v1

# The org admin credentials for the Edge organization in the form
# of Edge emailAddress:pword.
# The portal uses this information to connect to Edge.
DEVADMIN_USER=orgAdmin@myCorp.com
DEVADMIN_PWD=ORG_ADMIN_PASSWORD

# The PHP port.
# If omitted, it defaults to 8888.
PHP_FPM_PORT=8888

# Optionally configure the SMTP server used by the portal.
# If you do, the properties SMTPHOST and SMTPPORT are required.
# The others are optional with a default value as notated below.
# SMTP hostname. For example, for the Gmail server, use smtp.gmail.com.
SMTPHOST=smtp.gmail.com

# Set the SMTP protocol as "standard", "ssl", or "tls",
# where "standard" corresponds to HTTP.
# Note that in previous releases, this setting was controlled by the
# SMTPSSL property. That property has been deprecated.
SMTP_PROTOCOL="standard"

# SMTP port (usually 25).
# The value can be different based on the selected encryption protocol.
# For example, for Gmail, the port is 465 when using SSL and 587 for TLS.
SMTPPORT=25

# Username used for SMTP authentication, defaults is blank.
SMTPUSER=your@email.com

# Password used for SMTP authentication, default is blank.
SMTPPASSWORD=YOUR_EMAIL_PASSWORD

1. 測試與 Apigee Edge 的連線

請在入口網站伺服器上執行下列 curl 指令,在要安裝入口網站和 Edge 管理伺服器的伺服器之間測試連線:

curl -u EMAIL:PASSWORD http://ms_IP_or_DNS:8080/v1/organizations/ORGNAME

或是:

curl -u EMAIL:PASSWORD https://ms_IP_or_DNS:TLSPort/v1/organizations/ORGNAME

其中 EMAILPASSWORDORGNAME 管理員的電子郵件地址和密碼。

請務必指定 Edge 安裝專用的主機名稱和通訊埠編號。通訊埠 8080 是 Edge 使用的預設通訊埠。如果您要在雲端中連線至機構,則要求網址為:https://api.enterprise.apigee.com/v1/organizations/ORGNAME

如果成功,curl 會傳回類似下列的回應:

{
  "createdAt" : 1348689232699,
  "createdBy" : "USERNAME",
  "displayName" : "cg",
  "environments" : [ "test", "prod" ],
  "lastModifiedAt" : 1348689232699,
  "lastModifiedBy" : "foo@bar.com",
  "name" : "cg",
  "properties" : {
    "property" : [ ]
  },
  "type" : "trial"
}

2. 移除 7.0 之前的 PHP 版本

安裝指令碼會在開始安裝之前,檢查系統中是否有 PHP 7.0 之前的版本。如果 PHP 版本 7.0 之前的版本存在,系統會顯示以下警告訊息:

The following packages present on your system conflict with software we are
about to install. You will need to manually remove each one, then re-run this install script.

php
php-cli
php-common
php-gd
php-mbstring
php-mysql
php-pdo
php-pear
php-pecl-apc
php-process
php-xml

使用下列指令移除 PHP 套件:

yum remove package_name

如果您不確定自己的伺服器是否已安裝 PHP,請使用下列指令:

rpm -qa | grep -i php

3. 安裝 Postgres

您必須安裝 Postgres 入口網站,才能安裝入口網站。您可以在安裝 Edge 時安裝 Postgres,或單獨安裝 Postgres 供入口網站使用。

  • 如果您要連線至在 Edge 中安裝的 Postgres,且 Postgres 設為主要/待命模式,請指定 Postgres 伺服器的 IP 位址。
  • 如果您是單獨安裝 Postgres,則可與入口網站位於相同的節點。

如要瞭解如何在安裝 Edge 時安裝 Postgres,請參閱「在節點上安裝 Edge 元件」。

如何單獨安裝 Postgres:

  1. 使用網際網路或非網際網路程序,在節點上安裝 Edge apigee-setup 公用程式。詳情請參閱「安裝 Edge apigee-setup 公用程式」。
  2. 建立 Postgres 設定檔,如以下範例所示:
    # Must resolve to IP address or DNS name of host - not to 127.0.0.1 or localhost
    HOSTIP=$(hostname -i)
    
    # The pod and region of Postgres. Use the default values shown below.
    MP_POD=gateway
    REGION=dc-1
    
    # Set the Postgres password. The default value is 'postgres'.
    PG_PWD=postgres
  3. 在命令提示字元中,執行設定指令碼以安裝 Postgres:
    /opt/apigee/apigee-setup/bin/setup.sh -p pdb -f postgres_config_file

    -p pdb 選項會指定安裝 Postgre。設定檔必須可供「apigee」使用者存取或讀取。

4. 安裝入口網站

安裝入口網站之前,請務必先完成下列3. 安裝 Postgres

  1. 在入口網站節點上安裝 Edge apigee-setup 公用程式
  2. 安裝 Postgres 獨立或安裝 Edge 時一併安裝 Postgres

如何安裝入口網站:

  1. 在命令提示字元中,執行 setup 指令碼:
    /opt/apigee/apigee-setup/bin/setup.sh -p dp -f configFile

    在此情況下:

    • configFile 是入口網站設定檔,如建立入口網站設定檔中所述。
    • -p dp 會指示 setup 指令碼安裝入口網站。

如何確認入口網站安裝成功:

  1. 前往入口網站首頁 http://localhost:8079,或入口網站的 DNS 名稱。
  2. 使用您在入口網站設定檔中設定的管理員憑證登入入口網站。
  3. 在 Drupal 選單中依序選取「Reports」>「狀態報告」,確保您查看入口網站的目前狀態。
  4. 請確認管理伺服器連線成功。如果沒有,請執行以下操作:
    1. 前往「入口網站連線設定」頁面 (例如 http://portal_IP:8079/admin/config/devconnect)。
    2. 按一下「Test Connection」按鈕。如果連線成功,就表示已完成。如果連線失敗,請繼續操作。
    3. 檢查端點和驗證設定:
      • Management API 端點網址:檢查通訊協定 (HTTP 或 HTTPS)、IP 或 DNS 名稱和通訊埠號碼正確無誤。例如:
        http://10.10.10.10:8080/v1
      • 端點已驗證使用者:機構管理員的使用者名稱。
      • 已驗證使用者的密碼:機構管理員的密碼。

      預設值反映了您在安裝期間建立的入口網站設定檔中的設定。

      這些值應與您在步驟 1:測試與 Apigee Edge 的連線中所用的 ms_IP_or_DNSemailpassword 值相符。使用者名稱和密碼也應與新手上路設定檔中的 USER_NAMEUSER_PWD 屬性值相符,或是其角色為機構管理員的任何使用者的憑證值。

    4. 成功連線至管理伺服器後,請按一下頁面底部的「Save configuration」按鈕儲存變更。

5. 確認已啟用更新管理員模組

如要接收 Drupal 更新通知,請確認已啟用 Drupal Update Manager 模組。在 Drupal 選單中選取「Modules」,然後向下捲動至「Update Manager」模組。如果尚未啟用,請啟用。

啟用後,您可以前往「報表」>「可用的更新」選單項目,查看可用的更新。您也可以使用下列 Drush 指令:

drush pm-info update

您必須從網站的根目錄執行這個指令。根據預設,入口網站安裝在 /opt/apigee/apigee-drupal/wwwroot。因此,您必須先將目錄變更為 /opt/apigee/apigee-drupal/wwwroot,再執行指令。如果您並未在預設目錄中安裝入口網站,請切換至安裝目錄。

使用「Reports」(報表) >「Available Updates」(可用更新) >「Settings」(設定) 選單項目來設定模組,讓系統在有可用更新時透過電子郵件通知您,以及設定檢查更新的頻率。

6. 設定 Apache Solr 搜尋引擎 (選用)

根據預設,當您安裝入口網站時,系統會停用連結至 Apache Solr 搜尋引擎的 Drupal 模組。大多數的入口網站使用 Drupal 搜尋引擎,因此不需要 Drupal Solr 模組。

如果您決定使用 Solr 做為搜尋引擎,就必須在伺服器上本機安裝 Solr,然後在入口網站上啟用並設定 Drupal Solr 模組。

如要啟用 Drupal Solr 模組:

  1. 以具備管理員或內容建立權限的使用者登入入口網站。
  2. 在「Drupal」選單中選取「Modules」
  3. 啟用 Apache Solr Framework 模組和 Apache Solr Search 模組。
  4. 儲存變更。
  5. 請按照 https://drupal.org/node/1999280 的說明設定 Solr。

7. 安裝 SmartDocs (選用)

SmartDocs 可讓您以完整的互動式 API 說明文件形式,在入口網站上記錄 API。不過,您必須先在 Edge 上安裝 SmartDocs,才能透過入口網站使用 SmartDocs。

  • 如要將入口網站連線至 Edge Cloud 安裝項目,代表裝置已安裝 SmartDocs,您不需要再進一步設定。
  • 如要將入口網站連結至 Edge for Private Cloud 安裝作業,請務必確認已在 Edge 上安裝 SmartDocs。如要進一步瞭解如何安裝 Edge 和 SmartDocs,請參閱安裝 SmartDocs

此外,您也必須在入口網站中啟用 SmartDocs。如要進一步瞭解 SmartDocs,請參閱「使用 SmartDocs 記錄 API」。

8. 為非網際網路安裝設定 JQuery Update 模組 (選用)

如果您在非網際網路安裝中安裝並使用 JQuery Update 模組,則必須將模組設定為使用本機版本的 JQuery。如果您將模組設定為使用 CDN 進行非網際網路安裝,它會嘗試存取 CDN,並造成頁面載入延遲。如要進一步瞭解 JQuery Update 模組,請參閱 https://www.drupal.org/project/jquery_update

如要設定 JQuery Update 模組以使用本機版本的 JQuery:

  1. 以具備管理員或內容建立權限的使用者登入入口網站。
  2. 在 Drupal 選單中依序選取「Configuration」>「Development」>「JQuery Update」
  3. 按一下左側導覽面板中的「成效」
  4. 在 JQuery 和 JQuery UI CDN 下拉式選單中,選取「None」
  5. 按一下「儲存設定」

9. 後續步驟

下表列出您在安裝後最常執行的部分常見工作,並提供 Apigee 說明文件的連結,該說明文件可讓您進一步瞭解相關資訊:

工作 說明

自訂主題

主題會定義入口網站的外觀,包括顏色、樣式和其他視覺元素。

自訂外觀

首頁包含主選單、歡迎訊息、頁首、頁尾和標題。

新增及管理使用者帳戶

註冊程序可控管新開發人員在入口網站上註冊帳戶的方式。舉例來說,新的開發人員可以立即存取入口網站,或是需要經過管理員驗證。這項程序也能控管入口網站管理員在建立新帳戶時的通知方式。

設定電子郵件

入口網站會針對特定事件傳送電子郵件。例如,有一位新開發人員在入口網站註冊,以及開發人員遺失自己的密碼。

新增及管理使用者帳戶

新增《條款及細則》頁面,開發人員必須先接受這些條款,才能存取入口網站。

新增及管理使用者帳戶

入口網站會實作角色型授權模型。在允許開發人員註冊之前,請先定義入口網站使用的權限和角色。

新增網誌和論壇貼文

入口網站內建對網誌和討論串論壇的支援,定義查看、新增、編輯及刪除網誌和論壇文章所需的權限。

確保進行資料庫備份

請務必備份 Drupal 資料庫。請注意,由於每次安裝項目都不同,因此您可以選擇如何以最佳方式備份資料庫。

另請參閱如何執行備份

設定主機名稱

如果您沒有在 DNS 伺服器上設定主機名稱,隨時可以透過伺服器的 IP 位址存取網站。如果您想使用主機名稱,可以為伺服器設定 DNS。基本設定應可正常運作,無須進行任何其他設定。

如果您已設定負載平衡器,或基於其他原因而在網站上收到錯誤網址,可以按照下列步驟為 Drupal 設定 $base_url

  1. 如果目錄 /opt/apigee/data/apigee-drupal-devportal/sites/default/includes 不存在,請建立目錄。
  2. 在該目錄中建立名為 settings.php 的檔案。
  3. 請將以下內容新增到 settings.php 檔案中:
    /**
    * Base URL (optional).
    *
    * If Drupal is generating incorrect URLs on your site, which could
    * be in HTML headers (links to CSS and JS files) or visible links
    * on pages (such as in menus), uncomment the Base URL statement
    * below (remove the leading hash sign) and fill in the absolute URL
    * to your Drupal installation.
    *
    * You might also want to force users to use a given domain.
    * See the .htaccess file for more information.
    *
    * Examples:
    *   $base_url = 'http://www.example.com';
    *   $base_url = 'http://www.example.com:8888';
    *   $base_url = 'http://www.example.com/drupal';
    *   $base_url = 'https://www.example.com:8888/drupal';
    *
    * It is not allowed to have a trailing slash; Drupal will add it
    * for you.
    */
    # $base_url = 'http://www.example.com/';  // NO trailing slash!
    $base_url = ‘http://www.example.com’;
    
  4. 請將最後 $base_url 行變更為網站的主機名稱。
  5. 儲存檔案。

請注意,您可以在這個檔案中加入 /opt/apigee/data/apigee-drupal-devportal/ sites/default/default.settings.php 的其他設定。

如要進一步瞭解 $base_url 屬性,請參閱以下內容:

自訂開發 您也可以在主題之外的自訂程式碼,擴充入口網站的功能。方法是按照 Drupal 的模組開發主題所述建立自己的 Drupal 模組,然後將模組放在 /sites/all/modules 目錄中。