Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
yutaroshimizu
Explorer

【Introduction】


In this blog, I will explain about the way of automatic deployment with circleCI.
After you finish reading the blog, then you can know circleCI setting method.
You don't need to type some kind of cf commands as you deploy your application for SAP Cloud Platform.

 




【IT Architecture】


I will show IT Architecture outline below.
You know GitHub is a platform for version control using Git.Also, CircleCI is a continuous integration tool.You attempt to build and deploy automatically with using them.



 


【Topic/table of Content】



  1. Create user account for GitHub

  2. Create user account for CircleCI

  3. Configure CircleCI and describe jobs

  4. 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 account for GitHub】


First, you create user account for GitHub.
After that, you prepare your repository and application.

  1. Open GitHub official site
    ・「https://github.com/

  2. Create your account for GitHub

  3. Push new button on the right side screen

  4. Name your repository name

  5. Select repository type.(※ public repository or private repository)

  6. Create new repository

  7. Clone or download the repository you created

  8. Checkout the git repository on your laptop PC

  9. Commit and push your source codes
    Create 「app.js」
    const http = require('http');
    var express = require('express')
    var request = require("request")
    var app = express()

    app.get('/', function (req, res) {
    res.json({
    ret: "Hello"
    })
    })

    var server = app.listen(process.env.PORT || 9000, function () {
    console.log('Listening on port %d', server.address().port)
    })​

    Create 「manifest.yml」
    ---
    applications:
    - name: app_sample
    host: appsample
    memory: 512M
    env:
    destinations: >
    [
    {
    "name":"app_sample",
    "url":"https://appsample.cfapps.eu10.hana.ondemand.com/",
    "forwardAuthToken": true
    }
    ]



This app.js is simple and easy web application.




【2. Create user account for CircleCI】


Second, you create user account for CircleCI and setup GitHub project.

  1. Open circleCI official site
    ・「https://circleci.com/

  2. Select GitHub account

  3. Setup project


After setup project, you can choose to add a config file manually or automatically.

 




【3. Configure CircleCI and describe jobs】


Next step, you create config.yml and move it to circleci folder.
You describe jobs definition in the config.yml file.

  1. Create circleCI folder

  2. Create a config.yml file

  3. Describe circiCI jobs on your 「config.yml」
    version: 2.1

    orbs:
    cloudfoundry: circleci/cloudfoundry@0.1.73

    workflows:
    "Sample App":
    jobs:
    - build1

    jobs:
    build1:
    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
    cf login -a https://api.cf.eu10.hana.ondemand.com -u [Your email] -p [Your password] -o [Your space] -s dev
    cf push



 




【4. Run CircleCI jobs】


Finally, you run circleci jobs after you commit and push source code.

  1. Commit your source codes

  2. Push your source codes

  3. Run circleCI job

  4. Access your application on SAP Cloud Platform



Commit command is a trigger for circleCI jobs. After committing, you may need to wait several minutes.
After a few minutes, you can see web application on the SAP Cloud Platform.




【Summary】


To sum up, you can automatically deploy your application to SAP Cloud Platform without typing any cf commands.
Your development process become efficiently to save build and deployment time.

 




【Reference】


・「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/
Labels in this area