开发者服务门户安装

Edge for Private Cloud 4.17.01 版

在安装之前,请确保:

  • 您需要在安装门户之前安装 Postgres。您可以在安装 Edge 的过程中安装 Postgres,也可以单独安装 Postgres 以供门户使用。
    • 如果您安装 Postgres 独立版,则可以将其安装在与门户相同的节点上。
    • 如果您要连接到作为 Edge 的一部分安装的 Postgres,并且 Postgres 配置为主/备用模式,请指定主 Postgres 服务器的 IP 地址。
  • 您正在受支持的 64 位版本的 Red Hat Enterprise Linux、CentOS 或 Oracle 上执行安装。如需查看受支持版本的列表,请参阅受支持的软件和受支持的版本。
  • 已安装 Yum。

安装概览

在节点上安装 Edge apigee-setup 实用程序后,使用该实用程序在节点上安装门户。apigee-setup 实用程序采用以下形式:

> sudo /opt/apigee/apigee-setup/bin/setup.sh -p component -f configFile

将包含安装相关信息的配置文件传递给 apigee-setup 实用程序。如果配置文件缺少任何必需信息,apigee-setup 实用程序会提示您在命令行中输入这些信息。

唯一的要求是配置文件必须可供“apigee”用户访问或读取。

例如,使用以下命令安装门户:

> sudo /opt/apigee/apigee-setup/bin/setup.sh -p dp -f myConfig

如需了解详情,请参阅安装 Edge apigee-setup 实用程序。

创建配置文件

下面显示了门户安装的静默配置文件示例。根据您的配置需要修改此文件。使用 setup.sh 的 -f 选项添加此文件。

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=pWord 
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=pWord 

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

# You must configure the SMTP server used by the portal. 
# 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 

# Use SSL for SMTP: 'y' or 'n' (default). 
SMTPSSL="n" 

# 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=yourEmailPassword

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}

其中,EMAIL 和 PASSWORD 是 ORGNAME 的管理员的电子邮件地址和密码。

请务必指定特定于您的 Edge 安装的主机名和端口号。端口 8080 是 Edge 使用的默认端口。如果您要连接到云中的组织,则请求网址为:https://api.enterprise.apigee.com/v1/organizations/{ORGNAME}。

如果成功,此命令会返回类似于以下内容的响应:

