Skip to content
This repository has been archived by the owner on Mar 2, 2021. It is now read-only.

Instructions on how to setup and build a Digital Ocean Droplet

License

Notifications You must be signed in to change notification settings

UMM-CSci-3601/droplet-setup-and-build

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

UMM CSCI 3601 Droplet Setup Instructions

Fall 2019

Summary

This document is, essentially, a short guide to setting up a "droplet" on DigitalOcean to be used as a tool for deploying simple web applications. This is by no means a comprehensive guide, and you are encouraged to reach out to classmates, faculty, and TAs (through Slack, for example) with questions.

The majority of the information here will be presented in the form of bulleted lists, because we all know none of us actually read walls of text.

These instructions assume you're in the lab. The SSH key part in particular won't likely work if you're not. If you don't get the SSH keypair stuff right, you'll probably have a pile of issues logging in to your droplet.

Most of this will happen in a terminal window, which is yet another reason to take some time to learn how to use the Unix shell.

Some terminology:

You're going to see the word "droplet" used a lot here. Digital ocean is in the business of hosting Virtual Private Servers (VPS), which they have decided to call "droplets." The term isn't terribly important, and for the most part just refers specifically to the VPSs hosted by DigitalOcean and all the features which that entails.

Step 1: Creating an account

  • Go to Digital Ocean.
  • You can create an account without adding billing information.
  • You cannot create any droplets without "activating" your account (by adding billing info).
  • You do get $50 of free credit for D.O. through the Github StudentPack. Be sure to redeem it.

Step 2: Generating an SSH keypair

Step 3: Creating a droplet

  • Click the big shiny "Create" button at the top-right of the screen, and choose "Droplet" as the thing you want to create.
  • Select the suggested Ubuntu version as your operating system.
  • Select the smallest droplet, it should be $5 / month.
  • Don't add backups or block storage.
  • Stick with the default datacenter / region (probably one of the U.S. options).
  • Don't select any additional options.
  • Add an SSH key. Use the contents of the public key file you generated in step 2.
    • DigitalOcean will use this info to automagically do steps 3 and 4 from the SSH keypair instructions so you never have to do them "by hand".
  • Finally, only make one droplet and choose a name for it.
  • It will take a couple seconds to make the droplet.

Step 4: Setting up your droplet

  • SSH to your droplet by running ssh root@[my ip here] (using the IP of your droplet)
  • Logged in? Good, keep reading. Problems? Ask someone for help (or Google).
  • run: wget https://raw.githubusercontent.com/UMM-CSci-3601/droplet-setup-and-build/master/3601-setup.sh as root.
  • run chmod +x 3601-setup.sh
  • run ./3601-setup.sh
    • This will install a bunch of packages necessary for the droplet to be able to run your system, like a Java JDK.
  • Do whatever it asks.
    • When it asks for for info for deploy-user like "Full Name", etc., feel free to leave those blank (just hit Enter).
    • You'll get a weird screen asking a question about configuring openssh-server. Choose "keep the local version" on that screen.
    • You'll have to say y a few times along the way.
    • Actually doing the installs will take a few minutes.
  • Reboot the droplet by typing reboot. SSH into deploy-user@[my ip here].

Step 5: Running your project

  • Use git clone [your repo url here] to get your repo on the droplet.
  • Use cd [your repo name] to move into the directory you just grabbed from github. (cd = Change Directory)
  • Use cd client/src/environments/ and type nano environment.prod.ts.
  • Edit the API_URL to reflect the IP address of your droplet with :4567/api/ at the end of it. (i.e. http://192.168.0.1:4567/api/). Use Ctrl + X to exit and then save the file. NOTE: If you use HTTPS for your project, make sure to change http to https in the URL.
  • Navigate back to your repository. (Type cd ~ and then cd [your repo name]).
  • Run chmod +x build.sh to make the build script executable.
  • Run ./build.sh to build and deploy your project.
  • If you wish to seed your database, run the script to do that. ./gradlew seedMongoDB
  • run tmux to enter a Tmux session.
  • run ./3601.sh to start your server (3601.sh is in the home directory cd ~).
  • press Ctrl + b and then d to detach from this Tmux session. It will continue running even after you log out. To reconnect to the Tmux session, log into your droplet and run tmux a (a for attach!)

If you're interested in doing more fun things with Tmux, check out this cheat-sheet. Tmux is a really cool tool, and if you ever plan on doing system administration stuff in the future it's worth getting to know it.

Updating your project

  • Navigate to the home directory.
  • Run rm -rf server/ to remove the old version.
  • Navigate to the repository directory on your droplet.
  • Run git pull
  • Repeat steps starting at ./build.sh from above.

Logging in from outside the lab, or as someone other than the person who did this setup.

  • You're free to add accounts to your droplet as you see fit and provide that login info to others.
  • You should not share the private key that you generated.
  • You can enable password ssh logins by editing the PasswordAuthentication field in /etc/ssh/sshd_config

About

Instructions on how to setup and build a Digital Ocean Droplet

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages