Unleash the Power of Spheron Cloud: Seamlessly Deploy and Scale Your GO Application

Sharath MSharath M
2 min read

In this article, we will go through how you can leverage Spheron Cloud to seamlessly deploy your Golang application.

Before we begin I would like to state the prerequisites for this article they are ,

Pre-Requisites:

1) Basics of Go

2) How to Dockerize the application.

3) Docker Hub Account

Introduction:

Experience the true potential of your applications with Spheron Cloud, the simplest and most convenient way to deploy your web apps and projects onto Decentralized Cloud Storage.

Say goodbye to server management hassles and embrace the scalability and reliability of Spheron's decentralized infrastructure. With its user-friendly tools and intuitive interface, Spheron eliminates the complexity of traditional deployment processes, ensuring lightning-fast performance and optimized data delivery.

Unleash the exceptional user experiences that Spheron Cloud brings, effortlessly deploying your applications and leveraging cutting-edge technologies.

In this article i will be deploying the book-management application written in go and used Mysql as a database.

Deploy your application:

I have dockerized the application and here is how my dockerfile looks like :

FROM golang:1.17-alpine as build-env

ENV APP_NAME books-crud-api
ENV CMD_PATH main.go

COPY . $GOPATH/src/$APP_NAME
WORKDIR $GOPATH/src/$APP_NAME

RUN CGO_ENABLED=O go build -v -o /$APP_NAME $GOPATH/src/$APP_NAME/$CMD_PATH

FROM alpine:3.14

ENV APP_NAME books-crud-api

COPY --from=build-env /$APP_NAME .

EXPOSE 8000

CMD ./$APP_NAME

To Build docker image of your application run this command :

docker build -t "YOUR_IMAGE_NAME" .

Push the docker image to Docker Hub and ensure you have already created a public repository in your account.

1)To push the image firstly you need to tag your image :

docker tag “IMAGE_NAME” YOUR-USER-NAME/”REPOSITORY_NAME”

2) Now run the command :

docker push YOUR-USER-NAME/"REPOSITORY_NAME"

Once you have successfully pushed the image into your DockerHub it will be available in the Tags section.

Now After Dockerizing the application and pushing the image to DockerHub, it's time to deploy it to Spheron cloud.

NOTE: At the moment Spheron supports only public images so make sure your image is public.

Steps to Deploy your Golang application into Spheron Cloud :

  1. Signup with your github account here : https://app.spheron.network/#/login

  2. Select Compute and create your organization.

  3. Create a New Cluster.

  4. Select ‘Import from DockerHub’ and fill in the details.

  1. Select your Instance plan according to your requirements. You can also compare prices offered from other cloud providers on top.[Spheron is 95% cheap compared to other cloud providers]
  1. Now what port you have exposed for Golang while containerizing the application use that port numbers

  1. Now click on Deploy.

🎉🎉That's it you have successfully deployed your golang application in Spheron Cloud

It will take 5 minutes for you to actually use your application. Post that you can test by hitting your API endpoints.

Happy Coding !

0
Subscribe to my newsletter

Read articles from Sharath M directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sharath M
Sharath M

Sharath Computer Science Undergrad | Backend Developer | swimmer 👨‍💻 Final year Computer Science Undergrad passionate about building robust and scalable applications. Experienced in backend development and software engineering internships. 💼 Worked with tech stack including Java, Spring Boot, AWS, MySQL, PostgreSQL, Git, Maven, Agile Scrum, Node.js, MERN (MongoDB, Express.js, React.js, Node.js), and Next.js. 🔧 Basic knowledge of DevOps and Microservices gained through personal projects, eager to explore more in these domains. 🌟 Flexible and adaptive learner, always excited to acquire new technologies and keep up with the fast-paced tech industry. Let's connect and dive into the world of software development together! 🚀