安裝入口網站

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

  1. 您必須先安裝 Postgres,才能安裝入口網站。您可以選擇安裝 Postgres 安裝 Edge,或安裝 Postgres 供入口網站使用。
    • 如果單獨安裝 Postgres ,則可與入口網站位於相同的節點上。
    • 如果您要連線至安裝做為 Edge 中的 Postgres,且 Postgres 已設定 在主要執行個體/待命模式下,指定 Postgres 主要伺服器的 IP 位址。
  2. 你正在透過支援 Red Hat 的 64 位元版本執行安裝作業 Enterprise Linux、CentOS 或 Oracle。如要查看支援版本清單,請前往: 支援的軟體和支援版本
  3. 已安裝 Yum。

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

安裝總覽

如要安裝入口網站,請執行下列步驟。每個步驟都會在 請參閱後續章節

  1. 測試連線狀態
  2. 移除 PHP 7.0 之前的版本
  3. 安裝 Postgres
  4. 安裝入口網站
  5. 確認已啟用更新管理員
  6. (選用) 設定 Apache Solr
  7. (選用) 安裝 SmartDoc
  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 的連線

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

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. 移除 PHP 7.0 以下版本

安裝指令碼會先檢查系統上的 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

請注意,入口網站使用 PHP 4.18.01-0.0.49 版。這個屬性的用意與 Apigee Edge for Private Cloud 的版本號碼。

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,單獨安裝 Postgres 或做為安裝 Edge 的一部分

如何安裝入口網站:

  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 選單中的「狀態報告」以確保 可查看入口網站的目前狀態
  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
      • 端點已驗證使用者:機構管理員 使用者名稱。
      • 已驗證使用者的密碼:機構管理員的 密碼。

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

      這些值應與 ms_IP_or_DNSemail 和 您在步驟中使用的 password 個值 1:測試與 Apigee Edge 的連線。 使用者名稱和密碼也必須與 USER_NAME 的值相符 和 USER_PWD 屬性則位於 新手上路設定檔,或 憑證。

    4. 成功連線至管理伺服器後,按一下「儲存」 設定] 按鈕,即可儲存變更。

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

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

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

drush pm-info update

您必須從網站的根目錄執行這個指令。根據預設, 入口網站安裝在 /opt/apigee/apigee-drupal/wwwroot。因此 請先將目錄變更為「/opt/apigee/apigee-drupal/wwwroot」 所執行的指令如果您沒有在預設目錄中安裝入口網站,請 安裝目錄

使用「報表」>有可用的更新 >設定選單項目 模組,在有可用的更新時以電子郵件通知您,並且設定檢查 更新。

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. 安裝 SmartDoc (選用)

SmartDoc 能讓您在入口網站上記錄 API 的方式, 完全互動式的 API 說明文件。不過,如要透過入口網站使用 SmartDoc,您必須先 在 Edge 上安裝 SmartDoc。

  • 如要將入口網站連線至 Edge Cloud 安裝,SmartDoc 已經 安裝,不需要進行其他設定。
  • 如要將入口網站連線至 Edge for Private Cloud 安裝作業,您必須確保 安裝在 Edge 上的 SmartDoc如要進一步瞭解如何安裝 Edge 和 SmartDoc,請參閱 安裝 SmartDoc

您也必須啟用入口網站的 SmartDoc。如要進一步瞭解 SmartDoc,請參閱 使用 SmartDoc 記錄文件 API

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

如果您在非網際網路的安裝環境中安裝及使用 JQuery Update 模組,您需要 設定模組以使用本機版本的 JQuery如果將模組設為使用 CDN 非網際網路安裝時,此伺服器會嘗試存取 CDN,並導致頁面延遲 載入中。如要進一步瞭解 JQuery Update 模組,請參閱 https://www.drupal.org/project/jquery_update.

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

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

9. 後續步驟

下表列出您在安裝後最常執行的工作。 並提供 Apigee 說明文件的連結,可讓您查看更多資訊:

工作 說明

自訂主題

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

自訂外觀

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

新增及 管理使用者帳戶

註冊程序會決定新開發人員在 入口網站。舉例來說,新的開發人員可以立即存取入口網站,或是 則必須經過管理員驗證這項程序也會控管入口網站 建立新帳戶時,管理員會收到通知。

設定電子郵件

入口網站會為了回應特定事件而傳送電子郵件。舉例來說 開發人員在入口網站上註冊,以及開發人員忘記密碼時。

新增及 管理使用者帳戶

新增條款與開發人員必須先接受條件頁面才能獲準 存取入口網站

新增及 管理使用者帳戶

入口網站實作以角色為基礎的授權模型,允許開發人員 並定義入口網站使用的權限和角色。

新增網誌和論壇文章

入口網站內建網誌和討論串論壇支援。定義權限 能夠檢視、新增、編輯及刪除網誌和論壇文章。

確保執行資料庫備份

確認備份的是 Drupal 資料庫。請注意 安裝方式不同,您必須決定將 資料庫

另請參閱如何執行備份

設定主機名稱

如果您沒有在 DNS 伺服器中設定主機名稱,可隨時透過 伺服器的 IP 位址如要使用主機名稱,可以為 應能正常運作,無需進行基本設定 設定。

如果設定了負載平衡器,或是為某些使用者在網站上取得的網址不正確 其他原因,請按照下列步驟為 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 的 模組 發展相關主題,然後將模組放在 /sites/all/modules 目錄。