Over 10 years we help companies reach their financial and branding goals. Engitech is a values-driven technology agency dedicated.

Gallery

Contacts

411 University St, Seattle, USA

contactus@lucidpath.io

+1 -800-456-478-23

GoLang
What are the top frameworks used by companies using Golang?

Guide to build Mern stack on Google Cloud Platform GKE-2022

On the digital era, the majority of enterprises and organisations host their apps in the cloud to take advantage of the vast majority of cloud-native platform benefits. In the past few years, there has been an upsurge in the demand for cloud platforms, particularly due to the COVID-19 outbreak, as the workflow is never halted for whatever reason. Therefore, it is obligatory for developers and other software engineers to understand how to construct applications for several platforms. Likewise, every mern stack developer should be familiar with the involved procedure.

Google’s cloud-based platform

It is a set of cloud computing services that operate on the same infrastructure that Google uses to execute its final products. GKE(Google Kubernetes engine) is utilised as a managed GCP Kubernetes solution for a mern stack application, allowing a mern stack developer to operate containerized apps designed using this technology on the cloud. GKE is used to assist mern stack developers in constructing and deploying applications into the K8 cluster as microservices assume responsibility for security, monitoring, and maintenance, etc. This is extremely advantageous for businesses in numerous ways.

Instructions for constructing on GCP GKE:

It is a complicated four-step process, particularly for mern stack developers that are new to this industry. Even seasoned developers can encounter challenges, but they can receive assistance from experts who are knowledgeable in this technology. Prior to that, one must be familiar with Docker, Kubernetes, and web application development using this technology.

  • Creation of accounts in GCP:

To begin this adventure, you must start a new project in order to create and link multiple accounts, which is a simple but essential step. Use your existing Google account to create a billing account, or create a new one. Then, connect the account to the project in order to utilise cloud services for the project. You may change or close the account according to your needs. One can select the appropriate bundle for their business.

Then, the mern stack developer should double-check to ensure that all APIs used to operate the dataflow in GCP are enabled. The process is quick and straightforward, as step-by-step instructions are provided on the official website for those who encounter difficulties. Then, obtain the most recent version of Google SDK. Create a service account that enables the developer to run the mern stack web application from a local machine, and then launch the GCP dataflow pipeline with the appropriate permissions. Once the account has been formed, a key must be generated and a set variable entitled Google Application Credentials must be downloaded.

Syntax:

users/bhargavbachina/gcp-credentials/gcp-dataflow-service-account.json”

Use the command below to log in to your GCP account.

Gcloud authentication login.

  • Install gcloud CLI and configure the following:

Installing and configuring cloud CLI is the next step (Command Line Interface). To avoid installation errors when installing gcloud CLI on a system, a mern stack developer might consult Google’s official website for documentation. Before using the GCI tool, it must be initialised. The Google SDK is required for initialization. The following commands can help you accomplish this.

/ initialising

the gcloud init

/ authentication login

Gcloud Authentication Login

Once the command is completed, the developer is led to the GCP login page where they enter their credentials. After logging in successfully, the developer must enter the following command to setup it.

gcloud config set project brain fuel-test (where lucidpath -test is the project name).

  • MongoDB Atlas configuration:

Once the project is established, the mern stack developer must configure the fully managed cloud database MongoDB Atlas. Create a Gmail account in order to continue. Then, create clusters using the dashboard’s displayed data. But make sure you select GCP. Then, join the cluster by clicking the connect button. Provide the relevant information. The developer can select between the following three options.

  1. Connect to the MongoShell server.
  2. Connect your primary application stack.
  3. Connect with compass for MongoDB.

After creating the cluster, the following step is to construct the database by clicking the collections button presented on the screen. Then, select the “Add My Data” button to provide the necessary project-related information. After creating the database, you can insert data using the insert command. The final step involves connecting the database to MongoDB Compass. Use the command below:

mongodb+srv:/admin123:admin123@brain-fuel-cluster.zpikr.mongodb.net/?retryWrites=true&w=majority (where admin123 are credentialed, brain-fuel-cluster is Database name) (where admin123 are credentialed, brain-fuel-cluster is Database name).

  • Construction of Mern Stack for production:

There are numerous approaches to construct a production mern stack, depending on the project and business requirements.

  • Manual Application

Command used to construct is

/ move directory to UI

cd UI

/ develop the app

npm run build

This command builds all static and build assets of a project in the build directory.

  • Applying Webpack

To build using this way, instal webpack using the command below:

/ setup web pack

npm instal —group webpack —group webpack-CLI

npm instal webpack -save webpack-cli

Next, you can construct the project.

  • Packaging with gulp:

This is an automated method for creating superior applications. Use the following command to instal gulp, then continue:

/ instal gulp globally

npm instal gulp -g

/ instal as a dev dependency

npm instal gulp gulp-zip fancy-log remove webpack-stream —save-developer

Docker can be used to develop mern stack applications. The next step is to deploy the application on GCP GKE, which will be covered in the subsequent post.

Regarding Us:

Lucidpath is a comprehensive mern-stack development platform. The majority of businesses rely on the knowledge of our skilled mern stack developers to properly implement this technology.

 

Author

Adarsh Suresh

Leave a comment

Your email address will not be published. Required fields are marked *