<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Afzaal Ahmad Zeeshan</title>
    <description>The latest articles on DEV Community by Afzaal Ahmad Zeeshan (@afzaalahmadzeeshan).</description>
    <link>https://dev.to/afzaalahmadzeeshan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F243150%2Fc0322e28-aabe-4297-8ef6-848f8bd687c9.jpeg</url>
      <title>DEV Community: Afzaal Ahmad Zeeshan</title>
      <link>https://dev.to/afzaalahmadzeeshan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/afzaalahmadzeeshan"/>
    <language>en</language>
    <item>
      <title>Funcraft: Alibaba Cloud Function Compute Development Kit</title>
      <dc:creator>Afzaal Ahmad Zeeshan</dc:creator>
      <pubDate>Tue, 30 Nov 2021 09:21:18 +0000</pubDate>
      <link>https://dev.to/afzaalahmadzeeshan/funcraft-alibaba-cloud-function-compute-development-kit-fa6</link>
      <guid>https://dev.to/afzaalahmadzeeshan/funcraft-alibaba-cloud-function-compute-development-kit-fa6</guid>
      <description>&lt;p&gt;Almost every cloud platform offers their own unique development kits. Alibaba Cloud provides several options to develop and deploy the serverless workloads. In the past, I have mainly used the in-portal deployment options; for the smaller functions I even write the code in-line. As the project grows and becomes cumbersome, it's better to find an SDK that offers a proper development environment. An IDE, if you may. &lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/alibaba/funcraft/blob/master/README-en.md"&gt;Funcraft by Alibaba Cloud&lt;/a&gt; is a free and open source SDK that you can use to develop the functions and test them locally on your device. All you would need to &lt;a href="https://github.com/alibaba/funcraft/blob/master/docs/usage/installation.md"&gt;install&lt;/a&gt; is Docker and the &lt;a href="https://www.npmjs.com/package/@alicloud/fun"&gt;Funcraft (@alicloud/fun)&lt;/a&gt; package from NPM repositories. The Docker engine is needed to run and debug the functions locally. If you do not wish to run the serverless on your machine, then you won't require this. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Installation of Docker is simple, and takes only a few minutes. Alibaba Cloud provides the &lt;a href="https://github.com/alibaba/funcraft/blob/master/docs/usage/installation.md#install-docker"&gt;documentation&lt;/a&gt; using which you can deploy Docker on your own machine for development purposes. Plus, it saves a lot of costs from your Alibaba Cloud budget. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  First Function
&lt;/h2&gt;

&lt;p&gt;Once you have the Funcraft set up, I recommend using the &lt;a href="https://www.alibabacloud.com/help/doc-detail/126086.htm"&gt;Alibaba Cloud Serverless extension&lt;/a&gt; for Visual Studio Code. This extension contains several support and utility methods that you can use to create, develop, debug and deploy the serverless instances. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can use the &lt;a href="https://www.alibabacloud.com/help/doc-detail/53045.htm"&gt;credentials&lt;/a&gt; from your Alibaba Cloud Account Management to setup the Funcraft as well as the Alibaba Cloud CLI. You would need to use this to deploy the functions on the cloud platform. VS Code would use the RAM accounts from Alibaba Cloud.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can perform several operations using the VS Code extension:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Preview all the resources and their regions.&lt;/li&gt;
&lt;li&gt;Edit the resources.&lt;/li&gt;
&lt;li&gt;Create new resources (serverless, for example) in the regions you want to create them.&lt;/li&gt;
&lt;li&gt;Run and debug the resources as needed.&lt;/li&gt;
&lt;li&gt;Get support (such as autocomplete, etc.) based on the runtime/framework selected.&lt;/li&gt;
&lt;li&gt;Deploy the resources to the cloud.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;On top of this, since the extension is closely integrated with the VS Code, you receive language autocompletion and syntax highlights and formatting too. &lt;/p&gt;

&lt;p&gt;The extension creates the serverless in your local machine. Since it is a file in a folder, you can version control the serverless as well. &lt;/p&gt;

&lt;h2&gt;
  
  
  Deployment
&lt;/h2&gt;

