Open topic with navigation

TIBCO ActiveMatrix® Service Grid - Container Edition 1.0.0

# Build and Run Bookstore Application Image

After you have generated the Bookstore application configuration YAML file from application DAA, you can build the Bookstore application Docker image. In this tutorial, you will build the Bookstore application Docker image and run it in the Docker or Kubernetes.

Procedure
1. Navigate to amsgce-runtime-<version>/runtime/build.

2. To build the bookstore application Docker image, run the following command. Specify the location of the folder or the `.zip` file that contains the YAML file, DAA, and optionally, the Log4j and JVM configuration files by using `--app_location` argument. To check the options you can specify when running the command, run the following command:

       ./build_amxce.sh --help

       ./build_amxce.sh --image_tag bookstore:1.0 --app_location amsgce-runtime-<version>/samples/bookstore/deployment/com.tibco.restbt.sample.bookstore.zip

3. Execute the `docker run` command on the machine where you have created the application Docker image.

       docker run -d -p 7777:7777 --name bookstore bookstore:1.0

   The external port must be a port number that is used at the time of resource template creation. If you want to map a different port other than the port used for the YAML file, you can specify it when running the docker run command. If there are two HTTP connectors in the DAA, then while creating the container, you need to specify both the ports.

4. Check whether the container is created or not by running the following command:

       docker ps

5. Access the application from `http://<hostname>:7777/bookstore/books`. Here, port must be the port you mapped when running the container.

## Running Bookstore Application in Kubernetes

After you have built the Bookstore application Docker image, you can deploy the application in Kubernetes.

1. Create a Kubernetes deployment YAML file that is required to deploy an application. Sample YAML file is at `amsgce-runtime-<version>\samples\bookstore\deployment\bookstore-deployment.yaml`. Ensure that the Kubernetes deployment file contains correct application image name and port.

2. Run the `apply` command of `kubectl` utility to deploy an application to Kubernetes.

       kubectl apply -f bookstore-deployment.yaml

3. Access this application at `http://<hostname>:31090/bookstore/books`.

What to do next

Bookstore application is now running in the Kubernetes. You can monitor the status of the running application and troubleshoot by using the Application Monitor. In the next step you will build and run the Application Monitor.

Copyright © 2020-2021. TIBCO Software Inc. All Rights Reserved.