Question

Is it Premature for Me to Think in Terms of Hosting my "Toy" Webserver?

Posted April 13, 2020 337 views
Node.js

During the lockdown, I have started building a “toy” Webserver on my Windows 10 laptop, using Node and Express. It is not much past “Hello World” but I can access my pages from browsers with localhost URL’s.

I know my laptop’s IP address. It is connected to an ISP. I tried to access my site from my IPhone but it didn’t work. I know that the IP address is correct–I can access my site from a browser on my laptop using that IP address and the server’s port number (of 3000).

I would love to host my page somewhere and access it from my laptop, just to see how this is done. I don’t expect any outside users to access my site for the next several months, possibly forever. So, this will be just for testing purposes.

One of the options is to get the cheapest account from Digital Ocean.

  1. Is there a free trial period?

  2. If not, am I committing myself to a certain period of time?

  3. Can I move my project to a droplet without going through git/Github?

  4. What exactly do I get in my droplet? Can I get Windows 10 so that I can start my server there (just I do it locally)?

  5. Will I get an IP address for accessing my server?

  6. Is this all premature? Should I wait till my server is better fleshed out?

  7. My server might eventually be a place to serve my memoir. Something like WordPress will be the ideal choice. However, I am a retired programmer and Web development in itself is of interest to me. So, I have two conflicting goals: (a) Improve my Web skills (b) Get my message out to the world (so to speak).

Thanks.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
4 answers

Hi there @shakervc,

This is a great question!

I don’t think that this is a premature decision at all. In my opinion, it is going to be a great learning experience to deploy a Droplet, install the necessary and upload your website/project and also it is quite fun and sometimes challenging if you do it for the first time.

I will try to answer all of your questions:

  • Is there a free trial period? - Yes, you can sing up via this link here $100 free credit to deploy any Droplets/Servers that you would like

  • If not, am I committing myself to a certain period of time? - There are no commitments, you can delete your server at any time and you will no longer be billed for it. You are also going to be charged per the hour so you can deploy/create a server, run some tests and delete the server after that, and you would be charged only for the time that the server was up, for example, if you go for the smallest $5 Droplet, it would cost you $0.007 per hour.

  • Can I move my project to a droplet without going through git/Github? - Yes you can use SFTP to upload your project to the Droplet directly without having to upload it to GitHub first.

  • What exactly do I get in my droplet? Can I get Windows 10 so that I can start my server there (just I do it locally)? - While creating a Droplet, you can choose the operating system, currently, you can choose between various Linux and Unix distributions like Ubuntu, Debian, CentOS, FreeBSD and a lot more.

I could recommend starting with Ubuntu as it is really well supported and a bit easier. There are also great tutorials on the DigitalOcean website on how to install NodeJS and Express on Ubuntu that you could follow:

https://www.digitalocean.com/community/tutorials/how-to-install-express-a-node-js-framework-and-set-up-socket-io-on-a-vps

  • Will I get an IP address for accessing my server? - Yes, each server comes with 1 dedicated IPv4 IP address

  • Is this all premature? Should I wait till my server is better fleshed out? - I think that it is going to be nice to gain some experience with setting up your own servers, that way you would feel more comfortable with it by the time your project is ready

  • Installing WordPress on the same Droplet as your main project would not be a problem at all, you can use Nginx as a reverse proxy to serve multiple sites or projects from the same Droplet.

On another note, you are not able to access your project from your phone probably because of a few things:

  • Your Phone needs to be connected to the same network
  • You need to open port 3000 via your Windows Firewall for incoming TCP connections

If you want to access your project from the outside world, what you need to do is set up Port Forwarding via your home router, so that the traffic is forwarded from your public IP to your local network accordingly. However, if you decide to go with creating your Droplet instead, making those changes to your router would not be needed.

Hope that this helps! Good luck with your project and keep us posted with the progress!
Regards,
Bobby