&lt;p&gt;From Visual Studio Code, you can deploy the serverless instances directly to the cloud. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Have you configured the credentials already? Select &lt;strong&gt;Bind New Account&lt;/strong&gt; under &lt;strong&gt;Remote Resources&lt;/strong&gt; tab to link your Alibaba Cloud to the extension.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To deploy, just click on the Deploy button in the &lt;strong&gt;Local Resources&lt;/strong&gt; tab, this should deploy the services and functions (a service contains functions, for more on this, please check the &lt;a href="https://www.alibabacloud.com/help/product/50980.htm"&gt;Alibaba Cloud documentation&lt;/a&gt;)&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In short, the Alibaba Cloud Serverless extension and the Funcraft are a very easy way to develop and deploy enterprise grade serverless resources. Both the products are free and open source, and you can try our the Alibaba Cloud Function Compute product free of cost (&lt;a href="https://www.alibabacloud.com/help/doc-detail/54301.htm"&gt;for development purposes&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;That's about it for this one, I hope you learned something new about Alibaba Cloud Function Compute. :)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Host WordPress on Alibaba Cloud for Free</title>
      <dc:creator>Afzaal Ahmad Zeeshan</dc:creator>
      <pubDate>Sun, 28 Nov 2021 22:54:26 +0000</pubDate>
      <link>https://dev.to/afzaalahmadzeeshan/host-wordpress-on-alibaba-cloud-for-free-2g7f</link>
      <guid>https://dev.to/afzaalahmadzeeshan/host-wordpress-on-alibaba-cloud-for-free-2g7f</guid>
      <description>&lt;p&gt;Alibaba Cloud is offering a few campaigns that allow you to host your websites on the cloud — accessible to your customers in China as well — for very low rates. &lt;/p&gt;

&lt;p&gt;The campaign is offering a lot of services in the web development and ecommerce domain; &lt;a href="https://www.alibabacloud.com/campaign/website-building"&gt;https://www.alibabacloud.com/campaign/website-building&lt;/a&gt;. One of the most interesting offerings include the hosting of a WordPress website on a LAMP server for as little as 0 USD (&lt;em&gt;just pay for the cloud resources&lt;/em&gt;). Don't believe me, try it out &lt;a href="https://marketplace.alibabacloud.com/products/201072001/Wordpress_on_LAMP_Ubuntu_14_04_64bits_powered_by_IGS-cmjj011730.html"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  WordPress on Alibaba Cloud
&lt;/h3&gt;

&lt;p&gt;WordPress can be deployed almost on every cloud; if Google Cloud or Microsoft Azure helps, you can deploy it there. Especially, if your resources are already deployed on those clouds. Alibaba Cloud excels in providing efficient services within Mainland China and is the leading cloud platform provider for Asia region. &lt;/p&gt;

&lt;p&gt;If you wanted to try out Alibaba Cloud, this would be a good time for you to explore the services of the cloud giant and see if this can help your business. &lt;/p&gt;

&lt;p&gt;WordPress on Alibaba Cloud is a full scale offering by Alibaba Cloud, with all the underlying resources provisioned under the subscription. This service is offered by &lt;a href="https://marketplace.alibabacloud.com/store/1697396.html?spm=a3c0i.730006-56682004-201072001-cmjj011730.0.0.1bc0739asmJnPF"&gt;IGS&lt;/a&gt; a partner of Alibaba Cloud. The benefit of using this solution — as compared to a custom deployment — is that you do not have to worry about the customization of the product. The image is perfectly tailored and configured to run WordPress on Alibaba Cloud compute.&lt;/p&gt;

&lt;p&gt;IGS also provides services in Drupal, Joomla, Magento, etc. &lt;/p&gt;

</description>
      <category>cloudskills</category>
      <category>cloudnative</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Alibaba Cloud CLI - Controlling your cloud</title>
      <dc:creator>Afzaal Ahmad Zeeshan</dc:creator>
      <pubDate>Sun, 31 Oct 2021 17:04:04 +0000</pubDate>
      <link>https://dev.to/afzaalahmadzeeshan/alibaba-cloud-cli-controlling-your-cloud-4lgm</link>
      <guid>https://dev.to/afzaalahmadzeeshan/alibaba-cloud-cli-controlling-your-cloud-4lgm</guid>
      <description>&lt;p&gt;Alibaba Cloud is one of the leading cloud providers in the APAC region. It offers several automation tools out of the box — inside the Alibaba Cloud portal as well as command-line tools. In this post, we will take a look at the command-line tools (here after addressed as CLI). &lt;/p&gt;

&lt;h2&gt;
  
  
  Availability of Alibaba Cloud CLI
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://www.alibabacloud.com/help/product/29991.htm"&gt;Alibaba Cloud CLI&lt;/a&gt; is an &lt;a href="https://github.com/aliyun/aliyun-cli"&gt;open source command-line interface&lt;/a&gt; to the Alibaba Cloud servers and platform. The CLI is available on all major platforms:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Windows&lt;/li&gt;
&lt;li&gt;macOS&lt;/li&gt;
&lt;li&gt;Linux&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can run the CLI to provision new resources or manage existing ones. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can perform all the tasks from the Alibaba Cloud portal as well, but with the CLI you can automate these tasks; think of CI/CD and DevOps.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;p&gt;Alibaba Cloud CLI offers the features of Alibaba Cloud platform in your terminal, but it sometimes lags behind. Most of the latest features would first be available through the portal and then made publicly available in the CLI. &lt;/p&gt;

&lt;p&gt;You can control multiple accounts with the CLI, and work with multiple projects in the same pipeline. The CLI also provide output as expected by the admin of the cloud services. For example, you can get the output in a &lt;a href="https://www.alibabacloud.com/help/doc-detail/122111.htm?spm=a2c63.l28256.a3.17.7b52a893C6jEZ1"&gt;table format&lt;/a&gt;. Some services on Alibaba Cloud &lt;a href="https://www.alibabacloud.com/help/doc-detail/122114.htm?spm=a2c63.p38356.b99.21.34c64573rcpV0S"&gt;return the results in a long time&lt;/a&gt;, or they might mutate the results over time and that is where CLI will help you listen to updates over time and show them.&lt;/p&gt;

&lt;p&gt;You can also run &lt;a href="https://www.alibabacloud.com/help/doc-detail/110805.htm?spm=a2c63.l28256.a3.25.7b52a893C6jEZ1"&gt;Alibaba Cloud CLI in a Docker environment&lt;/a&gt;. This is helpful especially when you want to run some commands during the resource uptime. &lt;/p&gt;

&lt;p&gt;As a plus point, or for the benefit of overall development experience, Alibaba Cloud CLI also offers &lt;a href="https://www.alibabacloud.com/help/doc-detail/122038.htm?spm=a2c63.l28256.a3.12.7b52a893C6jEZ1"&gt;auto-completion for your commands&lt;/a&gt; in the bash terminals.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Alibaba Cloud CLI
&lt;/h2&gt;

&lt;p&gt;In order to use the Alibaba Cloud CLI, you would need to &lt;a href="https://www.alibabacloud.com/help/doc-detail/110341.htm?spm=a2c63.l28256.a3.9.7b52a893C6jEZ1"&gt;configure the credentials&lt;/a&gt; that the CLI will use while communicating with the servers / platform.&lt;/p&gt;

&lt;p&gt;You can start with the configure command for &lt;code&gt;aliyun&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aliyun configure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alibaba Cloud allows you to use it with RPC-like commands, as well as REST API commands. For the API commands, you can use the &lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, etc. verbs and perform the operation. For the RPC you can send the command directly to the server. &lt;/p&gt;

&lt;p&gt;For example you can use the &lt;code&gt;aliyun ecs &amp;lt;command&amp;gt;&lt;/code&gt;, such as &lt;code&gt;aliyun ecs StopInstance&lt;/code&gt;. Check the &lt;a href="https://www.alibabacloud.com/help/doc-detail/110848.htm?spm=a2c63.l28256.a3.26.7b52a893C6jEZ1"&gt;sample commands&lt;/a&gt; to learn more about this behavior. You can also use the &lt;a href="https://www.alibabacloud.com/help/doc-detail/122046.htm?spm=a2c63.l28256.a3.16.7b52a893C6jEZ1"&gt;&lt;code&gt;help&lt;/code&gt; command&lt;/a&gt; to learn more about the commands; such as &lt;code&gt;aliyun ecs help&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Well, that's pretty much it about the Alibaba Cloud CLI. Alibaba Cloud is actively developing and maintaining their CLI, and you can review their code or contribute to the code base as you like. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Fresh Design for Alibaba Cloud Portal</title>
      <dc:creator>Afzaal Ahmad Zeeshan</dc:creator>
      <pubDate>Sat, 08 Aug 2020 06:56:18 +0000</pubDate>
      <link>https://dev.to/afzaalahmadzeeshan/fresh-design-for-alibaba-cloud-portal-1ml</link>
      <guid>https://dev.to/afzaalahmadzeeshan/fresh-design-for-alibaba-cloud-portal-1ml</guid>
      <description>&lt;p&gt;I have been using Alibaba Cloud for a while now, and over the past few years, they have improved their services as well as the interfaces that they offer for the customers to use. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: This post is not about the underlying technology of Alibaba Cloud, or when to use Alibaba Cloud over other clouds. This post is about how I have seen Alibaba Cloud teams transition from a more "strict" product to an extensible product, and in this post, I will show some elements that describe this transition well.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A few things that I have experienced and learned include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Alibaba Cloud tends to keep things grouped-together; as you see in AWS and GCP.&lt;/li&gt;
&lt;li&gt;Alibaba Cloud sometimes pushes the products as they pass the QA, without spending a second on the interface; &lt;em&gt;which I have always hated about their environment&lt;/em&gt;. I think, your product showcases your theme and idea about software, if font mismatches in different frames on the same page, it shows that multiple people were involved in having the software developed and they just shipped as soon as the tests went okay.&lt;/li&gt;
&lt;li&gt;Alibaba Cloud doesn't consider the extensibility of the dashboards/pages as an important part of their overall UX/UI as they should.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I enjoy using Microsoft Azure because I can customize the experience, I can add widgets on the dashboard, I can customize the products and their look-and-feel. Alibaba Cloud did not have this feature, &lt;strong&gt;until now&lt;/strong&gt;! Here are a few changes that you will experience in the recent update.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cleaner look
&lt;/h2&gt;

&lt;p&gt;Alibaba Cloud dashboard has gotten much cleaner and less hardcoded with the values, marketing campaigns, and URL resources. On the previous Alibaba Cloud console, you could find the Alibaba Cloud Tech Share program even a year after it had been closed. Doh. Now, Alibaba Cloud offers recent news and updates on the platform for customers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hm9XvNch--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hh82fn0jn9eebz3swuqx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hm9XvNch--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hh82fn0jn9eebz3swuqx.png" alt="Alibaba Cloud showing the featuring updates on the platform"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More than that, you can also see the spotlight news from the platform, such as new training courses, certificates, etc. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TAQ7xkH8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wyb4kkq8wjknc5ym5ua8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TAQ7xkH8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wyb4kkq8wjknc5ym5ua8.png" alt="Alibaba Cloud dashboard showing the featured updates, courses and relevant marketing campaigns to the customers."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I think this gives a good dashboard experience to the customers who want to learn more on the platform as it is happening.&lt;/p&gt;

&lt;h2&gt;
  
  
  Modify the dashboard
&lt;/h2&gt;

&lt;p&gt;You can now customize the widgets that you see on the screen, which is a nice update to the portal. You do not have to see through all the details that you do not want to have on the screen. Instead, you can always configure the elements that are important to you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZFExr44O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t7hp6mywzmtsmguu8iya.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZFExr44O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t7hp6mywzmtsmguu8iya.png" alt="Customization of Alibaba Cloud dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also select from available templates based on your job, this gives you a cleaner, pre-defined set of tools that you will find handy when working on your tasks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lbTX1rUG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/okowrs82gq2gnlyrhq9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lbTX1rUG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/okowrs82gq2gnlyrhq9t.png" alt="Alibaba Cloud's predefined templates"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Contact
&lt;/h2&gt;

&lt;p&gt;These were just the prominent features that Alibaba Cloud has improved to make it easier for the customers to use the platform for their computing needs. &lt;/p&gt;

&lt;p&gt;You can always connect with Alibaba Cloud MVPs and experts to learn more about how you can make the most out of the platform. Reach out to us @ &lt;a href="https://www.alibabacloud.com/forum?spm=5176.12818093.nav-right.ditem-for.6cb212d2btUAt0"&gt;Alibaba Cloud Forum&lt;/a&gt;, and someone (maybe &lt;a href="https://www.alibabacloud.com/forum/u-6091?spm=a2c5q.11423524.0.0.2cae53ceAiNLPj"&gt;me&lt;/a&gt;) will be able to guide you better.&lt;/p&gt;

</description>
      <category>alibaba</category>
      <category>ux</category>
      <category>cloud</category>
      <category>interface</category>
    </item>
    <item>
      <title>Published "DevSecOps for .NET Core" with Apress</title>
      <dc:creator>Afzaal Ahmad Zeeshan</dc:creator>
      <pubDate>Wed, 17 Jun 2020 19:10:59 +0000</pubDate>
      <link>https://dev.to/afzaalahmadzeeshan/published-devsecops-for-net-core-with-apress-3hbo</link>
      <guid>https://dev.to/afzaalahmadzeeshan/published-devsecops-for-net-core-with-apress-3hbo</guid>
      <description>&lt;p&gt;My book &lt;strong&gt;DevSecOps for .NET Core&lt;/strong&gt; got published and is now available to be purchased. The goal of the book was to share how you can add the &lt;em&gt;security&lt;/em&gt; bit to your .NET Core applications. The core features of the book as I wrote it are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Learning how DevOps can make heavy use of security to improve the development experience.&lt;/li&gt;
&lt;li&gt;Explaining what &lt;em&gt;security&lt;/em&gt; means in the DevSecOps.

&lt;ul&gt;
&lt;li&gt;Security is for automation.&lt;/li&gt;
&lt;li&gt;Security is for compliance.&lt;/li&gt;
&lt;li&gt;Security is for quality and test.&lt;/li&gt;
&lt;li&gt;Security is for continuous feedback, reviews and improvement.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Sharing open source tools and packages that can be used to improve software development and deployment.&lt;/li&gt;
&lt;li&gt;Helping reader learn how to innovate DevOps pipelines to ensure each phase of DevOps results in utmost quality product.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ylh-X7ot--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jvaprtd9rcr1dsxv9q52.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ylh-X7ot--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jvaprtd9rcr1dsxv9q52.jpg" alt="DevSecOps for .NET Core by Afzaal Ahmad Zeeshan, published by Apress"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can get a copy of book from &lt;a href="https://www.amazon.com/DevSecOps-NET-Core-Securing-Applications-dp-1484258495/dp/1484258495"&gt;Amazon&lt;/a&gt; and &lt;a href="https://www.apress.com/gp/book/9781484258491"&gt;Apress&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>devops</category>
      <category>opensource</category>
      <category>github</category>
    </item>
    <item>
      <title>How To Host a Node.js Web App on Ubuntu 18.04 using Alibaba Cloud Simple Application Server?</title>
      <dc:creator>Afzaal Ahmad Zeeshan</dc:creator>
      <pubDate>Tue, 19 Nov 2019 22:46:03 +0000</pubDate>
      <link>https://dev.to/afzaalahmadzeeshan/how-to-host-a-node-js-web-app-on-ubuntu-18-04-using-alibaba-cloud-simple-application-server-43hm</link>
      <guid>https://dev.to/afzaalahmadzeeshan/how-to-host-a-node-js-web-app-on-ubuntu-18-04-using-alibaba-cloud-simple-application-server-43hm</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Every cloud provider supports open source stacks for web development, and Alibaba Cloud is no different in this manner. Alibaba Cloud provides hosting support for major frameworks like .NET Core, Python, Node.js, Ruby and more. Node.js is the most loved and most used web development stack for JavaScript programming language. It powers some of the most used front-end development libraries too, including React.js, Vue.js, and Angular (Angular uses NPM to distribute the Angular CLI). Several community-driven and developer-friendly web development runtimes/frameworks have shown up in the last few years, including &lt;a href="https://expressjs.com/"&gt;Express.js&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;In this article, we will walk you through the deployment and hosting of a Node.js based web application on the Linux environment. &lt;/p&gt;

&lt;p&gt;The source code used in this article is available on &lt;a href="https://github.com/afzaal-ahmad-zeeshan/nodejs-dockerized"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;This article will cover the deployment and hosting aspects of Node.js, so you will need to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Know the basics of Node.js web development. Node.js is very easy to learn and get started with, you can read &lt;a href="https://www.codeproject.com/Articles/1240084/Efficiently-Dockerize-Platform-Agnostic-apps-with"&gt;this article&lt;/a&gt; to get to know the basics of Node.js. &lt;/li&gt;
&lt;li&gt;Know the basics of the &lt;code&gt;git&lt;/code&gt; version control system and its command-line interface. This article uses beginner level &lt;code&gt;git&lt;/code&gt; commands only.&lt;/li&gt;
&lt;li&gt;Set up an Alibaba Cloud account to create a hosting service for the Simple Application Server.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can create a &lt;a href="https://www.alibabacloud.com/referral?referralCode=n10xs5"&gt;free account with Alibaba Cloud&lt;/a&gt; with $20 free credit and create your web server. You can also use a local virtual machine if you find it helpful.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Next sections assume that you have a Node.js web application. You can use the code for the Node.js app from the GitHub link provided above.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Simple Application Server by Alibaba Cloud
&lt;/h3&gt;

&lt;p&gt;Alibaba Cloud provides multiple services to customers for hosting purposes. Ranging from ECS to Scalable Kubernetes services, customers can decide how to deploy their applications. Simple Application Server is a managed ECS service by Alibaba Cloud. It offers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Managed ECS instances in a cheap package.&lt;/li&gt;
&lt;li&gt;One-click deployment for open-source products; WordPress, Drupal, and more.&lt;/li&gt;
&lt;li&gt;Custom domains and SSL certificates.&lt;/li&gt;
&lt;li&gt;Web firewall rules to prevent unauthorized access.&lt;/li&gt;
&lt;li&gt;Service backups and restoration.&lt;/li&gt;
&lt;li&gt;In-browser VM access software; Rescue Connect.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These options make this service a suitable candidate for hosting needs. Simple Application Server supports virtual machines in all major Linux distros and Windows Server 2008, and 2016 editions (&lt;em&gt;at the time of this authoring, and it might change in future&lt;/em&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1 — Creating a Deployment Environment
&lt;/h2&gt;

&lt;p&gt;We recommend using the Ubuntu LTS image for the hosting environments as they provide a stable environment, and major web runtimes support them. To create a new instance, go to &lt;a href="https://swas.console.aliyun.com/"&gt;Simple Application Server&lt;/a&gt; on Alibaba Cloud. You can search for Simple Application Server on the main page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vRXt2imK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7xfxa9czekwpdn1uffoi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vRXt2imK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7xfxa9czekwpdn1uffoi.png" alt="Simple Application Server on the main page of Alibaba Cloud."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also visit the service directly using the link we provided above. Depending upon your orders you might find your resources listed on the page or an empty page. We have created a few virtual machines, so we are provided with two virtual machines.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z9hqt5kX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/b257h489i7i09j0e5b19.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z9hqt5kX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/b257h489i7i09j0e5b19.png" alt="2 virtual machines listed on Simple Application Server on Alibaba Cloud portal."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding a Service Subscription
&lt;/h3&gt;

&lt;p&gt;You can create a new instance using the "Create Server" button in the top right corner of the page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_iRWRnHr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/zc3qkfy9esfwfbn6bbpk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_iRWRnHr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/zc3qkfy9esfwfbn6bbpk.png" alt='"Create Server" button in Simple Application Server service.'&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on this button to visit the service purchase page. This page will show a list of all services and products. You can create an application using open-sourced products, such as WordPress.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6ziXI1mM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/fsvuv0iw8ca6beit9f32.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6ziXI1mM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/fsvuv0iw8ca6beit9f32.png" alt="Creating a WordPress app on Alibaba Cloud"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also create a vanilla virtual machine using OS images, such as Windows Server or Linux distros. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aYwY5Nl5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0sv2deetlibgexqja517.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aYwY5Nl5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0sv2deetlibgexqja517.png" alt="Vanilla VMs on Simple Application Server."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select a Ubuntu 18.04 image for your service. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;At the time of this authoring Ubuntu 18.04 is the LTS release. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the next step, you should select the instance size for your machine. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SL5P5G-N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/s718vi1imr36gpjzbpiy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SL5P5G-N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/s718vi1imr36gpjzbpiy.png" alt="Instance sizes for virtual machines."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For development/testing purposes, you can use a 1 vCPU and 1 GB RAM instance. For production environments, we recommend using at least 2 vCPU and 8 GB RAM for optimal performance. Your virtual machine contains a data disk where the data does not persist. You should consider adding an extra data disk to your subscription. This extra data disk will help your applications persist the data in case of a crash or a reboot. After this, you can place the order, and Alibaba Cloud will create a new resource for you.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Linux machines are half the prices compared to Windows machines and provide better performance on Node.js and .NET Core instances.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you want to use a virtual machine, then you can visit this link and learn &lt;a href="https://itsfoss.com/install-linux-in-virtualbox/"&gt;How To Install Ubuntu Using VirtualBox On Windows 10&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2 — Setting up Deployment Environment
&lt;/h2&gt;

&lt;p&gt;After you have created the deployment environment, you need to install the required packages to host a Node.js application. On a fresh machine, you will need to use the &lt;code&gt;git&lt;/code&gt; version control to get your source code from a remote repository. First, connect to the virtual machine instance using Rescue Connect service inside the portal or via SSH.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MTBzRtRT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ehq75zfwv1zhfue4t0m9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MTBzRtRT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ehq75zfwv1zhfue4t0m9.png" alt="Connections to the virtual machine using SSH"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can use the "Set password" to reset the password for your SSH account. Then you can use any SSH client to connect to the virtual machine. &lt;a href="https://www.putty.org/"&gt;PuTTY&lt;/a&gt; is one of such clients that are widely used. You can learn how to use PuTTY from &lt;a href="https://www.ssh.com/ssh/putty/windows/"&gt;this link&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Once you have established the connection, SSH will show you this screen on PuTTY — or your favorite SSH client. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Cjucv8GU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/qwp5qr82aq3jdau0kxyb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Cjucv8GU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/qwp5qr82aq3jdau0kxyb.png" alt="PuTTY main page for Ubuntu 18.04"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First of all, we need to refresh the repositories that Ubuntu uses for our packages and applications. Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now execute the following command to set up basic build SDKs on Ubuntu.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;build-essential
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command installs C++ and other native SDKs on Ubuntu. Node.js uses these SDKs to install and set up the NPM packages upon &lt;code&gt;npm install&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now we need to install &lt;code&gt;git&lt;/code&gt;, so we can fetch the source code and host it. To install, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we only need Node.js on our environment. Ubuntu 18.04 comes shipped with a repository for the Node.js package. We can just execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;nodejs npm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We also installed the NPM — Node Package Manager — that will help us in managing the Node.js packages and generate scripts to run Node.js apps. After this command, verify your Node.js and NPM package versions. Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;nodejs &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will see the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;root@iZp0w3npg0fhgu06dyhmboZ:~# nodejs &lt;span class="nt"&gt;--version&lt;/span&gt;
v8.10.0
root@iZp0w3npg0fhgu06dyhmboZ:~# npm &lt;span class="nt"&gt;--version&lt;/span&gt;
3.5.2
root@iZp0w3npg0fhgu06dyhmboZ:~#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This confirms that our hosting environment is ready to accept our Node.js web app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 — Deploying Node.js App
&lt;/h2&gt;

&lt;p&gt;There are many ways in which you can deploy a Node.js app. You can use DevOps and automation tools to create a CI/CD pipeline, or you can deploy the files directly on a server using FTP. We will not talk about any of those in this — as we have planned for more articles that will talk about automation and CI/CD. We will use &lt;code&gt;git&lt;/code&gt; CLI to fetch source code and then host it manually.&lt;/p&gt;

&lt;p&gt;Now, we can create a directory to contain our web application and host it using the &lt;code&gt;nodejs&lt;/code&gt; process. Execute the following commands to create a directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;hosting
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a directory called &lt;code&gt;hosting&lt;/code&gt; in the root of your virtual machine's file system. Enter the repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;hosting/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can copy the content of the Node.js application here. Since code is available on the Git repository, we use the &lt;code&gt;git&lt;/code&gt; command to pull the source files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git clone https://github.com/afzaal-ahmad-zeeshan/nodejs-dockerized app
Cloning into &lt;span class="s1"&gt;'app'&lt;/span&gt;...
remote: Enumerating objects: 125, &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
remote: Total 125 &lt;span class="o"&gt;(&lt;/span&gt;delta 0&lt;span class="o"&gt;)&lt;/span&gt;, reused 0 &lt;span class="o"&gt;(&lt;/span&gt;delta 0&lt;span class="o"&gt;)&lt;/span&gt;, pack-reused 125
Receiving objects: 100% &lt;span class="o"&gt;(&lt;/span&gt;125/125&lt;span class="o"&gt;)&lt;/span&gt;, 236.51 KiB | 396.00 KiB/s, &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
Resolving deltas: 100% &lt;span class="o"&gt;(&lt;/span&gt;43/43&lt;span class="o"&gt;)&lt;/span&gt;, &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will create a new directory &lt;code&gt;app&lt;/code&gt; inside the &lt;code&gt;hosting&lt;/code&gt; directory with your code. You can do &lt;code&gt;ls -la&lt;/code&gt; to get a list of files in the &lt;code&gt;app&lt;/code&gt; directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;app/
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt;
total 52
drwxr-xr-x 4 root root 4096 Nov 19 11:32 &lt;span class="nb"&gt;.&lt;/span&gt;
drwxr-xr-x 3 root root 4096 Nov 19 11:32 ..
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root  349 Nov 19 11:32 docker-compose.yml
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root   75 Nov 19 11:32 Dockerfile
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root   32 Nov 19 11:32 .dockerignore
drwxr-xr-x 8 root root 4096 Nov 19 11:32 .git
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root   32 Nov 19 11:32 .gitignore
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root 1076 Nov 19 11:32 LICENSE
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root  663 Nov 19 11:32 package.json
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root 1407 Nov 19 11:32 README.md
drwxr-xr-x 7 root root 4096 Nov 19 11:32 src
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root 4303 Nov 19 11:32 UPDATES.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can review the code for this repository on GitHub, here is the code for &lt;a href="https://github.com/afzaal-ahmad-zeeshan/nodejs-dockerized/blob/master/src/app.js"&gt;app.js&lt;/a&gt;. Our application's source code is in the &lt;code&gt;src/&lt;/code&gt; directory. The Node.js bootstrapping is done in less than 50 lines of code in the &lt;code&gt;app.js&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Server&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;Express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;bodyParser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body-parser&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// Configuration&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;view engine&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;pug&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;views&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/views&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;static&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/public&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="c1"&gt;// Body parsers are needed now.&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;bodyParser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;bodyParser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;urlencoded&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;extended&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;

&lt;span class="c1"&gt;// Log the request before passing on&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;logger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./services/logging&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;*&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;logRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Move onward and process the request in pipeline.&lt;/span&gt;
    &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Home page&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;homeRouter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./routers/home&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;homeRouter&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Songs API &lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;songsRouter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./routers/api/songs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/songs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;songsRouter&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;tasksRouter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./routers/api/tasks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/tasks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;tasksRouter&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Process information&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;processApi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./routers/api/process&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/process&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;processApi&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Catch-all&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;*&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/shared/lost&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;pageTitle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;404&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;serverConfigurations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./serverconfig&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;serverConfigurations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;serverPort&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;serverStatus&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Server listening on localhost:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;serverConfigurations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;serverPort&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;logEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;server start&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;serverStatus&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;serverStatus&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Node.js web apps run on packages, and currently, we do not have the packages on our system. We can download the packages using NPM CLI. Execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npm update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command is part of the NPM suite of commands to manage the Node.js app lifecycle. You will see a message stating which packages were downloaded and installed for you. For my case, the output was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;root@iZp0w3npg0fhgu06dyhmboZ:~/hosting/app# npm update
npm WARN deprecated core-js@2.6.10: core-js@&amp;lt;3.0 is no longer maintained and not recommended &lt;span class="k"&gt;for
&lt;/span&gt;usage due to the number of issues. Please, upgrade your dependencies to the actual version of
core-js@3.

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; core-js@2.6.10 postinstall /root/hosting/app/node_modules/core-js
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; node postinstall &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"ignore"&lt;/span&gt;

express-nodejs@1.3.1 /root/hosting/app
├── applicationinsights@1.6.0
├── body-parser@1.19.0
├── express@4.17.1
├── pug@2.0.4
└── uuid@3.3.3

npm WARN express-nodejs@1.3.1 No repository field.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This output will be different in your case, and that is fine. Once the packages are downloaded, you can run the application locally on the virtual machine. Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command executes the &lt;code&gt;start&lt;/code&gt; command from the &lt;code&gt;scripts&lt;/code&gt; section in &lt;code&gt;package.json&lt;/code&gt; file. This file is available in the root directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"express-nodejs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.3.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Sample Express based Node.js app for containerization samples and demos."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"main"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./src/app.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"test"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"echo &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Error: no test specified&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt; &amp;amp;&amp;amp; exit 1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node ./src/app.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"debug"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"export PORT=3456|| set PORT=3456&amp;amp;&amp;amp; npm start"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"applicationinsights"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"^1.0.4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"body-parser"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"^1.18.3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"express"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"^4.16.4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"pug"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"^2.0.3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"uuid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"^3.3.2"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"keywords"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"express"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"nodejs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"afzaalahmadzeeshan"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"docker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"image"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"author"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Afzaal Ahmad Zeeshan"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"license"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"MIT"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;start&lt;/code&gt; command only forwards the execution control to &lt;code&gt;node ./src/app.js&lt;/code&gt; part. This starts our web application and we are provided with a message for our server. The output of this command is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;root@iZp0w3npg0fhgu06dyhmboZ:~/hosting/app# npm start

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; express-nodejs@1.3.1 start /root/hosting/app
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; node ./src/app.js

Cannot start Application Insights&lt;span class="p"&gt;;&lt;/span&gt; either pass the value to this app or use the App Insights
default environment variable.
&lt;span class="o"&gt;[&lt;/span&gt;Event] server start: Server listening on localhost:5000..
Server listening on localhost:5000.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This output is generated by our application. You can safely ignore the warning message of "Cannot start...", as that is a helpful warning message stating that Application Insights has not been set up and also hints on how to do so. The important part of this output is the &lt;code&gt;localhost:5000&lt;/code&gt;. That is where our application is running. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you have access to the virtual machine or have a web browser in the virtual machine, you can access the web app on localhost:5000. For those on the terminal, you can use the &lt;code&gt;lynx&lt;/code&gt; tool to access the website.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Exposing Web App on the Internet
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;This section assumes that the web app is running on the virtual machine.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We can expose the website on Simple Application Server's IP address in 2 ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Modify the website and make it listen on port 80.&lt;/li&gt;
&lt;li&gt;Add a firewall rule to enable traffic on port 5000.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We will use the second option and create a firewall rule for port 5000. For option 1, you can use an environment variable &lt;code&gt;PORT&lt;/code&gt; and pass &lt;code&gt;80&lt;/code&gt; as a value — see the &lt;code&gt;debug&lt;/code&gt; script in package.json file to learn how to do that.&lt;/p&gt;

&lt;p&gt;Go to Firewall tab on your service:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7FhDKwI6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/hrb8mxycizafq796sfk4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7FhDKwI6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/hrb8mxycizafq796sfk4.png" alt="Firewall tab on Simple Application Server"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add a new rule to enable port 5000 on TCP:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j8oq5DX---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/5kv1fjhn39hhtbziazop.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j8oq5DX---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/5kv1fjhn39hhtbziazop.png" alt="Firewall rules creation on Alibaba Cloud"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you can access the resource from the internet, we can hit the web app from a browser by accessing it's IP (or hostname) on port &lt;code&gt;5000&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RQL8QNfQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3qjiex6xo1z66rosqzkt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RQL8QNfQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3qjiex6xo1z66rosqzkt.png" alt="Afzaal Ahmad Zeeshan's Node.js web app running on Google Chrome."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Port 5000 on this web site's IP address does not look production-friendly, to solve this you can use option 1 and use port 80 for your server.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Always host your website behind a firewall or a proxy. Several software-based load balancing apps can help manage service provisioning. See &lt;a href="https://www.nginx.com/"&gt;Nginx&lt;/a&gt; for example.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This brings us to the wrap for this post, first post in the Cloud and Node.js series, that was about the deployment of the Node.js app and exposing the app on the internet. We created an instance of Simple Application Server on Alibaba Cloud and set up &lt;code&gt;git&lt;/code&gt;, &lt;code&gt;nodejs&lt;/code&gt; and &lt;code&gt;npm&lt;/code&gt; for environment setup. We used GitHub based Node.js app for source code. &lt;/p&gt;

&lt;p&gt;We tested the application on the virtual machine to successfully run as a process. After that, we exposed a firewall port on Alibaba Cloud for the internet connection with the web app. &lt;/p&gt;

</description>
      <category>alibabacloud</category>
      <category>node</category>
      <category>javascript</category>
      <category>ubuntu</category>
    </item>
  </channel>
</rss>
