March 13

Impending Server Changes

I’m going to be making some changes to the server.  I recently had my server “hacked”, which was basically just some skiddie finding a way to post one of those pharmaceutical spam ads on a couple of my WordPress sites.

Hacked - I do not think it means what you think it means.
Hacked – I do not think it means what you think it means.

I’m taking this time to figure out a couple of things.  The plan is:

  • figure out how to use Let’s Encrypt for HTTPS (for TTORP, the Story Teller Forum, and my Fitness Forum).
  • find a way to deploy + update WP sites via git (including initial setup)
  • work on a better CMS for Crazed(Sanity) sites
  • update my “deploy” system to work with GitHub and generic git (not just BitBucket.org)

That’s actually quite a bit of stuff.  It’s going to take a while to get this all setup.  It’s equally possible that I’ll post about impending downtime as I am to simply just do it: pretty much all my sites are (extremely) low traffic.  So, there, I said it.

UPDATE, April 13, 2017

I’ve started migrating some of the sites.  I’ve also started to get some SSL certificates, but ran into an issue with a “rate limit” on LetsEncrypt.org… which apparently means I have to wait for a week before getting more.  (This really means nothing right now, since none of my sites previously used SSL.)

Unfortunately, my main website (crazedsanity.com) is old and not really built to be moved around.  I’ve apparently relied on large amounts of server magic to make it work in the past, along with some not-so-easy-to-debug errors (like a script reporting that it doesn’t exist when accessed directly, because… reasons).

I’m hoping to have all the issues ironed out soon and finish the migration.  Then I can finally get on to playing with new tools and coding languages for reals.

Category: Code, PHP, Rant, Software Development, System Administration | Comments Off on Impending Server Changes
August 21

Hobbit Walk: Tests are Passing

A quick update on the Project Hobbit Walk status.

I’m in the midst of a fairly large code refactoring–which basically means that I’m changing some of the code and cleaning it up.  A lot of the changes are done so that I can get unit testing done, including some automated testing.

The idea is that, whenever I make a change to the code, there will be an automated process happening that ensures nothing broke.

The major part of that is done.  I’ve still got some updating to do, but a major milestone is out of the way.

Category: Code, Hobbit Walk, PHP, Software Development | Comments Off on Hobbit Walk: Tests are Passing
August 18

Solving the Puzzle

Sometimes a puzzle presents itself to you. Sometimes you’re aware of the puzzle, of it’s nature, and sometimes you just have this little… thing, this irritating little itch that you can’t seem to scratch.

Solving the puzzle can be straightforward.  The answer comes to you in a moment, in a flash of brilliance–or common sense–and then you move on.  But then there are those puzzles that take longer.  Hours.  Days.  Weeks.  Months.  Even years.

“What the hell are you talking about?”

I solved one of those puzzles.  It was a puzzle I’d been working on for years, one that I was only casually aware of, but it was really digging at my (crazed)sanity.

This particular puzzle was one whose nature was in programming.

“I’m not a programmer.  This is gonna suck.”

I won’t get into the details; hell, that would bore the crap out of me.  And I’m the one that’s excited about it.

With programming puzzles, you’re almost never sure if it’s truly complete.  With a real puzzle, you’re told straight out of the box that there’s 250 pieces and it’s 15″ x 15″.  With programming, it might be five pieces, and be 50′ x 50′.  Or it could be 50,000 pieces, but only be a few inches wide and a few feet long… it’s just impossible to know.  And when you get to a point where you think, “gosh, I think it’s done,” you realize there’s a whole bunch more pieces that suddenly showed up.

And the other thing is, sometimes there are pieces of the puzzle that you don’t even realize are pieces.  You hold onto this little bit of information, because you know it’s important, but it just doesn’t seem to have correlation… until all of a sudden, you go, “holy crap, this thing here hooks onto this other thing…”

Yep.  It’s like that.

Category: Code, Living With Linux, PHP, Rant, Software Development | Comments Off on Solving the Puzzle
April 28

Email Updates Suspended

I’ve temporarily disabled email updates due to a problem in the code.

At first I thought it was an issue with the data, maybe invalid interpretation of numbers or something.  But that wasn’t it.

Turns out, the code was pulling the totals for all races and combining them.  So the more races I was in, the higher my total was.