by Aaron Shea
Learn how to install Express and set up Socket.io on a VPS.
  • Thanks for your great reply, Bobby.

    I have a droplet now. I did not get an SSH key for it. I am tempted to destroy my droplet and get another one, with the SSH key. I read somewhere that this is easier.

    I am really excited that I will be using my droplet.Is there a way to safeguard my SSH private key?

    By the way, I saw your reply about 2 or 3 hours ago. The delay in replying is because I was busy getting my droplet.

    Thanks, again.

    • Hi there @shakervc,

      This is great! Congratulations on creating your first Droplet and good luck with the setup!

      Regarding the Droplet creation, yes it is absolutely OK to destroy and create new Droplets, this is a great way to learn. Maybe as advice, once you have your Droplet fully configured make sure to have backups enabled so that in case that anything breaks and you are unable to get it working, you could restore to a working backup. This is a nice safety measure.

      Regarding protecting your private key on Windows, here are some general tips on how to do that:

      Change right click on the file go to Properties -> Security -> Advanced:

      • Set Owner to the key’s user
      • Remove all users, groups, and services, except for the key’s user, under Permission Entries
      • Set key’s user to Full Control
      • Set a strong passphrase so that if someone gets your Key they would still not be able to use it unless they crack the passphrase

      Regards,
      Bobby

Thanks for your reply, Bobby. More questions.

Editing after initial posting.

  1. Should I ask additional questions in this thread or start new threads?

  2. I created an Ubuntu droplet which I am able to login via PUTTY using SSH from my Windows 10 laptop. (This is the only way I can login.) I created a user called shaker and went through the motion of installing nodejs and npm. I am not sure that I did this 100% correct.In particular, I did not give shaker SSH credentials, if you understand what I mean. There were some instructions asking me to do something like this but I skipped it. I will be happy to do this during the next pass.

EDIT: I can login via Filezilla also.

  1. I am not able to login in as shaker from PUTTY.

EDIT: I am sure this has to do with shaker not having SSH access.

  1. I tried to install Filezilla but my antivirus software flagged it as having adware. I aborted this step. Should I use a different client? Do I need to load anythings on the droplet?

EDIT: I found a version of Filezilla without adware, doenloaded it, and was able to SFTP files to the droplet, logged in as root.

  1. I want to SFTP my project on Windows 10 to the droplet. What is my next step?

EDIT: This has been done.

  1. https://www.digitalocean.com/community/tutorials/how-to-use-sftp-to-securely-transfer-files-with-a-remote-server#how-to-connect-with-sftp

has commands like these:

ssh sammy@yourserveriporremote_hostname

sftp -oPort=customport sammy@yourserveriporremotehostname

Where are these entered?

EDIT:

  1. It looks like I have to give shaker SSH capability next. The above tutorial addresses this topic. Any other pointers? Thanks.

Thanks for all you help. They have been spot on.

Shaker

by Justin Ellingwood
SFTP is a secure way to transfer files between local and remote servers. Much more secure than FTP, this protocol uses an SSH tunnel to establish a connection and uses encryption to transfer files in an interactive session.

I was able to run my server from the droplet and access it from my laptop. So were a couple of friends living in different locations.

I am beyond thrilled. I have a ton of cleanup to do and am sure will have a lot of questions.

Digital Oceans is very easy to work with.

More success.

I did the prep steps listed here.

Initial Server Setup with Ubuntu 18.04

I also did the following steps to install distro stable nodejs

sudo apt update
sudo apt install nodejs
sudo apt install npm

These are described in

How To Install Node.js on Ubuntu 18.04

I then did the following:

npm install –save express
npm install –save handlebars

And voila, I was able to run my application successfully, without having to upload node_modules from my laptop.

I am again beyond thrilled.

I don’t remember installing nodejs and npm on my laptop. (I do remember installing express and handlebars.) I guess that I must have done it.

Shaker

Submit an Answer