docker

Part 3: How to create a Droplet VM with SSH on Digital Ocean

Anebula is reader-supported. When you buy through links on our site, we may earn an affiliate commission.

This guide is part of the How to host multiple sites on one virtual machine with Docker series where you learn how to create a virtual machine (VM) that is home to multiple websites and apps. In this series, we will host a WordPress blog, a Ghost blog, a Matamo Analytics app, and a lot more!

Disclaimer: I am not affiliated with Digital Ocean in any way and I don’t profit from sign-up links or anything like that – I’m simply a happy customer that has been using them since July 2016.

Up to this point, we have purchased a domain and set up the domain with Cloudflare DNS, but we don’t actually have a working virtual machine (VM) yet. This post will cover how to set up and connect to the VM.

Now there’s no shortage of VM providers out there, you could even host your sites from a computer at home or at your office – I chose Digital Ocean because it offers the perfect balance of features, convenience, and cost. For a startup, a small business, or an individual who needs to get something launched quickly, you won’t have to deal with sophisticated firewall rules and access permissions that AWS, Azure, or GCP offers. With Digital Ocean, you get the basics with plenty of customizability, without the overly complicated setting and options.

Part 1: Sign up with Digital Ocean

Head over to https://www.digitalocean.com/ and sign up. Signing up is free.

Part 2a: Create Droplet

A “Droplet” is Digital Ocean’s name for a VM. Let’s create a Droplet that will run Docker.

On the logged-in home, click on Create, then Droplet

On the create Droplets page select region – pick a region that is closest to your customers. I’m not exactly sure where my blog visitors will come from so I’ll just select New York as this area is close to me.

Datacenter you can leave with the default value.

On the choose an image section, click on the Marketplace tab, then select Docker on Ubuntu. Keep in mind that you could be looking at a newer version when following these instructions so the Docker version doesn’t need to match exactly what I have on the image below.

Next, select Droplet Type: Basic

For CPU options, I did some research and found multiple sources showing that the Premium AMD CPUs with NVMe SSD has the edge over the Premium Intel CPUs. I recommend starting with the $14/mo AMD CPU. Keep in mind that the charge is calculated by the hour. So if you launch the CPU today and kill it tomorrow in 24 hours then you would be charged $0.021/hour x 24 hours = $0.504. If I’m testing different CPU options I typically set reminders to make sure I come back to kill the VMs so that I don’t continue to get charged.

For the authentication method, I suggest creating a new SSH on your computer and then importing the public key into Digital Ocean.

Part 2b: Generate an SSH Key

On Windows, we’ll need to take a step aside and download PuttyGen so that we can create our SSH Keys.

Go to the official Putty download site https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Part of these instructions can also be found on the Digital Ocean Blog.

Download and run the Putty x64 MSI Installer.

Launch PuTTYGen from the Windows Start Menu

Leave the default values and click Generate, then move the mouse around within the PuTTYgen window.

Type in a good password into the Key Passphrase and click Save. I recommend 50 characters minimum, with upper/lower letters, numbers, and symbols. Save it somewhere convenient for now, you can always move it.

Now let’s create an OpenSSH version of the private key so that Visual Studio Code can use it.

Go to Conversion > Export OpenSSH Key

Give it a name like “dropletopenssh” and click Save, there is no need for an extension.

At this point, I would recommend saving both files to your password manager (Keeper, LastPass, 1Password), and also save your password. These files along with the password are your way into the VM.

Step 2c: Continue Creating the Droplet Virtual Machine

Continue in Digital Ocean

Choose Authentication Method: SSH Key, then click New SSH Key

From PuTTYgen, copy the public key and paste it into Digital Ocean, then give it a name like “droplet”.

Improved metrics monitoring and alerting is really useful – enable. We will use this to gauge performance on our VM.

Backups are not required, but I would consider them to be a no brainer, especially for production environments

IPv6 is free and is an improvement over IPv4, enable.

Then Save

Part 3: Review the newly created VM and copy the IPv4

We are almost done with Digital Ocean. Click on the new Droplet Virtual Machine that was created so check out the details.

Notice the performance charts and the options on the left. click through them so that you can see what’s available.

Finally, write down your IPv4 – we’ll need this so that we can connect to it.

That’s it! Now we can move on to setting up Visual Studio Code so that we can connect to the VM.

Continue to Part 4: How to connect a Virtual Machine to Visual Studio Code

Michael

Recent Posts

Docker Compose Stack for Home Assistant with Grafana and InfluxDB

Documentation on this from a Docker Compose angle is sparse, so I wanted to share…

2 months ago

Ceiling Fan Smart Wall Switch With Fan Speed and Dimming Control

My house gets hot in the summer, and while central air helps, it's not enough.…

4 months ago

Must-Have Open Source Ubuntu 24.04 & Debian 12 Applications

Nextcloud Desktop Client Usage: Sync files to Nextcloud Server The Nextcloud Desktop Client syncs to…

9 months ago

TP-Link Omada and pfSense Setup for 2023 (Updated for July 2024)

It's been two years and firve months since I upgraded to TP-LInk Omada and pfSense.…

2 years ago

Part 6: How to set up multiple WordPress sites on Docker

This guide is part of the How to host multiple sites on one virtual machine…

2 years ago

Part 5: How to set up NGINX Proxy Manager using Docker Compose

This guide is part of the How to host multiple sites on one virtual machine…

2 years ago