Skip to Content
Technical Articles

How to deploy web applications to each integration test environment using CI/CD ?

【Introduction】

In this blog, I will explain about the way of deployment to each integration test environment with circleCI.
After you finish reading the blog, then you can deploy the same application to two or more integration test environments.This way may reduce your workload.

If you want to know application structure, you can see my previous blog.
Blog Link :https://blogs.sap.com/2020/03/23/how-to-deploy-web-application-automatically-using-ci-cd/

 


【IT Architecture】

I will show IT Architecture outline below.
You know GitHub is a platform for version control using Git.
CircleCI is a continuous integration/delivery tool.

 


【Topic/table of Content】

Create user accounts for GitHub and CircleCI
Create environment folders
Add new job to workflows
Run CircleCI jobs

 


【Environment】

You need to prepare Cloud Foundry environments.
Cloud Environment :Cloud Foundry environment.
PC/Service :1 PC (※ In my case, I used WindowsPC)

 


【Version】

WindowsPC Edition :Windows 10 Enterprise 2016 LTSB
CPU :Intel(R)Core(TM)i5-7300U CPU @ 2.60GHz 2.71GHz
Memory(RAM) :8.00GB

 


【1. Create user accounts for GitHub and CircleCI】

First, you need to create GitHub and CircleCI accounts.
You can know how to create these accounts in my previous SAP Blog.

Blog Link :https://blogs.sap.com/2020/03/23/how-to-deploy-web-application-automatically-using-ci-cd/
Blog Title:「How to deploy web application automatically using CircleCI ?」
⇒【1. Create user account for GitHub】
⇒【2. Create user account for CircleCI】

 


【2. Create environment folders】

Second, you need to prepare environment folders because each test environment requires different configuration files.Create env folders in your application route folder.

  1. Name these folders mapping each test environment

  2. Put a manifest.xml
  3. Modify application name and host
    ---
    applications:
    - name: app_sample_ite1
      host: appsample_ite1
      memory: 512M
      env:
        destinations: >
          [
            { 
              "name":"app_sample_ite1", 
              "url":"https://appsample_ite1.cfapps.eu10.hana.ondemand.com/", 
              "forwardAuthToken": true
              }
          ]
    ​
    ---
    applications:
    - name: app_sample_ite2
      host: appsample_ite2
      memory: 512M
      env:
        destinations: >
          [
            { 
              "name":"app_sample_ite2", 
              "url":"https://appsample_ite2.cfapps.eu10.hana.ondemand.com/", 
              "forwardAuthToken": true
              }
          ]
    

 


【3. Add new job to workflows】

Next step, you open config.yml and look at workflows.
You describe new job definition in the config.yml.

  1. Define job name
  2. Describe job process
    version: 2.1
    
    orbs:
        cloudfoundry: circleci/cloudfoundry@0.1.73
    
    workflows:
        "Sample App":
            jobs:
              - build_ite1
              - build_ite2
    
    jobs:
      build_ite1:
        docker:
          - image: circleci/node:10.15.3
        steps:
          - checkout
          - run:
              name: Sample App
              command: |
                curl -v -L -o cf-cli_amd64.deb 'https://cli.run.pivotal.io/stable?release=debian64&source=github'
                sudo dpkg -i cf-cli_amd64.deb
                npm config set @sap:registry https://npm.sap.com -yes
                npm install @sap/xssec
                echo Y | sudo npm install -g -y @angular/cli
                cp env/ite1/manifest.yml ./
                cf login -a https://api.cf.eu10.hana.ondemand.com -u [Your email] -p [Your password] -o [Your organization] -s [Your space]
                cf push
      build_ite2:
        docker:
          - image: circleci/node:10.15.3
        steps:
          - checkout
          - run:
              name: Sample App
              command: |
                curl -v -L -o cf-cli_amd64.deb 'https://cli.run.pivotal.io/stable?release=debian64&source=github'
                sudo dpkg -i cf-cli_amd64.deb
                npm config set @sap:registry https://npm.sap.com -yes
                npm install @sap/xssec
                echo Y | sudo npm install -g -y @angular/cli
                cp env/ite2/manifest.yml ./
                cf login -a https://api.cf.eu10.hana.ondemand.com -u [Your email] -p [Your password] -o [Your organization] -s [Your space]
                cf push
    ​

 


【4. Run CircleCI jobs】

Finally, you run circleci jobs after you commit and push the configuration files.

  1. Add env folder and configuration files
  2. Commit and push them


  3. Access your application on the each test environments





You successfully access these apps on ITE1 and ITE2.

 


【Summary】

To sum up, you can deploy the same application to two or more integration test environments at the same time.

 


【Reference】

・「How to deploy web application automatically using CircleCI ?」
https://blogs.sap.com/2020/03/23/how-to-deploy-web-application-automatically-using-ci-cd/
・「Deploying Flask + Python web application and Linking Node web application」
https://blogs.sap.com/2019/07/21/deploying-flask-python-web-application-on-sap-cloud-platform/

 

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.