Weekly Win 2: Cedar Raised Garden Beds

Our little man has a thing for tomatoes. Thus, we are going to be planting a garden this summer. We did one a couple of years back, with little success.

The place where we selected for our garden ended up being quite low, wet, and beyond weed filled. After my wife planted the seed (pun intended), I decided that I would build a raised garden bed.

Parts List

  • 18 cedar 2×4 8′ long
  • 2 cedar 4×4 8′ long
  • Wood screws (I used 120 ceramic coated deck screws, #8 x 2 1/2″)
  • Saw (I only have a worm drive circular saw, a chop saw would be better)
  • Weed barrior (I bought a roll of 3′ x 120′ weed barrior)
  • Soil, I used around 24 cu. ft. of garden soil
  • Spade shovel

I tried to make a video for this project, attempting to get fancy with timelapses. Unfortunately, the app I used had a habit of stopping for no reason, so much of the footage was lost. It’s a pretty simple project though, and you can get an idea for the steps involved pretty quickly.

Feel free to check out the video, let me know if you have any questions.

Weekly Win 1: WeissMike.com run on Raspberry Pi

I’ve decided that I’d like to push myself to do something creative, technical, or otherwise different from the norm more often. I’ve tasked myself with “launching” something each week. I’m not going to announce any plans, or penalize myself if I fail, I’m just going to try.

For my first project, I’ve decided to migrate my website from it’s old location on my current employer’s web server, to a domain that I can control no matter what.

I bought a Vilros Rasberry Pi 2 kit (affiliate link) last Christmas, so it was time to dust it off. It looks like the kit I purchased has now been updated to include the Raspberry Pi 3, so bonus for you!

Getting Started

First off, I wanted to make it easier to work on the Pi. I hooked it up to my most accessible monitor (a TV in the room off of the kitchen), and used raspi-config to turn on SSH.

I then disconnected the jumbled mess and relocated the Pi to the closet in the office that houses the cable modem and router.

Setting up the router

I use DD-WRT on my router, so I logged into the web interface, and set up a static IP address for the Pi within my network. I decided on using 192.168.1.250. I don’t think it matters, but that IP address outside of my DHCP assigning IP range.

I then put the Pi in the DMZ so it can be accessed from the outside, without having to worry about port forwarding. I might choose to bring it inside at some point so I can continue to access the VPN provided by my router.

Installing LAMP

I used this guide to install the LAMP stack. I experimented with attempting to install PHP 7, but because it isn’t yet in apt-get, I had more trouble than I was ready to put up with. I opted to stick with PHP5, and we will revisit this sometime down the road.

Keeping up to date

One of the features that I liked about my work server is the automatic updates that are performed nightly. After doing a little bit of research, I discovered that using unattended-upgrades was the way to go. I installed and configured that using this guide.

Transferring files

Rather than start with a blank copy of WordPress, I decided to transfer my existing files and data from my current host.

This was pretty easy, because I have SSH access to both servers, I simply ran the following command on the Pi:
scp [email protected]:/home/mike/www /var/www

If I didn’t have SSH access, I would have probably just used FTP to transfer the files. Easy peasy.

Setting up the database

Because I’m more comfortable with phpMyAdmin, I decided to export the existing data from the current site using that. This downloaded a database.sql file to my computer which I transferred to the new server using SCP again.

scp downloads/database.sql [email protected]:/var/www

I know it’s not great to store that file in the www directory, but don’t worry, it’s gone.

I then logged into MySQL using the root password I created during setup:

mysql -uroot -p

Then created the new database:

CREATE DATABASE mike_wrdp;

Then the user:

CREATE USER 'mike_wrdp'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON mike_wrdp.* TO 'mike_wrdp'@'localhost';

Then I exit the MySQL prompt:

exit

And import all of the data into the new database:

mysql -uroot -p mike_wrdp < database.sql

Because I created the same usernames, database names, and password (all changed above to protect the innocent) that were on my old server, I didn’t have to change the wp-config.php file.

Setting up the Dynamic DNS

I’m sure this is a violation of my EULA, but thus far Charter has been pretty cool with everything else I use my internet for, so I don’t think they’ll mind as long as I don’t take advantage of it. My IP address doesn’t change that often, but it has been known to happen.

I already used freedns.afraid.org on my router, but I decided that it would be nice to continue to use my free CloudFlare account to take advantage of their security hardening and page caching abilities. I knew that they had an API, so I began looking for an easy way to update my A record when my IP address changed.

I discovered a script on GitHub, but after browsing through the comments, I saw that it needed to be tweaked for the new CloudFlare API. Here is the code that I used.

Once I followed the instructions in the comments of that script, it seemed to work.

Testing

Testing revealed three problems.

  1. I couldn’t update plugins without FTP info
  2. The site was kind of slow (I expected this)
  3. Permalinks were not working

Fixing permission issues

The first issue is one I’ve run up against before. When I transferred the files to my server, they were all given the group:user that I was logged in as. Once I fix that, it’ll allow PHP to update the files. All I had to do was run the following command:

chown -R www-data:www-data /var/www

Fixing speed issues

I know that I’ll never have the redundant high-bandwidth, low-latency connections that my old host had, but I could at least speed up the page load time by implementing some caching. I currently prefer to use w3 Total Cache for this, and it was pretty simple to set up. Minify didn’t work in auto mode, so I might have to revisit that at some point.

I also turned on CloudFlare caching and extended browser caching.

Fixing Permalink Issues

The instructions were very clear, but I didn’t listen correctly. You have to change the AllowOverride setting on LINE 11. I changed it on the wrong place. After fixing my mistake, rebooting apache, and saving permalinks everything was working again.

Future considerations

  • Establish automated backups – I know that these SD cards are prone to failure, and I don’t want to lose everything in a fire, so I’ll be working on an automated remote backup solution. I’ve also seen users convert their Pi to use an external SSD instead of the SD card to increase longevity.
  • Increase server security – I’m hoping to block all external access, with the exception of web traffic. That’ll require that I get VPN up and running again.
  • More web projects – I’m hoping to create some web projects that take advantage of the hardware and I/O capabilities. I’m already considering a magic mirror or family dashboard.