Wednesday, November 13, 2013

Day 3: Still setting up the environment? Yep.

Today I'm putting the finishing touches on my Typo3 installation, but started the day off (pretty typically for a programmer) with the nasty surprise that none of the navigation links in my introduction package site work.  I can log into the backend though, and it is there that I see all of the pages that are supposed to exist.  I can even view them, and that's what gives me an idea about what could be wrong.

When called from the backend, the page addresses are simply, for example "mysite/index.php?id=1".   From the frontend, however, the links call pages with addresses such as "mysite/examples". Something must be wrong with mod_rewrite, or in some ._htaccess file, a rewrite... thingy is missing.  To the forums!

Re-opened up the install tool to see if it has anything to say about the matter.  From there I can see what corrections I still have to make, like updating the maximum file size and the maximum upload size in php.ini, and setting up a sendmail client on my computer and making sure I can send email with it:

sudo apt-get install sendmail
sudo sendmailconfig

It's that easy. All the red and yellow warnings are gone, the test email gets sent to my address, and everything is green.  A slight detour is made after the tool informs me that I need to install "Suhosin" which, I find out eventually after about 20 minutes of annoyance, is no longer being supported for the most current version of PHP and thus can be ignored.

Time to retackle the rerouting problem. After lunch.

During lunch: reading links I've found about how to set up a continuous integration environment, I came across some incredibly useful information concerning developing quality software with Typo3:

- Use a continuous integration platform (Jenkins)
- with continuous deployment tools
- set up PHPUnit on Jenkins as a template

- Use test-driven-development with
- automated unit testing (PHPUnit extension for Typo3)
- browser testing (Selenium extension for Typo3)

- Robust architecture - dB (?), URL Routing (trying to fix that)

- Performance tests during development - Apache jmeter

- Versioning with formatted comments (commits?) - Git

- Powerful IDE like Eclipse, PHPStorm

- Use a bug tracker (Redmine, Trac, ActivCollab, Git Issue)

- Extensions to help manage a complex Typo3 installation (caretaker, additional reports)

This is exciting, but my list of things to install continues to grow - is there no end in sight?  Will I be able to claim having a complete environment in which I can program by the end of the week?

Additionally, I found the most helpful blog, authored by @Torben Hansen. An entry from March 2013, namely, goes through a step-by-step setup of a Jenkins CI (continuous integration) server with Selenium grid and PHPUnit to perform automated testing in Typo3! Thank you, thank you, kind Sir, for making my day, and my life as a Typo3 developer, complete!

Installing Jenkins

wget -q -O - | sudo apt-key add -
sudo sh -c 'echo deb binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

fails hard, big-time, so time for another - by this time accustomed - detour to see what could possibly have gone wrong.

chown: Zugriff auf »/var/run/jenkins“ nicht möglich: Datei oder Verzeichnis nicht gefunden
dpkg: Fehler beim Bearbeiten von jenkins (--configure):

Translation: I can't find a folder called /var/run/jenkins, so suck it!

After some googling I find that this was a known problem just recently resolved - on Saturday. I follow the instructions for the workaround.

mkdir /var/run/jenkins
sudo apt-get update
suod apt-get install jenkins

Now I call Jenkins in the browser on port 8080 and voila - I have acquired a continuous integration server to call my very own!  In order to continue the tutorial, I have to install PHPUnit and a LOT of dependencies via PEAR.

Installing PHPUnit (and everything else)

Install PEAR itself via PHP Archive, install PHPUnit, DbUnit for unit testing databases, Selenium for testing the front-end, UnitStory for behavior-driven testing, SkeletonGenerator for generating code-stubs from test code (I'd read about this before and thought it would be an incredibly useful tool to have: always improve your environment!), and TicketListener_GitHub, for integration of PHPUnit with the GitHub Issue tracker.

That's a lot of installation. But wait - there's more!

In an attempt to start tackling the (very many) "best practices" list for Jenkins, I set up a user, spend 15 minutes trying to figure out how to expose Jenkins on the Apache server without actually daring to try it, and then start the install of the Jenkins Selenium Plugin, which "will run Selenium Grid, acting as a hub for all other Selenium nodes".  OK then.  It takes about as long to install as I spent installing all this other shit stuff today manually, but finally it's done and I can restart Jenkins.  On the command line, which is how the cool kids do it.

sudo service jenkins restart

Success.  However, I am crestfallen to see that in order to continue with the tutorial, I have to set up THREE VIRTUAL MACHINES with several different browsers on them OH NOES.  I really, really don't want to do this right now, especially since the instructions for setting up three virtual machines with several browsers on them happen to be: "For this article, 3 virtual machines with different browser configurations have been created and configured". I has a so SAD. :(

Today's captain's log has run far too long as it is, erstwhile reader.  You are probably asleep right now, as I know that it is extra-boring.  Not, however, as boring as it was to actually do all the installations. Tomorrow is the last day of the first week of Hackership.  Will I manage to free myself from this tangle of installation bondage in time for the demo?

Stay tuned, and find out.

No comments:

Post a Comment

Play nicely!