Following my previous post on Web Development Workflow, I decided to be done with my procrastination and setup a local workflow, which keeps me location independent and autonomous.
The work flow is simple: Develop and test locally, deploy remotely. I’m currently applying this towards the development of an improved theme for my blog, which is basically this one, plus minor adjustments.
My setup is an Apache 2 webserver, with PHP and mySQL. On top of this I enable user dirs for the webserver, and deploy a local wordpress, which in fact runs a backup database from my production site.
First , install apache2,php and mysql support:
sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server
Now enable user directories support (things like localhost/~jonhdoe which actually live in /home/johndoe/public_html) and create the public_html folder:
sudo a2enmod userdir
mkdir $HOME/public_html
Another twist, since this is my main workstation and I don’t want an apache+mysql setup running all the time, is to remove all of the startup scripts from the default boot runlevels:
sudo update-rc.d -f mysql remove
sudo update-rc.d -f apache2 remove
I then run a script to start my environment when I want to code some web bits:
#!/bin/bash
/etc/init.d/apache2 start
/etc/init.d/mysql start
Don’t forget to make the script executable:
chmod +x bin/start-web-dev.sh
After all this I just installing web apps locally. In my case I just install Wordpress by uncompressing it into public_html, creating a DataBase using phpmyadmin, and running the install. After that I went to my production wordpress exported the DB, and imported it on the local wordpress. And I’m done.
As a finally twist I created a git repository of my theme, so i just modify+commit+push, and pull on the main website. Since I can push only when I need or can, this setup is really working for me.
Any further enhancements are welcome, so feel free to drop some suggestions to improve on this.