Get $100 & deploy your app on DigitalOcean
Tags: tutorial, webdev, cloud, react
Published: 2022-03-19 12:11:42

I recently received a [DigitalOcean referral link](https://m.do.co/c/9c8f57b42bba) from a friend. So I got a whopping $100 in credit for the next six months. 

I think this is a nice way to let people try DigitalOcean services. So I will try some of them and write about my experience.

## How does it work? 
DigitalOcean explains that "_Everyone you refer gets $100 in credit over 60 days. Once they’ve spent $25 with us, you'll get $25. There is no limit to the amount of credit you can earn through referrals._".

So, feel free to use my [referral link](https://m.do.co/c/9c8f57b42bba) knowing that YOU DON'T NEED TO SPEND $25 if you don't want. In that case, I won't get any credit, but hey, sharing is caring, right?

## First look into DigitalOcean
After I signed up and verified my identity through PayPal, I landed on the following screen.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pvlqlhomffglp17ojwvg.png)

Nice and clean!
Since I just wanted to try out some services, I clicked on "Deploy a web application". 

## Deploying a web application with DigitalOcean
The next screen gets interesting
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d5et99csk949unmf56z9.png)
 
It offers several server possibilities: Node, Django Rails, PHP, Ubuntu. However, I just wanted to deploy a React app from my GitHub account, so I clicked on "Deploy your source code on App Platform".

Here we go to the next screen:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p7x8lk3vq7qmkxuw226e.png)
  
I clicked on the link to GitHub, and, as expected, they asked for access.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nldy3lzx029xhnhgay8w.png)

On the next page, **Install & Authorize DigitalOcean**, you will be asked to share all your repositories or only selected repositories. I selected one and clicked on "Install and Authorize".
Finally, you will be asked for your GitHub password to authorize the access.

Then, we go back to this:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7x9cl3egu39ch04o4ozr.png)

That is a bit strange because I just gave them access to my repo on GitHub! I would expect a page where they talk about deploying my app! Anyway, I clicked on the link to GitHub again.

### Select repo and branch 
The next page makes more sense, and I select the repo I want to deploy. The "main" branch is pre-selected. Consequently, they will deploy the code from the "main" branch.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7pk4jzb1d5jaypmpzm9q.png)

 
It is a good idea to have a "master" or "main" branch that is always ready for production e.g. deployment.

Autodeployment is also pre-selected. This means that if you push some new code to the main branch DigitalOcean will automatically deploy it for you. This is a simple example of [CI/CD](https://en.wikipedia.org/wiki/CI/CD).

It is great as long as you use a good branching model and don't push breaking changes to your "master" or "main" branch.

Once everything is setup, click on the Next button.

### Configure your app
Since I am deploying a [React application](https://www.vitainbeta.org/2021/03/22/learn-react-from-scratch-setup-first-react-app-running/) DigitalOcean detects Node.js. In fact, React renders on the server using Node.

The next screen is the following:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2bolu4a7hvo2zet0wsil.png)
 

I trust DigitalOcean in doing a good job with the configuration and I click on the Next button.

On the next screen, you can select a name for your app. Furthermore, you can select a region where to deploy your app. Apparently, Amsterdam is the nearest region to my location so I won't change it.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1icymxm99pvnkgryoifp.png)

There could be more regions but the selection is not bad. Europe and North America are covered well. India has Bangalore and for the rest of Asia, there is Singapore.

I click on next and I get to the next page.
### Money money money

The default proposal would cost me $24.00 per month which is crazy since I just want to try out this service! 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzvkrdcb6ooa3ugzmxeg.png)

Interestingly enough, **I cannot choose the "Starter" option!** DigitalOcean, what are you doing??? Surely, I didn't deploy three Starter apps.

Let me know if you can choose that in the comments, please!
So, I am left with the $5 per month option. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8cfyi8sccc4u6xg40an3.png)

I want to believe there is some other way, and I will look for it. However, so far, I have no choice.
Let's move forward and click on "Launch Basic App".

Depending on the size of your app, the build and deploy process in the next step can take more or less time.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hw0dka5bqvuplfy4ksdp.png)

Finally, you will get the possibility to [check your application live](https://quiz-app-react-on-digitalocean-hzzkp.ondigitalocean.app/) on DigitalOcean.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4chn9rhimy0gb7oc3mz6.png)

The App seems to work fine
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1zimsug8856j3f7o1bex.png)

## Plot Twist!
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qc1q5hv3dihdbghsih5x.png)

Boooooooom! 
The app breaks down as soon as I touch it! 
 
First of all, I didn't really include any error handling in my app. This is a bad practice, obviously. But I didn't think about that some years ago. A good reminder for me!

Second, the same [app is deployed on Heroku](https://quiz-app-jkrl.herokuapp.com/) and it works fine.

Now, this is unexpected!
Maybe I commited some changes after the deployment on Heroku?
I quickly checked the last significant commit in that repo. It has been made on Nov 29, 2020. 
I also checked when I deployed the app on Heroku and that is Nov 29, 2020 at 12:52 PM.

There are no commits after Nov 29, 2020 (except for something regarding the README that doesn't impact the code).

I am thinking that the app is pretty old and I should probably update it. This could be the reason why it breaks down on DigitalOcean and I will investigate this later.


## My conclusions

I like DigitalOcean interface and user experience. It seems pretty smooth even though it is the first time I am using it.

Despite a seemingly successful deployment, the app breaks down as soon as I try to use it. Most likely, this is not due to DigitalOcean. However, thanks to this, I took a look at the dashboard offered by DigitalOcean.  
The dashboard is quite nice and insightful. Probably more than other platforms.

There is much more to say. However, the elephant in the room is the pricing! I think there must be some way to deploy an app on DigitalOcean free of charge.

You can easily deploy your app free of charge on:

- [Heroku](https://www.heroku.com/)
- [Vercel](https://vercel.com/)
- [Netlify](https://www.netlify.com/) 
- [GitHub Pages](https://pages.github.com/)

and more that I don't know. 

Why is DigitalOcean proposing me a free "Starter" option that I can't select? Just don't put it there if I can't use it! Let's try to [ping them on Twitter](https://twitter.com/lorenzozar/status/1505155352928657409) and see what they say. Feel free to comment or like the tweet to grab their attention.

In the meanwhile, you can use this [referral link](https://m.do.co/c/9c8f57b42bba) to get $100 in credits on DigitalOcean. No questions asked. Enjoy!