<?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>Forem: Udhay</title>
    <description>The latest articles on Forem by Udhay (@askudhay).</description>
    <link>https://forem.com/askudhay</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%2F264189%2F5521d630-70b3-491b-af8f-4fc24eab168d.jpg</url>
      <title>Forem: Udhay</title>
      <link>https://forem.com/askudhay</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/askudhay"/>
    <language>en</language>
    <item>
      <title>Step by step guide to deploy 🅰ngular app to Google App Engine ⛅️⚡️</title>
      <dc:creator>Udhay</dc:creator>
      <pubDate>Thu, 19 Mar 2020 18:52:38 +0000</pubDate>
      <link>https://forem.com/askudhay/step-by-step-guide-to-deploy-ngular-app-to-google-app-engine-46hl</link>
      <guid>https://forem.com/askudhay/step-by-step-guide-to-deploy-ngular-app-to-google-app-engine-46hl</guid>
      <description>&lt;p&gt;In this post, I will quickly walk you through the steps to deploy Angular app to Google App Engine right from your machine using Google Cloud SDK.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Google App Engine?
&lt;/h1&gt;

&lt;p&gt;Google App Engine (often referred as GAE) is a platform as a service from Google Cloud for developing and hosting Web applications in Google managed data centers.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why GAE?
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Fully managed serverless application platform.&lt;/li&gt;
&lt;li&gt;Supports popular languages like Node, Python, PHP etc.,&lt;/li&gt;
&lt;li&gt;Just deploy code, everything else GAE takes care. &lt;/li&gt;
&lt;li&gt;Pay only for what you use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alright let's go ahead and work on the below steps to deploy Angular app to GAE. Excited?&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Create Angular app:
&lt;/h2&gt;

&lt;p&gt;You can either create new Angular app or clone the app that I developed (Pounds to Kilograms converter) 👇🏻.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/askudhay"&gt;
        askudhay
      &lt;/a&gt; / &lt;a href="https://github.com/askudhay/pounds-to-kg"&gt;
        pounds-to-kg
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
PoundsToKg&lt;/h1&gt;
&lt;p&gt;This project was generated with &lt;a href="https://github.com/angular/angular-cli"&gt;Angular CLI&lt;/a&gt; version 9.0.6.&lt;/p&gt;
&lt;h2&gt;
Development server&lt;/h2&gt;
&lt;p&gt;Run &lt;code&gt;ng serve&lt;/code&gt; for a dev server. Navigate to &lt;code&gt;http://localhost:4200/&lt;/code&gt;. The app will automatically reload if you change any of the source files.&lt;/p&gt;
&lt;h2&gt;
Code scaffolding&lt;/h2&gt;
&lt;p&gt;Run &lt;code&gt;ng generate component component-name&lt;/code&gt; to generate a new component. You can also use &lt;code&gt;ng generate directive|pipe|service|class|guard|interface|enum|module&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
Build&lt;/h2&gt;
&lt;p&gt;Run &lt;code&gt;ng build&lt;/code&gt; to build the project. The build artifacts will be stored in the &lt;code&gt;dist/&lt;/code&gt; directory. Use the &lt;code&gt;--prod&lt;/code&gt; flag for a production build.&lt;/p&gt;
&lt;h2&gt;
Running unit tests&lt;/h2&gt;
&lt;p&gt;Run &lt;code&gt;ng test&lt;/code&gt; to execute the unit tests via &lt;a href="https://karma-runner.github.io" rel="nofollow"&gt;Karma&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
Running end-to-end tests&lt;/h2&gt;
&lt;p&gt;Run &lt;code&gt;ng e2e&lt;/code&gt; to execute the end-to-end tests via &lt;a href="http://www.protractortest.org/" rel="nofollow"&gt;Protractor&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
Further help&lt;/h2&gt;
&lt;p&gt;To get more help on the Angular CLI use &lt;code&gt;ng help&lt;/code&gt; or go check out the &lt;a href="https://github.com/angular/angular-cli/blob/master/README.md"&gt;Angular CLI README&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/askudhay/pounds-to-kg"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;h2&gt;
  
  
  Step 2: Create app.yaml under the project:
&lt;/h2&gt;

&lt;p&gt;Let's create &lt;strong&gt;app.yaml&lt;/strong&gt; under the Angular project. The app.yaml file is a configuration file that let knows App Engine how to map URLs to your static files. &lt;/p&gt;

&lt;p&gt;Copy the below configuration to app.yaml you just created. It basically adds handlers that will load dist/pounds-to-kg/index.html when someone visits your website, and all static files will be stored in and called from the dist/pounds-to-kg directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
  static_files: dist/pounds-to-kg/index.html
  upload: dist/pounds-to-kg/index.html
- url: /
  static_dir: dist/pounds-to-kg

