Automated Web App Deployment from GitHub Push Using Alibaba Cloud EDAS


Alibaba Cloud Enterprise Distributed Application Service (EDAS) is providing PaaS platform for hosting applications and micro services with high availability, monitoring and release management capabilities. To extend the EDAS capabilities, we can build continuous integration/deployment solution using EDAS and Jenkins.


For this article, we’ll be using a web application written in Java and war build of this application is deployed in EDAS. Also, source code of this application is maintained in GitHub repository.


This tutorial can easily be understood and followed if you are familiar with the below technologies and concepts,

  • Alibaba Cloud Environment
    If you do not have access, get 1 year free access with $10 credit using the below link
    Alibaba Cloud Free Account
  • Alibaba Enterprise Distributed Application Service
    Click here to know more about EDAS
  • Jenkins
    Click here to know more about Jenkins
  • Python Programing Knowledge

Server Setup

To develop and run the complete solution demonstrated here, you will need a host server (Alibaba Cloud ECS or any other Linux Server) with Jenkins, Python 2.7 and Docker pre-installed. Alternatively, refer below links to download and install Jenkins, Python 2.7 and Docker in this host.

  • Object Storage Service (OSS)
  • Enterprise Distributed Application Service (EDAS)
  • Computing Server (ECS)

Configure OSS, ECS and EDAS

Please decide a single region (Preferably China- Beijing) for configuring all the required Alibaba cloud services before you proceed. This will help you to avoid any technical challenges of integrating multi region services.

  1. Create a new bucket in OSS console to store web application java war file, which will be deployed as EDAS application. Make sure bucket access policy is set to public read. Otherwise, EDAS instance may not be able to fetch the war file for deployment.
    Keep a note of bucket name and OSS end point. Later you’ll have to update the configuration file of this solution with bucket name and OSS end point.
  2. Create ECS Instance with minimum 1 GB memory and CentOS 7.4 OS in Alibaba cloud console. Choose region same as OSS region. Also, create a new VPC network for this host and allocate public IP.
  3. Once ECS instance is up and running, install EDAS agent after connecting to the host using VNC. Below is the command to be executed for installing agent. Please change the region part depending on the region of ECS host. In this example”e cn-beijing” is the region of our ECS.
  • wget -q -O /root/ && sh /root/ -full

Jenkins Setup

Assuming, you have already configured Linux host for running Jenkins and able to access Jenkins home page with admin privilege. Also, all the suggested plugins are installed during Jenkins initial setup. If you are struggling to get the Jenkins up and running, then refer Jenkins Install link for guidance. Also, please ensure the firewall rules are properly configured in your linux host network to allow inbound internet traffic on port 443.

  1. For easier demonstration for this tutorial, disable Jenkins security configuration. But, this is not recommended for production environment.
    Jenkins->Manage Jenkins->Configure Global Security
    Disable security as below
    (Warning: you should avoid this step for production and setup appropriate security settings to avoid unauthorized access)
  • Repository URL: username>/.git?spm=a2c41.12784539.0.0
  • Credentials: GitHub credentials
  • Script Path: Jenkinsfile
pipeline {agent {docker {image 'openkbs/jre-mvn-py3'args '-u 0 --name=mycontainer -v /home/bitnami/GitHub/webapptest/jenkins/scripts:/root/.m2'}}stages {stage('Build') {steps {sh 'mvn -B -DskipTests clean package'}}stage('Python Library Install') {steps {sh './jenkins/scripts/'}}stage('Deliver') {steps {sh './jenkins/scripts/'}}}}
-v /home/bitnami/GitHub/webapptest/jenkins/scripts:/root/.m2

GitHub Setup

Assuming, your Jenkins is up and running and can accept http/https request from external applications.

EDAS Python App Walkthrough

Below is the walkthrough of python script which will use EDAS API to deploy the java application.

AccessKeyId = <Cloud Account Access Key>AccessKeySecret = < Cloud Account Access Secret Key >Endpoint = <EDAS End points url> i.e. = <EDAS region>  i.e. cn-beijingAppId = <EDAS application id>OSSEndpoint = <OSS End Point url> i.e. oss-cn-shenzhen.aliyuncs.comOSSBucketName = <OSS Bucket Name> i.e. warfiles
# Read config.cfg and parse the configuration parametersparser = ConfigParser.ConfigParser() Assign each of the configuration parameters values to separate varaiablesaccessKeyId = parser.get("Base", "AccessKeyId")accessKeySecret = parser.get("Base", "AccessKeySecret")endpoint = parser.get("Base", "Endpoint")...return accessKeyId,accessKeySecret,endpoint,region . . .
def upload_war(warfilepath):auth = oss2.Auth(accessKeyId, accessKeySecret)bucket = oss2.Bucket(auth, ossendpoint, ossbucketname)oss2.resumable_upload(bucket, os.path.basename(warfilepath), warfilepath)warurl = "https://"+ossbucketname+"."+ossendpoint+"/"+os.path.basename(warfilepath)
def deploy(warurl):
request = CommonRequest()request.set_accept_format('json')request.set_method('POST')request.set_protocol_type('https') # https | httprequest.set_domain(endpoint)request.set_version('2017-08-01')
  • RegionId : Region where application is setup
  • AppId : application id of the EDAS application
  • PackageVersion : Unique numeric value
  • DeployType: url
  • WarUrl: OSS url of war file
  • GroupId: all
request.add_query_param('RegionId', region)request.add_query_param('AppId',appid )request.add_query_param('PackageVersion',packageversion)request.add_query_param('DeployType','url')request.add_query_param('WarUrl',warurl)request.add_query_param('GroupId','all')

Run and Test

Before demonstrating the real time deployment after committing change to Github, let’s first ensure following checks are passed.

sudo chmod 755 /var/run/docker.socksudo gpasswd -a tomcat dockernewgrp docker
  • Update edas.cfg file ./GitHub/webapptest/jenkins/scripts
  • Update ./GitHub/webapptest/Jenkinsfile file with the absolute path of python scripts which is cloned in your Jenkins host.
  • Navigate to website source code folder and modify the index.jsp and then commit the changes to github repository
  • Open Jenkins pipeline project in a browser. You should see the build of the pipeline project is already started. Wait for complete execution of the project.
  • Open EDAS web url in your browser and verify the changes in the website is reflecting or not.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website: