본문 바로가기
IBM - old/IBM APIC

[APIC]Installing and configuring IBM API Connect in a Docker container

by freeman98 2017. 1. 4.

https://www.ibm.com/support/knowledgecenter/SSMNED_5.0.0/com.ibm.apic.install.doc/tapic_docker_install.html


Installing and configuring IBM API Connect in a Docker container

By installing IBM® API Connect in a Docker container, you can run a complete IBM API Connect on-premises environment on your local machine. A Docker container installation of IBM API Connect is only for development use; it is not supported in a production environment.

Before you begin

You must install the following software on a supported operating system:
  • docker 1.12.0 or later.
  • docker-compose 1.8.1 or later.

About this task

Procedure

  1. Install IBM API Connect in a Docker container.
    1. Create a git clone of the IBM API Connect Docker repository by entering the following command:
      git clone https://github.com/strongloop/apiconnect-docker
    2. Review the terms of the license agreement by entering the following command in the root folder of your local repository clone:
      docker run -it --rm --env SHOW_LICENSE=1 ibmcom/apiconnect:manager-v5.0.6.0
    3. In the root folder of your local repository clone, edit the file .env, specify the details for your SMTP server, and accept the license, by modifying the parameters in the file as follows:
      ACCEPT_LICENSE=true
      SMTP_HOST=smtp_server_hostname_or_address
      SMTP_PORT=smtp_port_value
      SMTP_SENDER=sender_email_address
      SMTP_USERNAME=smtp_username
      SMTP_PASSWORD=smtp_password
      where:
      • (required) smtp_server_hostname_or_address is the host name or IP address of your SMTP mail server.
      • (required) smtp_port_value is the port value of your SMTP mail server.
      • (required) sender_email_address is the email address from which API Connect emails are sent.
      • (optional) smtp_username is the username required to send emails through the SMTP mail server.
      • (optional) smtp_password is the password for the SMTP username.
      Important: The ACCEPT_LICENSE=true entry is commented out by default, you must remove the preceding # character.
    4. Ensure that your Docker virtual host has the following minimum resources:
      • 2 CPUs
      • 8GB RAM
    5. In a Docker terminal window, change to the root folder of your local repository clone, and run the following command, depending on whether you want to use DataPower® Gateway or Micro Gateway as the gateway service:
      DataPower Gatewaydocker-compose up -d
      Micro Gatewaydocker-compose -f docker-compose-microgateway.yaml up  -d
      The command will take a while to complete.
    6. Confirm that the IBM API Connect services are running by entering the following command, depending on whether you want to use DataPower Gateway or Micro Gateway as the gateway service:
      DataPower Gatewaydocker-compose ps
      Micro Gatewaydocker-compose -f docker-compose-microgateway.yaml ps
      You should see a response similar to the following (if you are using the Micro Gateway, microgateway is listed instead of datapower):
                  Name                           Command               State               Ports
      ------------------------------------------------------------------------------------------------------
      apim                            /tini -- /startup.sh             Up
      datapower                       /start.sh                        Up       443/tcp
      dockercompose_make-ssh-keys_1   /bin/sh -c /genkey.sh            Exit 0
      esmaster                        /docker-entrypoint.sh /bin ...   Up       9200/tcp, 9300/tcp
      ibmlogstash                     /bin/sh -c /startup.sh           Up
      ibmportal                       /root/tini -- /root/start_ ...   Up
      microservice                    /bin/sh -c /usr/bin/app.sh ...   Up       8080/tcp
      nginx                           /bin/sh -c /run.sh               Up       0.0.0.0:443->443/tcp, 80/tcp
    7. To enable access to all the services, edit your local /etc/hosts file to map the IP address of your Docker host to the IBM API Connect host names, depending on whether you want to use DataPower Gateway or Micro Gateway as the gateway service, as follows:
      DataPower Gatewaydocker_host_ip_address apim ibmportal datapower microservice
      Micro Gatewaydocker_host_ip_address apim ibmportal microgateway microservice
  2. Configure your IBM API Connect cloud.
    1. Open the Cloud Manager user interface in a browser by entering the following URL:
      https://apim/cmc
    2. Log in with the following credentials:
      Username: admin
      Password: !n0r1t5@C
    3. Accept the license agreement.
    4. On the Create your profile page, enter your email address, and a new password, then click Update profile. The Cloud Manager user interface opens.
    5. DataPower Gateway onlyConfigure the Management service by completing the following steps:
      1. Click Services, then in the DataPower Services pane click the Service Settings icon Service Settings icon.
      2. Enter datapower in the Address field, then click Save.
      3. In the DataPower Services pane, click Add Server, then enter the following details:
        Display Name: idg
        Address: datapower
        Username: admin
        Password: admin
      4. Click Create to add the server.
        Note: This operation might take a while to complete.
    6. Add a new provider organization by completing the following steps:
      1. Click the Organizations tab, then click Add.
      2. Enter a Display Name and Name of your choice.
        Note: The value of the Name field is included in the organization segment of the URL for API calls.
      3. Click New User and enter your email address in the Email field.
      4. Click Add to create the provider organization. An invitation email is sent to the specified email address.
      5. In the invitation email, click the activation link and follow the instructions to sign up.
    7. When you have completed the sign up instructions, the login page for the API Manager user interface opens; log in with your email address and password.
      The API Manager user interface opens. To reopen the API Manager in the future, use the following URL:
      https://apim/apim
  3. Configure your IBM API Connect Catalog.
    1. In the API Manager user interface, click the Navigate to icon The Navigate to icon., then click Dashboard.
    2. Click the Sandbox Catalog to display its details.
    3. Micro Gateway onlyCustomize the gateway endpoint by completing the following steps:
      1. Click the Settings tab, then click Endpoints.
      2. In the Custom Gateway URL field, enter https://microgateway.
      3. Click the Save icon Save icon to save your gateway customization.
    4. Enable the Developer Portal in the Sandbox Catalog by completing the following steps:
      1. Click the Settings tab, then click Portal.
      2. From the Select Portal drop-down, select IBM Developer Portal. The URL is set automatically to the following value:
        https://ibmportal/organization_name/sb
        where organization_name is the Name value that you specified when you created the provider organization in step 2.f.
      3. Click the Save icon Save icon to save your Developer Portal configuration.

        After a few minutes, you will receive an email with a link to the Developer Portal site for the Sandbox Catalog. The link is single use only link for the administrator account. When the link is active and you have accessed it, you can change the password of the administrator account.

  4. Publish a microservice application to the Sandbox Catalog.
    1. Install the IBM API Connect developer toolkit; for details, see Installing the toolkit.
    2. Open a command window and navigate to the /apim/docker/docker-compose/microservice folder in your local repository clone.
    3. Enter the command apic login, and supply the following details in response to the prompts:
      • Server: apim.
      • Username: your API Manager user interface account email address.
      • Password: your API Manager user interface account password.
      You should receive the response Logged into apim successfully.
    4. Enter the following command (all on one line):
      apic publish definitions/loopback-example-database-product.yaml --catalog sb 
      --organization organization_name --server apim
      where organization_name is the Name value that you specified when you created the provider organization in step 2.f.

  5. Configure the Developer Portal.
    1. Open the Developer Portal user interface by entering the following URL:
      https://ibmportal/organization_name/sb/
      where organization_name is the Name value that you specified when you created the provider organization in step 2.f.

      You can see the loopback-example-database 1.0.0 microservice in the Featured APIs pane.

    2. Click Create an account and follow the instructions to create a Developer Portal account. An invitation email is send to the specified email address.
      Note: You cannot use the same email address as the one you used in step 2.f.iii when creating your provider organization, because this email address is used for the Developer Portal admin account.
    3. Follow the activation link in the invitation email, and log in to the Developer Portal as a developer by using the account credentials you just specified.
    4. Create an App by completing the following steps:
      1. Click Apps > Create new App.
      2. Enter microservice for the title, and a description of your choice, then click Submit.
    5. Select the Show Client Secret check box and make a note of your client secret because it is displayed only once. You must supply the client secret when you call an API that requires you to identify your application by using a client ID and client secret.
      Note: The client secret cannot be retrieved. If you forget it, you must reset it.
    6. The client ID is hidden; to display the client ID for your application, select the Show check box for Client ID, and make a note of it. The client ID is displayed and can be hidden again by clearing the check box.
    7. Optional: You can add an additional client ID and client secret to the application. For more details, see Registering an application.
    8. Subscribe to a Plan by completing the following steps:
      1. Click API Products, then click loopback-example-database (1.0.0) to open the Product details page.
      2. Click Subscribe to subscribe to the default Plan.
      3. Select your microservice App, then click Subscribe.
      Micro Gateway onlyNote: It takes up to 10 minutes for the Micro Gateway to synchronize with the API Connect Management server. The subscription credentials will be accepted by the Micro Gateway after the synchronization is complete.

  6. Access the microservice APIs through the gateway.
    Note: The following commands use sample client ID and client secret values. You must replace these with your own credentials that you derived in step 5.d.
    1. Access the POST API through the gateway by running the following command:
      curl -k --request POST \ 
         --url endpoint_url \
         --header 'accept: application/json' \
         --header 'content-type: application/json' \
         --header 'x-ibm-client-id: ad37d0e2-4551-41f7-a011-88f0447f4560' \
         --header 'x-ibm-client-secret: yY7xL8hA0iD1tR0qD5hY0kG3rR3nC2eA3mM8iN2yL4hD2bQ2gU' \
         --data '{"email":"myemail@myhost.com","createdAt":"2016-11-26T15:29:45.233Z","lastModifiedAt":"2016-11-25T20:17:02.033Z"}'
    2. Access the GET API through the gateway by running the following command:
      curl -k --request GET \
         --url endpoint_url  \
         --header 'accept: application/json' \
         --header 'content-type: application/json' \
         --header 'x-ibm-client-id: ad37d0e2-4551-41f7-a011-88f0447f4560' \
         --header 'x-ibm-client-secret: yY7xL8hA0iD1tR0qD5hY0kG3rR3nC2eA3mM8iN2yL4hD2bQ2gU'
      where endpoint_url has the following value depending on whether you are using the DataPower Gateway or Micro Gateway as the gateway service:
      • DataPower Gateway onlyhttps://datapower/organization_name/sb/api/Accounts

        where organization_name is the Name value that you specified when you created the provider organization in step 2.f

      • Micro Gateway onlyhttps://microgateway/api/Accounts


댓글