DigitalOcean API

I played around with the API offered through DigitalOcean this morning. I got exactly what I wanted and got a table of my current droplets. Now, it might be cool if I added some additional functionality like rebooting, or starting and stopping the droplets. Or maybe I could provision droplets right from our dashboard! That would be cool!

Dashboard w. DigitalOcean API

Company Bought by Company

I absolutely hate when companies who are purchased by larger companies put this crap into their announcements.

Yet, it's only the beginning. Our aspirations are much bigger. Joining BIG-COMPANY gives us access to a massive wealth of expertise, technology and people that a small company like us could only dream of amassing on its own.

99% of the time this rarely holds true. They always try to explain how things are only going to be better for the end-user, but the reality of it is that someone got a big fat check and that's the end of it. The purchasing company usually shits all over the application or software, support goes bad, product loses original focus, product is forgotten about, product ceases to exist. It's really too bad.

When this happens I usually jump ship and either look for another hosted solution or try to roll my own. Props to product owners who sell big, but you might as well as just let us know, the product is going to get lost in the bowels of whatever large company they just sold too. 😥 😥 😥

Paper Lantern Styling

cPanel Paper Lantern Style

A couple weeks ago I had the pleasure of working with one of the product owners at my job. During that time I got a crash course in creating styles for the new Paper Lantern theme in cPanel. I have been pretty excited about the Paper Lantern theme for some time now, especially since it's based on the Bootstrap framework.

The whole process of creating a style is actually quite easy. As I understand it there's 3 places where one can place a style. The first is at the root level and would allow any user on the system to use the style. The style would be placed into the /var/cpanel/customizations/styled/. The second would be at the reseller level and the directory where your style(s) would be stored would be within /home/reseller/var/cpanel/reseller/styled/. This would allow any sub-accounts of the reseller to use the style. The last would be per account. That's right, ANYONE who has a cPanel account can create their own Paper Lantern style! At the account level, the style may be placed in /home/username/var/cpanel/styled/.

I spent about 45 minutes to an hour building my own style. It can be seen above an is very simple. Styling Paper Lantern is so simple, I'm really glad they moved over to the Bootstrap framework (this site uses it too).

Resources

Hosting Your Own Ghostbin

I've been looking for a decent paste bin tool for a while now. I originally used the PasteBin source and then tried various other Ruby on Rails based alternatives. I did also use a bit of Gists which are offered by GitHub, but they seemed a bit much for a simple paste.

About 1 or 2 months ago, I caught wind of Ghostbin which I really liked. After some initial tinkering and prodding of the developer I finally got it working!

Of note, this guide is an update to this guide here!

Installing Ghostbin

First, as usual, let me plug my DigitalOcean link. It's easy and fast to get yourself up and running and perfect for using Ghostbin. I chose the basic $5/month system, and Ubuntu 14.04 x64.

Upon logging in to your new system, you'll want to add the following lines to your /etc/apt/sources.list file:

deb http://ppa.launchpad.net/bzr/ppa/ubuntu trusty main  
deb-src http://ppa.launchpad.net/bzr/ppa/ubuntu trusty main

Next run apt-get update and then apt-get install bzr mercurial git python-pygments. Next you'll want to install the Go language - apt-get install golang.

For the next part, you're not really required to do this, but I like to be organized and I prefer not to run processes as root if I can avoid it. Add a new user to your system to which you'll run Ghostbin under, adduser ghostbin. You can set a password and other information for it if you'd like. Next I switch to that user, su - ghostbin.

Next we'll update the ~/.bashrc file for the new ghostbin user account.

nano .bashrc

Add the following to the bottom of the file:

export GOPATH=$HOME/go

Then run source ~/.bashrc so that your current session is updated with the new information from the .bashrc file. Now create a couple folders:

mkdir -p ~/go/src

Now change into that new directory - cd $HOME/go/src. Create a folder called 'github.com', mkdir github.com. Go into the github.com folder, cd github.com and fetch the Ghostbin source code:

git clone https://github.com/DHowett/ghostbin.git

Go into the new folder created, cd ghostbin. At this point your full path should be something like - /home/ghostbin/go/src/github.com/ghostbin.

Now we're going to run the following commands to install the Go dependencies and such:

go get
go install
go build

Excellent, so now Ghostbin is install and ready to roll! This next bit is also optional but recommended. We'll install Nginx to proxy the requests. So as your root user run this command - apt-get install nginx. Next go into the following directory - /etc/nginx/sites-available/ and create a file called, 'ghostbin'. Open the file in your favorite text editor and add the following to it:

# Upstream configuration
upstream ghostbin_upstream {  
     server ADDRESS:PORT;
     keepalive 64;
 }

# Public
server {  
    listen 80;
    server_name ghostbin.YOURDOMAIN.com; # domain of my site

   location / {
        proxy_http_version 1.1;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header   X-NginX-Proxy    true;
        proxy_set_header   Host             $http_host;
        proxy_set_header   Upgrade          $http_upgrade;
        proxy_redirect     off;
        proxy_pass         http://ghostbin_upstream;
    }
}

You'll want to set the ADDRESS:PORT and the server_name ghostbin.YOURDOMAIN.com; lines to match your setup. For the ADDRESS:PORT, something like 127.0.0.1:8619 would work, or even 0.0.0.0:8619. You change change the port or address to be anything which works for you. For the server_name, you should set this to your domain. In my case, I set this to:

server_name paste.linuxbox.ninja; # domain of my site

Save the file and exit your editor when done making changes. You'll then want to create a symlink of your Nginx configuration and restart the Nginx service:

ln -s /etc/nginx/sites-available/ghostbin /etc/nginx/sites-enabled/ghostbin 
service nginx restart

Now at this point you should be able to run Ghostbin and start using it. Change back into your 'ghostbin' user account (su - ghostbin) and go to /home/ghostbin/go/src/github.com/ghostbin. Then you can either run Ghostbin by using ./ghostbin -addr="ADDRESS:PORT" or you do have some other options you can set:

ghostbin@paste:~/go/src/github.com/ghostbin$ ./ghostbin --help
Usage of ./ghostbin:
  -addr="0.0.0.0:8080": bind address and port
  -alsologtostderr=false: log to standard error as well as files
  -log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
  -log_dir="": If non-empty, write log files in this directory
  -logtostderr=false: log to standard error instead of files
  -rebuild=false: rebuild all templates for each request
  -root="./": path to generated file storage
  -stderrthreshold=0: logs at or above this threshold go to stderr
  -v=0: log level for V logs
  -vmodule=: comma-separated list of pattern=N settings for file-filtered logging

I am currently running it as such:

ghostbin@paste:~/go/src/github.com/ghostbin$ ./ghostbin -addr="127.0.0.1:8619" -root="/home/ghostbin/storage" -log_dir="/home/ghostbin/logs"

You can see my Ghostbin up and running here as well as an example paste here.

Resources