how to deploy MERN app using docker compose to Google cloud platform? - google-cloud-platform

I just started exploring docker and other devOps stuffs. I am currently wokring on a website which is built with react and node js with mongodb atlas as database. For deployment I am using Google cloud platform. The frontend and backend is containerized and served using nginx. The primary goal was to run the site in a single domain, the server is proxypassed using nginx.
The issue is, this site is taking too long to load. I have used docker compose to build and run the whole app in the gcp. The app is running on a VM created on google compute engine, server location is us-canada.
Running the client part of this website on google cloud run or app engine is very fast in loading but I'm not getting why is it taking this much loading time on VM? I'm not sure what I'm doing wrong here.
my site url: www.mindschoolbd.com

Related

Containerised Web Application which connects to Relational DB

Can anyone point me in the direction of some demo code/app that I can use for a demo.
The app should have the ability to connect to a relational database and ideally be able to demonstrate the persistence of having the DB.
I.e. You can save values into the DB from the web app
I'm planning to deploy this onto AWS ECS for testing, alongside RDS.
Thanks in advance
Here is an AWS tutorial that shows how to write a Java Spring Boot Web app that is deployed to Elastic Beanstalk ( Elastic Beanstalk is an AWS service that leverages Amazon EC2 and S3 and deploys, manages and scales your web applications for you. It uses managed containers that support Node. js, Java, Ruby, Docker and more) and uses RDS to store and update data.
Creating the Amazon Relational Database Service item tracker
So most of what you are looking for is there - including how to setup the RDS instance and interact with it from a web app deployed to the cloud. If you follow this step by step (there is a lot of Java code) -- you will get this Sample Web App running on the cloud and it will teach you how to interact with RDS from a web app.
Also - this covers invoking additional services such as Simple Email Service from the web app.

What are the differences: Django, Apache, AWS

I'm studying web and confused about the concepts of Django, Apache, and AWS.
I have an experience of developing web backend with Django and AWS.
Django handled the interactions between web browser and server.
AWS enabled the clients to share the same server and data.
But, what is Apache? This wasn't considered during the development.
According to my research, Apache is web server application.
But, I can't tell the exact difference of it with AWS.
Does AWS include Apache?
Please help me make sure what Apache is. Thanks :)
Django
Django itself is web framework used for developing web applications based on python. Which is used for making development proccess more simple and easy. It provides various built in things such as Django ORM, Forms, Security, Authentication, Admin and many third party packages that are available on django packages. Which enables you to develop your application rapidly.
AWS
AWS stands for amazon web services which provides cloud applications such as computation units, cloud storage, databases, cache servers and so on. It provides computation units to deploy your web apps on. i.e EC2 intances (Elastic compute cloud). As well as it provides database such as RDS (Amazon relational database) along with S3 buckets (Amazon storage) for storing media files and serving static ones.
Apache
Apache is web server which is used to deploy web applications on production. You can setup Apache web server on you premises or let you setup in cloud platform such as Amazon EC2 instances. By defalt Django or any other web apps run on single thread which do not give better performance. Apchae web server enables you to run multiple threads/ workers to handle parallel request simultaneously.
By putting all together You can develop you application using Django framework. Than choose AWS for deployment steps. i.e EC2 instance for Apache web server setup, RDS or any other database instance and S3 bucket for storage option.
Please note that this setup may be vary upon your requirements
These are two completely different services/software. AWS (Amazon Web Services) is a cloud platform where you run applications and softwares.
Apache on the other hand is a SOFTWARE that run on servers. So, essentially you can run Apache on AWS.
That is the basic idea. AWS is a platform and Apache can run on top of AWS.
The stated goal for Django is to offer a web application framework that enables quick development and minimal code.That goal can be accomplished with a simple single-threaded web server that simply facilitates development and testing.
The goal of Apache httpd, Nginx, IIS, etc. on the other hand is to offer exceptionally scalable and performant web servers. These applications are highly configurable as all applications differ and there's no one size fits all. They also require different expertise to design, implement and maintain.

Deploying a web application for Selenium testing on AWS EC2

I have a web application that uses Selenium in backend to run few scripts when invoked by user. I want to deploy this web app on AWS.
Here are my findings so far:
I can have a windows EC2 instance created and then I can install tomcat, firefox and all the necessary stuff. Then using putty or any other client, I can deploy my war and start tomcat.
I can directly make use of Elastic Beanstalk and deploy my war file there itself but then, there is no windows EC2 available for beanstalk and I don't know how to install firefox there and make my application work.
What is the best way to achieve this and what steps should I follow. I want to install a specific firefox version to be able to make it run with my selenium scripts.
There are two separate things here:
Deployment of web application on AWS cloud
Run the selenium tests against your web application
According to me, you should first think of deploying a web application to AWS cloud. There are many ways by which you can get it deployed to AWS cloud with below services:
Spin a new AWS EC2 instance, install all required software and deploy the web application.
Use AWS elastic beanstalk service with either with tomcat or docker.
Use AWS ECS if you prefer docker
According to me, second option will be quick for you with tomcat environment option. If you select tomcat environment, then your platform will be Tomcat 8 Java 8 on 64bit Amazon Linux.
Now, here comes the second part. You can have below options for your browser environments.
Spin a new separate AWS EC2 instances with correct AMI and install your specific browsers on these instances.
If you prefer SaaS, then you can take a look at browserstack or SauceLabs for remote environment.
If you have CI(jenkins/travis/Circle CI), then make use of that infrastructure to luanch your tests with either option from the above.

Keep .NET core web app running on kestrel in production

I'm hosting a web app on an EC2 instance in AWS. I will have nginx or an ELB in front of my web server, but on the web server itself the .net core app will be running on kestrel with dotnet Mywebsite.dll, if I understand correctly.
Whats the best way to keep this process running, and to automatically restart it is something goes wrong and to automatically start it up on reboot?
I'm currently trying to use supervisor to manage it but its adding a fair bit of complexity just getting it all up and running on a Amazon AMI.
Is there not a built in mechanism? How do you run your .net core web apps on linux in prod?

Database connections with RDS not working after deploying

I have developed a Dynamic web App, which leverages Amazon RDS. Servlet talks with RDS fetches data and presents it using JSP. The process is working fine. Next, I uploaded the war file of project on AWS Elastic beanstalk. But Database connections are not working.
Could you please guide me here? Why my connection variables are not working after deploying?
I made few changes to the early deployment and now App takes forever to load.