skip_files:
  - e2e/
  - node_modules/
  - src/
  - coverage
  - ^(.*/)?\..*$
  - ^(.*/)?.*\.json$
  - ^(.*/)?.*\.md$
  - ^(.*/)?.*\.yaml$
  - ^LICENSE
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Google Cloud Platform - Setup &amp;amp; Configuration
&lt;/h2&gt;

&lt;p&gt;Hope you have Google Cloud Platform account with you, otherwise create a &lt;a href="https://cloud.google.com/free/docs/gcp-free-tier"&gt;Free tier&lt;/a&gt; account and avail the Free credit worth $300. &lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3.1:
&lt;/h3&gt;

&lt;p&gt;Goto &lt;a href="https://console.cloud.google.com/"&gt;Google Cloud Platform&lt;/a&gt; console and Click on "New project".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WTkhYfRP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/idnuaao304nxcxtvqn7n.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WTkhYfRP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/idnuaao304nxcxtvqn7n.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3.2:
&lt;/h3&gt;

&lt;p&gt;Enter your Project name and Click on "Create" button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Nn3ypnVd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gf9o3s565kd0igbextea.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Nn3ypnVd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gf9o3s565kd0igbextea.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3.3:
&lt;/h3&gt;

&lt;p&gt;Create App under Google App Engine. You can either search for "App engine" in the search bar in GCP console or hit this &lt;a href="https://console.cloud.google.com/appengine/start"&gt;URL&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p9sKmsf6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/holxfg1ou416bqobmqzp.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p9sKmsf6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/holxfg1ou416bqobmqzp.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3.4:
&lt;/h3&gt;

&lt;p&gt;Choose Region, just note that Region is permanent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7azXEr----/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ombd6yk8ir6vbld1p3t9.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7azXEr----/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ombd6yk8ir6vbld1p3t9.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3.5:
&lt;/h3&gt;

&lt;p&gt;Choose language as Other (This step is optional).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cAmbYKlZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/e0sty9z39cl90nh3ap3m.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cAmbYKlZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/e0sty9z39cl90nh3ap3m.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3.6:
&lt;/h3&gt;

&lt;p&gt;All set. You have successfully created App in Google App Engine. Just note that, this app is empty and has nothing to serve.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Deploy app using Google Cloud SDK
&lt;/h2&gt;

&lt;p&gt;Before you begin with below steps, you need to download Google Cloud &lt;a href="https://cloud.google.com/sdk/"&gt;SDK&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4.1:
&lt;/h3&gt;

&lt;p&gt;Login to your Google Cloud Platform account by running below command from Command prompt / Terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gcloud auth login
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4.2:
&lt;/h3&gt;

&lt;p&gt;Once you successfully login to GCP, goto the folder where you have your Angular project and run below command.&lt;/p&gt;

&lt;p&gt;Make sure you update Project Id with the Project name you created in Step 3.2&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gcloud app deploy --project=[Project Id]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You should be able to see your App URL once the app is deployed, as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;F:\AngularHive\Code\pounds-to-kg&amp;gt;gcloud app deploy --project=ng-gae-app
Services to deploy:

descriptor:      [F:\AngularHive\Code\pounds-to-kg\app.yaml]
source:          [F:\AngularHive\Code\pounds-to-kg]
target project:  [ng-gae-app]
target service:  [default]
target version:  [20200319t142108]
target url:      [https://ng-gae-app.appspot.com]


Do you want to continue (Y/n)?  Y

Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 10 files to Google Cloud Storage               ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...done.
Setting traffic split for service [default]...done.
Deployed service [default] to [https://ng-gae-app.appspot.com]

You can stream logs from the command line by running:
  $ gcloud app logs tail -s default

To view your application in the web browser run:
  $ gcloud app browse --project=ng-gae-app

F:\AngularHive\Code\pounds-to-kg&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;Yay, app is up and running! Hit &lt;a href="https://ng-gae-app.appspot.com"&gt;https://ng-gae-app.appspot.com&lt;/a&gt;, you will be able to see Pounds-to-Kg app deployed and served from Google App Engine.&lt;/p&gt;

&lt;p&gt;Oh yeah, you made it. You learned how to deploy Angular app to GAE, it's just awesome right? Thanks for sticking around. ✌🏼😊&lt;/p&gt;

&lt;p&gt;Please share your experience of deploying your app to GAE with me in the comments below. You are also welcomed to post any questions you have related to this article!&lt;/p&gt;

&lt;p&gt;Stay tuned for more such articles coming soon. You can check my &lt;a href="https://angularhive.com"&gt;blog&lt;/a&gt; for other posts on Angular.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>gcp</category>
      <category>cloud</category>
      <category>google</category>
    </item>
  </channel>
</rss>
