Skip to main content

Deploying your website online on cloud for free: Part 1

In software, when something is painful, the way to reduce the pain is to do it more frequently, not less. ― David Farley 
Namaste Developers,
Deployment for learning purposes can sometimes be a tedious task. It was for me as a student because of the following reasons :
  1. Unsure about what changes to make in my code in order to deploy it?
  2. Where to deploy in order to not incur charges?
  3. How to connect back-end to front-end if deployed?
  4. Once Deployed how to we access the public IP for the front end.
  5. If working on MySQL, how to have an online database for free and connect that database to my backend application?
This is a lot to take in as a new developer. You want to show case your work but you fail to do so because you are uncertain about the answers to the above questions. To answer these questions, In this blog post, I will be deploying a locally created portfolio website online. Technologies used to create this website were:
  1. Front end : Angular,HTML,CSS,Typescript.
  2. Back end : Spring Boot, Java , Hibernate
  3. Database: MySQL
  4. IDE and code editors : Eclipse(for java) and Visual Studio Code (for Angular).
Now,let us answer the first question from application perspective.

What changes to make in our code in order to deploy it?

In angular if your code is ready and running well in local machine, we just need to run the command: ng build 'project name' without quotes from terminal window inside the working directory, where your project is present. This command creates an output folder named /dist in your working directory, where your project is present. This /dist folder is used by the online platforms, wherever you will deploy to run your front-end. If you want to read more about this command, you can visit ng build command 




For java backend As our backend is built over spring boot framework, which uses maven. Maven creates a folder named Target which is the output folder for our backend. The server on which we deploy our back-end application will read our files from this folder. For database, we do not need to make any changes, but we will be changing the database address in our backend application from local to an online server where we will be hosting our database as well as change the credentials that is username and password which will be discussed in detail when we host the database. 


 

Where to deploy in order to not incur charges?

We will be making use of Heroku for back-end deployment and AWS free tier S3 bucket for front end deployment with a free online MySQL database hosting site for database deployment.

How to connect back-end to front-end if deployed?

We will be using basic networking here. We know everything in internet communicates to each other based on IP addresses. So in our application, wherever we are communicating among front-end and back-end or back-end and database server. We will replace those addresses from localhost to the IP addresses/DNS address of the servers we are deploying our application i.e. front-end and back-end in. Basically we just need to find the piece of code where we are making a call to the backend and change the address from local to the deployed system's DNS or IP address. Simple! Isn't it?
Last two questions will be answered as we deploy our website online in the next blog.
Stay Home Stay Safe !

Comments

Popular posts from this blog

My Quarantine "Efforts"

A true relationship is two imperfect people refusing to give up on each other. – Them This blog is on relationships and of course a bit of coding, otherwise it would be stupid to put it here anyways. My girlfriend and I have been having some issues lately regarding the term "Efforts". Now when I put it in front of any of my friends, They have the same reply "Efforts" and when asked what efforts are? … Nothing. I get a supposedly deep answer - Efforts come from within. What does that even mean?. So I tried some stuff to get a response from her. Well for some context we came in relationship on 28 february,2020 and guess when the lockdown started in India. Don't guess, you may as well google it. It was not even a month before the lockdown began and we flew back home. She lives more than 1500km from my state. But you know sometime you just meet the right person and you just know. We knew we had to fight this as we had so much left to say to each ot...

Developing an app with react native and firebase - firestore - Part 1

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. –John F. Woods Let's face it, we are two years into work from home, quarantined from the outside and this makes me wonder that how lucky I am as an engineer to be able to have so many domains open for me to work on, with which I could eventually make money, help others. In other words, it gives me the power to bring a change. I just can't think of a problem where technology cannot help. As soon as I find a problem in minutes my mind starts to work on how it can be solved technically. I think this development is what our college provides us with, to open our technical aspects. Today, I will be talking about react-native and firestore, making app development a little painless and fast. If we are looking to solve a simple everyday problem and want an app to do it for us, an app that is not very complex - react native is the way to go. So,...

What The Hell Is gRPC?

Time is the longest distance between two places. ― Tennessee Williams  If you are a software engineer and you work on websites or any other software which is in high demand by your consumer, but you see that some parts of your application say the products page gets higher demand than any other services you provide at some point of time or let's say you want to loosely couple your application for your application to be developed more easily and flexibly.  These are a few use cases, there are many more. We are seeing a trend in the industry getting more aligned toward following microservices patterns while building the application. The When, Why, Where, and How parts of microservices can be easily found on the internet.  Here I want to talk more about some new technologies which have become an integral part when we talk about microservices. So this blog would be more fruitful for people who know the  When, Why, Where, and How  parts. Today, I will talk a...