- DevOps for Serverless Applications
- Shashikant Bangera
- 342字
- 2021-07-16 17:35:37
Setting up Jenkins for a serverless application
Assuming that we already have Jenkins up and running, we need to install Node.js, and then we need to install Mocha on the Jenkins server for unit testing. After this, we need to install a serverless framework. You can use the Dockerfile (https://github.com/shzshi/aws-lambda-dynamodb-mytasks/blob/master/Dockerfile) from the aforementioned GitHub repository for Jenkins and serverless frameworks. If you are using Docker, you don't need to follow the steps for installing Node.js on Jenkins.
Go through the following steps to install Node.js on the Jenkins node:
$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
$ sudo apt-get install -y nodejs
$ sudo npm install -g serverless
Then go to the browser and open the Jenkins home page. Click on the New item link. This will open a new page, that will allow you to create a job with a name of your choosing. Select Freestyle project, which is the default selection, and click OK to go ahead, as shown in the following screenshot:

Now, we need to integrate Git source code with Jenkins and then build, deploy, and test our serverless application. First, let's add the Git repository to the Jenkins job, as shown in the following screenshot:

We need to parameterize the build to add AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, as shown in the following screenshot. We will get AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY after we create an IAM user for the Serverless Framework to work:

Now go to Build |Add build step | Execute shell | Execute build step | Add build step from the drop-down menu, which will open Command Prompt, where we will add the command that we need to run, as shown in the following screenshot:

Once the build is successful, we will have successfully deployed the application to the AWS S3 bucket that was created by Serverless Framework. We will also have exposed the API and the functions, allowing them to be used by the application to perform CRUD functions, as shown in the following screenshot:

- Linux系統(tǒng)架構(gòu)與運維實戰(zhàn)
- WordPress Mobile Web Development:Beginner's Guide
- RESS Essentials
- 深入理解eBPF與可觀測性
- 嵌入式Linux應(yīng)用開發(fā)菜鳥進階
- 突破平面3ds Max動畫設(shè)計與制作
- OpenStack系統(tǒng)架構(gòu)設(shè)計實戰(zhàn)
- 計算機系統(tǒng)的自主設(shè)計
- Windows 7使用詳解(修訂版)
- Learning BeagleBone
- Linux軟件管理平臺設(shè)計與實現(xiàn)
- UI設(shè)計手繪表現(xiàn)從入門到精通
- Hadoop Real-World Solutions Cookbook
- Drupal 7 Cookbook
- Learning Continuous Integration with Jenkins(Second Edition)