So – I got a digital ocean “droplet”, now what?!

So, short, sweet and to the point - I'm just diving headfirst into RoR development. I have a domain, and I have a droplet over at DigitalOcean. I have a lot of Vodka, and not much to do for the next couple hours. So - some questions (please point to resources if you have them, so I can print/jot notes, whatever):

1. How do I point my domain (from namecheap) to DigitalOcean. I want DigitalOcean to host/serve my content, but I didn't buy my Domain through them

2. First steps for a droplet? What should I do before anything else

3. Did I do this wrong - should I have actually just gone with shared hosting and push-button setup? I like to know how things work - and I have a fair amount of computer experience, some coding experience, but nothing beyond the self-taught realm

4. Bloody Mary or Vodka Tonic for the next round?!

4 thoughts on “So – I got a digital ocean “droplet”, now what?!”

  1. 1. Update the name servers on Namecheap to point to your digitalocean site

    2. Set up ssh access and create a remote for you to push your code to. Tutorials are found on digital ocean site. Found the link – https://www.digitalocean.com/community/tutorials/how-to-use-the-ruby-on-rails-one-click-application-on-digitalocean

    3. No you should not have just gone with shared hosting. You’re doing this right.

    4. Bloody Mary since it’s nearly Sunday morning now.

    Reply
  2. 1. From your namecheap dashboard, you should see the domain you bought. Click manage. There’s a heading for “Nameservers”, assuming you are using their “Basic DNS” just ensure that’s selected. There’s a tab for advanced DNS, go there. Click “Add new record”. You want the type “A Record”. Value will be the IP of your digitalocean droplet. Protip: Before you do this step, in digitalocean, [create a floating IP](https://www.digitalocean.com/community/tutorials/how-to-create-a-floating-ip-on-digitalocean) (which are free) and associate it with your droplet. If you want to destroy this droplet and start over later, or move your domain to a different droplet, all you would need to do is move this floating IP to a new droplet. Functions the same way as an AWS elastic IP – you only pay for it if you have one that is not associated with a droplet.

    2. [Generate an SSH key](https://help.github.com/articles/generating-an-ssh-key/). This will allow you to work with your droplet, and github/bitbucket, without passwords. If you are using bitbucket or github, associate the key with your account. You will also need create a user for yourself on the droplet (digitalocean credentials are root by default, very bad) and add the contents of your public key to the authorized_keys file for the user you just created. I like to [use an ansible role](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-roles-to-abstract-your-infrastructure-environment) for this:

    **rolename/tasks/main.yml**

    – name: Create users
    user: name={{ item.name }} state=present uid={{ item.uid }} shell=/bin/bash groups=somegroupname append=yes
    with_items: current_users

    – name: Copy ssh keys
    authorized_key: user={{ item.0.name }} key=”{{ lookup(‘file’, item.1) }}”
    with_subelements:
    – current_users
    – authorized

    **rolename/vars/main.yml**

    current_users:
    – name: blue_azure
    uid: 10001
    authorized:
    – ssh-keys/blue_azure-authorized_keys

    **rolename/files/ssh-keys/blue_azure-authorized_keys**

    This file contains the contents of your public key

    **playbook.yml**

    – hosts: droplet
    become: true
    become_user: root

    roles:
    – { role: rolename, tags: [‘rolename’] }

    **inventories/digitalocean**

    [droplet]
    http://www.yourdomain.com

    Note: UID value there is totally arbitrary, anything above 1000 and below 60000 is usually fine. This is just one way, you could also simply log into the box with SSH and the password DO gives you, put the contents of your public key in your user’s [authorized_keys file](http://askubuntu.com/questions/46424/adding-ssh-keys-to-authorized-keys) and be done with it. The ansible method is nice if you want to add more users later, or recreate your environment later on a second droplet.

    At this point you’ll have passwordless access to github/bitbucket and your droplet via SSH and can happily develop and [deploy code to your server via git](https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps)

    3.Nope, you on it.

    4.Whisky. Embrace Ops.

    Reply

Leave a Comment