Skip to content

Latest commit

 

History

History
151 lines (119 loc) · 6.07 KB

build-and-run.md

File metadata and controls

151 lines (119 loc) · 6.07 KB

Build and run pet store application

This readme explains the steps to build and run the pet-store cells by your own. Follow the instruction given below to,

  1. Checkout sample
  2. Build pet-be cell
  3. Build and run pet-fe cell
  4. View the pet-store application

1. Checkout the Sample

  1. Clone the wso2-cellery/samples repository
  2. Navigate to the pet-store Sample.
    cd <SAMPLES_ROOT>/cells/pet-store
    

2. Build pet-be cell

  1. Build the pet-be cell by executing cellery build command as shown below.
$ cd pet-be
$ cellery build pet-be.bal wso2cellery/pet-be-cell:latest
Warning: Value is empty for environment variable "ORDER_HOST"
Warning: Value is empty for environment variable "CATALOG_HOST"
Warning: Value is empty for environment variable "CUSTOMER_HOST"
true
✔ Building image wso2cellery/pet-be-cell:latest
✔ Removing old Image
✔ Saving new Image to the Local Repository


✔ Successfully built cell image: wso2cellery/pet-be-cell:latest

What's next?
--------------------------------------------------------
Execute the following command to run the image:
  $ cellery run wso2cellery/pet-be-cell:latest
--------------------------------------------------------
  1. View the cell information by executing cellery view command. This will open up a new tab in the browser and shows the component and dependency details of the cell.

    $ cellery view wso2cellery/pet-be-cell:latest
    

    pet fe view

  2. Execute cellery list ingress to see the list ingress supported by the pet-be cell, and you can see only controller component is exposing the API.

    $ cellery list ingress wso2cellery/pet-be-cell:latest
      COMPONENT    INGRESS TYPE   INGRESS CONTEXT   INGRESS PORT   GLOBALLY EXPOSED
     ------------ -------------- ----------------- -------------- ------------------
      controller   HTTP           controller        80             False
    

3. Build and run pet-fe cell

  1. Build the pet-fe cell by executing the cellery build command.

    $ cd pet-fe
    $ cellery build pet-fe.bal wso2cellery/pet-fe-cell:latest
    Warning: Value is empty for environment variable "PET_STORE_CELL_URL"
    true
    ✔ Building image wso2cellery/pet-fe-cell:latest
    ✔ Removing old Image
    ✔ Saving new Image to the Local Repository
    
    
    ✔ Successfully built cell image: wso2cellery/pet-fe-cell:latest
    
    What's next?
    --------------------------------------------------------
    Execute the following command to run the image:
      $ cellery run wso2cellery/pet-fe-cell:latest
    --------------------------------------------------------
    
  2. View the inner components and cell dependency of cell wso2cellery/pet-fe-cell:latest.

    $ cellery view wso2cellery/pet-fe-cell:latest
    

    pet fe view

  3. Run the pet-fe cell with instance name pet-fe, and provide the dependent pet-be cell instance as pet-be. As we haven't started the pet-be cell instance, we'll pass -d or --start-dependencies flag with run command to start dependent cell instance if it is not available in the runtime.

    $ cellery run wso2cellery/pet-fe-cell:latest -n pet-fe -l petStoreBackend:pet-be -d
    ✔ Extracting Cell Image wso2cellery/pet-fe-cell:latest
    
    Main Instance: pet-fe
    
    ✔ Reading Cell Image wso2cellery/pet-fe-cell:latest
    ✔ Validating dependency links
    ✔ Generating dependency tree
    ✔ Validating dependency tree
    
    Instances to be Used:
    
      INSTANCE NAME          CELL IMAGE               USED INSTANCE   SHARED
     --------------- ------------------------------- --------------- --------
      pet-be          wso2cellery/pet-be-cell:latest   To be Created    -
      pet-fe          wso2cellery/pet-fe-cell:latest   To be Created    -
    
    Dependency Tree to be Used:
    
     pet-fe
       └── petStoreBackend: pet-be
    
    ? Do you wish to continue with starting above Cell instances (Y/n)?
    
    ✔ Starting instance pet-be
    ✔ Starting dependencies
    ✔ Starting main instance pet-fe
    
    
    ✔ Successfully deployed cell image: wso2cellery/pet-fe-cell:latest
    
    What's next?
    --------------------------------------------------------
    Execute the following command to list running cells:
      $ cellery list instances
    --------------------------------------------------------
    
  4. Optionally check the status of the running cell pet-fe.

    $ cellery status pet-fe
            CREATED         STATUS
     --------------------- --------
      5 minutes 3 seconds   Ready
    
    
      -COMPONENTS-
    
       NAME               STATUS
     --------- -----------------------------
      gateway   Up for 4 minutes 52 seconds
      portal    Up for 4 minutes 49 seconds
      sts       Up for 4 minutes 55 seconds
    

4. View the pet-store application

As both pet-fe and pet-be cells are up and running, now you can view the actual pet-store application by following the instructions here

What's Next?