{
  "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 版本

安装脚本会在开始安装之前检查系统上是否存在 7.0 之前的 PHP 版本。如果存在 7.0 之前的 PHP 版本,系统会显示以下警告消息:

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

对于 CentOS 和 RedHat Enterprise Linux (RHEL),请使用以下命令移除 PHP 软件包:

yum remove <package-name>

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 创建一个配置文件,如下所示:

    # Postgres 的 Pod 和区域。使用如下所示的默认值。
    MP_POD=gateway
    REGION=dc-1

    # Set the Postgres password. 默认值为“postgres”。
    PG_PWD=postgres
  3. 在命令提示符处,运行设置脚本以安装 Postgres:
    > /opt/apigee/apigee-setup/bin/setup.sh -p pdb -f configFile

    “-p pdb”选项指定安装 Postgres。

    配置文件必须可供“apigee”用户访问或读取。

4. 安装门户

如需安装门户,请执行以下操作:

  1. 使用互联网或非互联网过程在节点上安装 Edge apigee-setup 实用程序。如需了解详情,请参阅安装 Edge apigee-setup 实用程序。
  2. 确保您已安装 Postgres(独立安装或作为 Edge 安装的一部分)。
  3. 在命令提示符处,运行设置脚本:
    > /opt/apigee/apigee-setup/bin/setup.sh -p dp -f configFile

    “-p dp”选项指定安装门户。

    配置文件必须可供“apigee”用户访问或读取。
  4. 前往门户首页(网址为 http://localhost:8079)或门户的 DNS 名称。
  5. 使用您在配置文件中设置的管理员凭据登录门户。

5. 确保已启用更新管理器模块

如需接收 Drupal 更新通知,请确保已启用 Drupal 更新管理器模块。从 Drupal 菜单中选择模块,然后向下滚动到更新管理器模块。如果尚未启用,请将其启用。

启用后,您可以使用报告 > 可用更新菜单项查看可用更新。您还可以使用以下 Drush 命令:

> drush pm-info update

您必须从网站的根目录运行此命令。默认情况下,开发者门户安装在 /opt/apigee/apigee-drupal 中。因此,您应先将目录更改为 /opt/apigee/apigee-drupal,然后再运行该命令。如果您未在默认目录中安装门户,请切换到安装目录。

使用报告 > 可用更新 > 设置菜单项,将模块配置为在有可用更新时向您发送电子邮件,并设置检查更新的频率。

6. 配置 Apache Solr 搜索引擎(可选)

默认情况下,安装门户时,连接到 Apache Solr 搜索引擎的 Drupal 模块处于停用状态。大多数门户都使用内部 Drupal 搜索引擎,因此不需要 Drupal Solr 模块。

如果您决定使用 Solr 作为搜索引擎,则必须在服务器上本地安装 Solr,然后在门户上启用和配置 Drupal Solr 模块。

如需启用 Drupal Solr 模块,请执行以下操作:

  1. 以具有管理员或内容创作者权限的用户身份登录门户。
  2. 在 Drupal 菜单中选择模块。
  3. 启用 Apache Solr Framework 模块和 Apache Solr Search 模块。
  4. 保存更改。
  5. 按照 https://drupal.org/node/1999280 中的说明配置 Solr。

7. 安装 SmartDocs(可选)

借助 SmartDocs,您可以在开发者服务门户上记录 API,从而使 API 文档完全互动。但是,如需将 SmartDocs 与门户搭配使用,您必须先在 Edge 上安装 SmartDocs。

  • 如果您要将门户连接到 Edge Cloud 安装,则 SmartDocs 已安装,无需进一步配置。
  • 如果您要将门户连接到 Edge for Private Cloud 安装,则必须确保在 Edge 上安装了 SmartDocs。如需详细了解如何安装 Edge 和 SmartDocs,请参阅安装 SmartDocs。

您还必须在门户上启用 SmartDocs。如需详细了解 SmartDocs,请参阅使用 SmartDocs 记录 API。

8. 接下来呢?

安装 Developer Services 门户后,下一步是根据您的特定要求对其进行配置和自定义。Apigee 网站上的文档包含有关配置、设置样式和管理门户的所有信息。请访问 http://apigee.com/docs/developer-services/content/what-developer-portal 参阅相关文档。

下表列出了您在安装后执行的一些最常见任务,并提供了指向 Apigee 文档的链接,您可以在其中找到更多信息:

任务

说明

自定义主题

主题定义了门户的外观,包括颜色、样式和其他视觉方面。

自定义外观

首页包括主菜单、欢迎消息、页眉、页脚和标题。

添加和管理用户账号

注册流程控制新开发者如何在门户上注册账号。例如,新开发者是立即获得对门户的访问权限,还是必须由管理员进行验证。此流程还控制在创建新账号时如何通知门户管理员。

配置电子邮件

门户会发送电子邮件来响应特定事件。例如,当新开发者在门户上注册时,以及当开发者丢失密码时。

添加和管理用户账号

添加一个“条款及条件”页面,开发者必须先接受这些条款及条件,然后才能访问门户。

添加和管理用户账号

该门户实现了基于角色的授权模型。在允许开发者注册之前,请先定义门户使用的权限和角色。

添加博文和论坛帖子

该门户内置了对博客和主题论坛的支持。定义查看、添加、修改和删除博客和论坛帖子所需的权限。

确保您正在进行数据库备份

确保您正在备份 Drupal 数据库。请注意,由于每个安装都不同,因此您需要自行确定如何以最佳方式备份数据库。

注意:备份和迁移模块与 Postgres 数据库不兼容。

另请参阅如何执行备份。

设置主机名

如果您未在 DNS 服务器中设置主机名,则始终可以通过服务器的 IP 地址访问该网站。如果您想使用主机名,可以为服务器配置 DNS,这样在基本设置中无需任何其他配置即可正常运行。

如果您设置了负载均衡器,或者由于其他原因在网站上获取了不正确的网址,则可以在开发者门户 settings.php 文件中设置 $base_url,该文件默认位于 /opt/apigee/apigee-drupal/sites/default 目录中。

定制化开发 您可能还希望使用主题之外的自定义代码来扩展门户的功能。为此,请按照 Drupal 的模块开发主题中所述创建您自己的 Drupal 模块,并将该模块放在 /sites/all/modules 目录中。