Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: IP changed to localhost

...

  1. Point to the WSO2 Identity Server so that it acts as the Key Manager of the API Manager in <APIM_HOME>/repository/conf/api-manager.xmlfile. 

    1. Change the ServerURL of the AuthManager to point to IS.
      <ServerURL>https://${IS_SERVER_HOST}:{port}/services/</ServerURL>
    2. Change the ServerURL of the APIKeyValidator to point to IS.
      <ServerURL>https://${IS_SERVER_HOST}:{port}/services/</ServerURL>
    3. Change the KeyValidatorClientType from ThriftClient to WSClient.
    4. Change EnableThriftServer to false.

    The following is an example of how this configuration would look like:

    Code Block
    languagexml
    titleapi-manager.xml
    <APIKeyValidator>
            <ServerURL>https://localhost:9443{+portoffset}/services/</ServerURL>
            <Username>${admin}</Username>
            <Password>${admin}</Password>
            ...
    </APIKeyValidator>

    For example, if the port offset is 1 the server URL is as follows:

    https://localhost:9444/services/
  2. Open the <APIM_HOME>/repository/conf/datasources/master-datasources.xml file and add the following datasources.

    Code Block
    languagexml
    titlemaster-datasources.xml
    <datasource>
        <name>WSO2AM_DB</name>
        <description>The datasource used for API Manager database</description>
        <jndiConfig>
            <name>jdbc/WSO2AM_DB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>  <url>jdbc:mysql://localhost:3306/apimgt?autoReconnect=true&amp;relaxAutoCommit=true&amp;</url>
                <username>apiuser</username>
                <password>apimanager</password>
                <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
    			<defaultAutoCommit>false</defaultAutoCommit>
            </configuration>
        </definition>
    </datasource>
    
    <datasource>
        <name>WSO2REG_DB</name>
        <description>The datasource used for registry and user manager</description>
        <jndiConfig>
            <name>jdbc/WSO2REG_DB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
    <url>jdbc:mysql://localhost:3306/registry?autoReconnect=true&amp;relaxAutoCommit=true&amp;</url>
                <username>apiuser</username>
                <password>apimanager</password>
                <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
    </datasource>
     
    <datasource>
        <name>WSO2UM_DB</name>
        <description>The datasource used for registry and user manager</description>
        <jndiConfig>
            <name>jdbc/WSO2UM_DB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
       <url>jdbc:mysql://localhost:3306/userstore?autoReconnect=true&amp;relaxAutoCommit=true&amp;
                </url>
                <username>apiuser</username>
                <password>apimanager</password>
                <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
    </datasource>
  3. Open the user-mgt.xml file found in the <APIM_HOME>/repository/conf directory and change the permission datasource.

    1. Add the data source configuration as indicated below.

      Code Block
      languagexml
      titleuser-mgt.xml configurations
      <Realm>
              <Configuration>
      			...
      			<Property name="dataSource">jdbc/WSO2UM_DB</Property>
              </Configuration>
      		...
      </Realm>
  4. Make sure you add the user store configuration correctly. This is the same configuration that you did in the Identity Server and the easiest way to configure this is to copy over the configurations you did in the <IS_HOME>/repository/conf/user-mgt.xml file. For more information on how to configure this, see here .

    Note

    Note: If you are using the embedded LDAP that comes with the IS, then you need to point to this user store from API Manager. You can copy this configuration from the <IS_HOME>/repository/conf/user-mgt.xml file.

    When copying configurations, note that you must update the port numbers. For instance, when configuring the ConnectionURL property, you must update the port number as it will point to the port number of the Identity Server when starting up if you copy it directly.

  5. Create the registry mounts. Open the <APIM_HOME>/repository/conf/registry.xml file and insert the following configurations. 

    Code Block
    languagexml
    titleregistry.xml
    <dbConfig name="govregistry">
           <dataSource>jdbc/WSO2REG_DB</dataSource>
    </dbConfig>
    
    <remoteInstance url="https://localhost">	
           <id>gov</id>
           <dbConfig>govregistry</dbConfig>
    	   <cacheId>root@jdbc:mysql://10.20.30.42localhost:3306/registrydb</cacheId>
           <readOnly>false</readOnly>
           <enableCache>true</enableCache>
           <registryRoot>/</registryRoot>
    </remoteInstance>
    
    <mount path="/_system/governance" overwrite="true">
           <instanceId>gov</instanceId>
           <targetPath>/_system/governance</targetPath>
    </mount>
    
    <mount path="/_system/config" overwrite="true">
           <instanceId>gov</instanceId>
           <targetPath>/_system/config</targetPath>
    </mount>
  6. Run the following scripts for the respective databases. This creates some tables in the databases that may be required.
    • For apimgt run <APIM_HOME>/dbscripts/apimgt/mysql.sql
    • For userstore run <APIM_HOME>/dbscripts/mysql.sql
    • For registry run <APIM_HOME>/dbscripts/mysql.sql

...