Anyway, I’ve disabled the emails for now, until the bug is fixed.  I don’t expect that it will take too long to adjust, but there are some other things that I’m trying to sort out in the meantime.  Here’s a few things on the short list:

  1. Bug fixes (critical only)
  2. Move code to GitHub
  3. Setup issue tracker (on GitHub)
  4. Setup wiki (on GitHub)
  5. Setup unit tests (keeps bugs from re-emerging)
  6. Integration with Travis-CI (for continuous integration testing)

It’s only a half-dozen things, but it’s no small task.  It’s all fairly important, though.  By moving to GitHub, I get exposure: it helps my resume (gives me some geek cred), allows others to look at it and consider helping, and gives me a wiki and issue tracker.  The issue tracker will help my Beta users to see the list of issues, submit problems, and get updates when there are any, and so forth.

Any questions?  Want to get involved?  Say something in the comments!

Category: Code, Hobbit Walk, PHP, Software Development | Comments Off on Email Updates Suspended
April 15

Email Updates are Coming

I’m close to having the email updates functioning.

I haven’t been very motivated recently to get this stuff done.  Dealing with chaos in the family, stress, and looking for a different job have all been consuming my time.  It’s one of those things where sometimes there’s so much to do that I just don’t want to do any of it.

Anyway, I’m hoping to have some emails being sent automatically in the next few days.  Stay tuned!

Category: Code, Hobbit Walk, PHP, Rant, Software Development | Comments Off on Email Updates are Coming
March 2

We Have Milestones!

After much waiting: there are now milestones!

Yep.  A bit of a let-down.  I know.  Sorry.

In creating the milestones, I noticed there were some things that were probably missed… setting up an order to the milestones (so I don’t necessarily have to insert them in the proper order), etc.  Nothing mind-blowing here.

I’m working on the code and associated SQL to figure out a contestant’s progress in relation to milestones.  Nothing exceptionaly difficult, just takes a little time to do.

But there are MILESTONES now, people!

Category: Code, Health, Hobbit Walk, PHP, Software Development | Comments Off on We Have Milestones!
February 24

Nginx and PHP as Different Users (Pooling)

So, after having installed a few WordPress sites on my server (namely this one), I ran into some permissions errors.  I couldn’t get plugins nor any updates to install.

The problem first appeared simply as a prompt to enter FTP credentials.  That was bizarre, so I hunted to find why that was.  I realized it was a permissions issue by reading this page (among others).

I scoured the Internet for answers (in other words, I tried a lot of different search terms in Google) for a way to make Nginx, the webserver software I used, to run as the proper user.  I’d setup different users for different websites, so just changing the webserver’s default user/group wasn’t the answer.

My first solution, albeit an ugly one, was to give everybody read+write+execute permissions on my WP folders.  That was an ugly kludge, but it worked.  And so it sat for some time.

Then I finally found how.  Through some bit of serendipity, I found an article on Apache and suExec.  I changed the term to Nginx with suExec, and found the answer… sort of.

Nginx, PHP-FPM, and Pooling

So the key was the “pooling” part of PHP-FPM that I’d basically ignored.  I had read the configuration file, but didn’t really understand it.

But after reading this article about pooling with Nginx and PHP-FPM, I found the answer.

So PHP-FPM can be configured to run different pools.  Basically, that means that there are multiple main processes for PHP, and they can run as different users.

Easy.  Added a new pool, changed it’s name and the user, and the new process (well, processes) appeared, with the correct user.  But how could I attach that to my website, so it ran as the correct user (instead of www-data)?

It’s All In The Socket

The bit of magic that makes Nginx hand off the PHP work to the correct pool is the socket.  The new pool needed to have a unique socket, then the affected websites needed to be reconfigured to use the socket corresponding to the appropriate pool.

I went back and changed my new pool to have a unique socket name, then restarted the php5-fpm process.  I then went and changed my website’s configuration file to use the corresponding socket.

Before restarting Nginx, I changed the permissions on my website’s folder to no longer be world readable/writable.  Then I attempted to delete an old plugin: as expected, I got a permissions error.  Restarted Nginx, then tried again, and it worked.   Woot!

Category: Nginx, PHP | Comments Off on Nginx and PHP as Different Users (Pooling)