Every time I spin up a new virtual machine I have to go through and do these same things

I have to find the documentation for all of them every time because it's been long enough that I don't remember how to do them each time, so I figured I might as well document more or less what I have to do to set this up. I'm using Bitnami stacks for my virtual machines and these instructions are relevant to Ubuntu 14.04.

Set up a static ip

Edit /etc/network/interfaces like so:
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static

Make sure you choose an address outside the address space of the dhcp server then restart networking with sudo service networking restart, except the networking restart like this isn't working on Ubuntu so I'm restarting the machine (the good ol' Windows reboot on a Linux box, smh.)
Source: Ask Ubuntu

Enable the SSH server

sudo mv /etc/init/ssh.conf.back /etc/init/ssh.conf
sudo start ssh

Source: Bitnami docs

Support key-based authentication

Generating public/private rsa key pair.
Enter file in which to save the key (/home/bitnami/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/bitnami/.ssh/id_rsa.
Your public key has been saved in /home/bitnami/.ssh/id_rsa.pub.
The key fingerprint is:

This command should create two files named id_rsa and id_rsa.pub in the /home/bitnami/.ssh directory. Copy the private key file named id_rsa to a secure location. Do not share this private key file. Transfer the contents of the public key file to the /home/bitnami/.ssh/authorized_keys file:
cd /home/bitnami/.ssh
cat id_rsa.pub >> /home/bitnami/.ssh/authorized_keys

Edit the /etc/ssh/sshd_config and uncomment (or add if not already present) the following lines: RSAAuthentication yes
PubkeyAuthentication yes

In the same file, disable basic password authentication:
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no

Restart the SSH server for the new configuration to take effect: sudo /etc/init.d/ssh force-reload
Source: Bitnami docs

Reset the MySQL root password

/opt/bitnami/mysql/bin/mysqladmin -p -u root password NEW_PASSWORD
Source: Bitnami docs

Block spammers

At the end of the configuration file for Apache, /opt/bitnami/apache2/conf/httpd.conf, add the following lines to deny spammers:
#Spammer Blacklist
<Location />
order allow,deny
allow from all
deny from xxx.xxx.xxx

Put the subnets you want to block in place of the xxx.xxx.xxx and you can repeat that line for as many subnets as you want. I manually add spammers to this list when I find them attacking my server, and the subnets that have been added are all in China and Russia. I don't get many visitors as it is, and Chinese and Russians really don't have a reason to have interest in my blog, so I don't feel bad about blocking entire subnets in those countries. I might think hard about it if the subnet was in a country where I might have readers.
Source: lost to the wind, but I copied the section off the bottom of my httpd.conf of my last server I spun up (which I've been using about 2 years now).

Using Bitnami

So, confession time: I've never really done too well at setting up a server. I'm sure this one is no exception. I have a tough time figuring out where to put things on servers, where and how to serve up additional sites. That said, I've learned a bit about multi-site configuration on a single server over the past year from work. I now have multiple vhosts setup so that I can hit the same server with multiple domains and get different websites, except I'm not pointing any other domains at my server yet. What I did do though was use subdomains so that I can have multiple rails projects running on the same server, permanently set up with Apache and Passenger. I'm still testing this out, so I'm not sure that it will work the way I want it to, but here's what I'm thinking.

I'm creating a /home/bitnami/projects folder where I can stash all my projects. The bitnami stack that I chose is the Ruby stack, which gives me Apache setup already with Passenger integration, which allows me to server either Rails apps or PHP sites. I can create new projects in my projects folder, and then give each project it's own vhost entry so that I can hit each of them individually. I'm going to use the ServerAlias directive to give them each a subdomain, then add CNAME records to my DNS for each subdomain which point back to my server, that way Apache will decode the url and point to the right vhost.

I added a line to the end of the /opt/bitnami/apache/conf/bitnami/bitnami-apps-vhosts.conf file:
Include "/home/bitnami/httpd-vhosts.conf"
I created the vhost file there so I don't have to deal with permissions issues (i.e. sudo/running as root) when I'm adding new vhosts.

I'm thinking about creating a project that's served by default (i.e. if someone hits the server with the IP or if they hit with the root domain, because apparently those can be different), and that project will essentially be a page of links to all the projects (subdomains) on the server. I can set up a php script to either read through the vhosts file in my home directory or go through the directory of projects and create a list of links and then write them out to a php file. I can use cron to run that php script every <interval of time> so that when I create new projects they'll show up automagically on my jump page (working title). I need to figure out what a sensible interval of time to run the script is. Often enough where I don't feel the need to run it manually every time I create a project, but not too often where it's needlessly chewing up CPU cycles.

Hope this helped you, but, more importantly, I hope it's still available next time I need to setup a new server!

Published on 26 January 2017 at 04h52 by Dave, tags

If you promised to move elsewhere if Trump won then it's time to pack up and go because you're not a patriot.

The rest of America, the people who understand what it means to be American, will do the hard work of fixing what is broken, despite a Trump victory. If you think the American response to a little political adversity is to flee I suggest you take another American History course. You want change? Stay and make it.

Published on 09 November 2016 at 18h11 by Dave, tags , ,

Offended an employee today by asking him where he found his code

"Where did you find the code you used for that task?"

"Where did I find the code?"

"I can see you wrote most of it yourself but there's pieces that I'm guessing you found on a forum somewhere, maybe stackoverflow?"

"I don’t remember but the piece that I found is the piece for remove the duplicates. line 176 to 180 maybe stackoverflow.
the other is from and old project that I did in my last job."

"Cool. It's an interesting approach. There's a couple spots I think we can tighten it up but good job."

"Hey, sincerely take care how you ask some questions. Sometimes I feel that you treat us as if we know nothing of what we do."

Dude, seriously? I was just being polite. Your code looks like you bought some commercial engraved wooden boxes and then tried to build a dresser to contain them out of loose sticks from the forest and duct tape. It's diamonds covered in dog shit and you're trying to pass it off as high-end jewelry. You didn't write most of that code, and I know that because I have to redo the entire task now because it's so far off from what should have been written that it's futile for me to try to describe what it should look like and give you a second chance.

You only found the piece for removing duplicates online? Oh, cool, so you wrote that regex piece yourself? I didn't realize you were a regex master. I still have to look that shit up every time I use it so I'll just come to you with my regex questions in the future. Shut up clown. I treat you like you know nothing because you know nothing. I wasn't mad that you looked up code online, I do that too, I just wanted to know if you have a resource that I don't know about so I can use it too. Now I know who I'm dealing with and, news flash: You're no rock star.

Published on 19 July 2016 at 17h48 by Dave, tags , ,

Damn, can't people just be people?

This is what Men United is supposed to look like?

A friend of mine shared this image from "Men United" on facebook and it left me with so many questions, like:

  • What's so bad about Pokemon? I'm not playing, but I don't want to stomp on anyone that is finding a way to enjoy themselves.
  • Is it wrong to do something that you enjoy just because it isn't "manly" enough?
  • What other things might I be told not to do because it isn't "manly" enough for some random onlooker?
  • What sorts of activities are men supposed to do?
  • Who gets to decide these things? I mean, do we all get a vote, or is it just forced on us by people that couldn't live up to their own standards if they tried?
  • Why should I live my life trying to live up to a standard of what someone else thinks a man should be?

Dear "Men United,"
This isn't what men united looks like, because men united wouldn't be tearing down other men.

And you know what? Fuck you friend for even sharing this. We're under enough attack, we have enough stress in our lives, that if we want to spend our time wandering around with strangers and hanging out in parks in the middle of the night who the fuck are you to try to shame us into not doing that?

And, why I'm posting here: if I said any of this to you directly you would claim that you were "just joking" and I take things too seriously. Yeah, well, sorry I'm not funny. Words matter, and I refuse to have my manliness shamed out of me. Fuck you very much, and you can shove your Clint Eastwood memes straight up your ass.

Published on 14 July 2016 at 04h39 by Dave, tags ,

"How many people will share this?"

Hopefully no one. Appealing to pity isn't how virality works, and I'm disappointed that it affected someone I know to share your garbage post.

Published on 28 June 2016 at 16h59 by Dave, tags

I'm all for ignoring idiots, but...

... if they have an actual argument you have to address the argument itself instead of dismissing it out of hand.

From a Salon article:

"...Trump, a man so profoundly unqualified that sexism is the only real justification for voting for him."

This line checked me out of this article. I'm not for Trump, I think he would be terrible, but putting forth this argument downplays the very real reasons that people are voting for him, reasons like believing that he can restore the middle class or that he can protect Americans from people that want to hurt our way of life. That Trump can do those things is disproved by policy analysis of his proposals, but those are very real concerns by people and actual reasons people I know are voting for him. This Salon writer made a flippant comment that is unnecessarily dismissive of the current state of the country and shows so much bias that it prevented me from finding the will to finish reading the article.

Published on 09 June 2016 at 21h12 by Dave, tags , , ,

Powered by Publify | Photo Startup stock photos