<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Abecto</title>
	<atom:link href="http://www.abecto.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.abecto.com</link>
	<description></description>
	<lastBuildDate>Sat, 05 Feb 2011 09:56:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Retrieving lost Git commits</title>
		<link>http://www.abecto.com/2011/retrieving-lost-git-commits/</link>
		<comments>http://www.abecto.com/2011/retrieving-lost-git-commits/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 09:55:49 +0000</pubDate>
		<dc:creator>Niall</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.abecto.com/?p=178</guid>
		<description><![CDATA[From time to time I've managed to "lose" commits in Git, usually after I have initialised a submodule in a project and forgot to checkout a specific branch before committing changes. When I eventually do realise my mistake, I need to get those commits back into the relevant branch - in this case, master. Here's how it's done...]]></description>
			<content:encoded><![CDATA[<p>From time to time I've managed to "lose" commits in Git, usually after I have initialised a submodule in a project and forgot to checkout a specific branch before committing changes. When I eventually do realise my mistake, I need to get those commits back into the relevant branch - in this case, master. Here's how it's done.</p>
<p><code>git reflog</code></p>
<p>This command will return something like: </p>
<p><code>902532b HEAD@{5}: commit: Doing some stuff on master now...wait where's my previous commits?<br />
7f6c682 HEAD@{7}: checkout: moving from 3a311d8f746f903e15ce145a3e7683e0d53536fb to master<br />
3a311d8 HEAD@{8}: commit: Added some more stuff<br />
56f7716 HEAD@{9}: commit: Added some stuff<br />
7f6c682 HEAD@{10}: checkout: moving from master to 7f6c6821c80baff91492af4909f1012876ef6249</code></p>
<p>56f7716 and 3a311d8 are the SHA identifiers of the commits that are floating around in the git void, attached to no branch, so I want to move them into the master branch. Starting with the first commit:</p>
<p><code>git checkout 56f7716</code></p>
<p>This will return output similar to:</p>
<p><code>Note: moving to '56f7716' which isn't a local branch<br />
If you want to create a new branch from this checkout, you may do so<br />
(now or later) by using -b with the checkout command again. Example:<br />
  git checkout -b <new_branch_name><br />
HEAD is now at 56f7716... Added some stuff</code></p>
<p>Pretty self explanatory. Let's do what it suggests and create a branch at this point in the history tree. We can then merge that branch into master (or whichever branch it belongs to).</p>
<p><code>git checkout -b temp_branch<br />
git checkout master<br />
git merge temp_branch</code></p>
<p>The commit is now in master where it belongs. Rinse and repeat for commit 3a311d8 and all is well in the world again!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abecto.com/2011/retrieving-lost-git-commits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading version controlled Rails gems frozen in vendor/rails</title>
		<link>http://www.abecto.com/2010/upgrading-version-controlled-rails-gems-frozen-in-vendorrails/</link>
		<comments>http://www.abecto.com/2010/upgrading-version-controlled-rails-gems-frozen-in-vendorrails/#comments</comments>
		<pubDate>Sat, 13 Nov 2010 11:33:48 +0000</pubDate>
		<dc:creator>Niall</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.abecto.com/?p=172</guid>
		<description><![CDATA[I recently had to upgrade quite an old Rails application from Rails v2.1 to v2.3.9. Previously I would do this by deleting the old rails/ directory in vendor/ and refreezing the gems. However, I have had the strange errors from Subversion when merging the upgrade branch back into trunk and it caused me a sufficient [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to upgrade quite an old Rails application from Rails v2.1 to v2.3.9. Previously I would do this by deleting the old rails/ directory in vendor/ and refreezing the gems. However, I have had the strange errors from Subversion when merging the upgrade branch back into trunk and it caused me a sufficient headache to find an alternative solution.</p>
<p>My approach now is to keep the existing vendor/rails directory and copy the new Rails files into it, doing a recursive diff of the two directories first to identify files and directories that need to be deleted as they don't exist in the new version. The process is a little bit fiddly but I've had no merge issues since adopting it, so I find it worth the extra effort.</p>
<p>Here's my step-by-step process:</p>
<p>1 - Temporarily rename vendor/rails so the latest Rails version can be frozen (all commands are assuming you in the Rails root directory):</p>
<p><code>mv vendor/rails vendor/rails_old</code></p>
<p>2 - Freeze the newer version of Rails (in this case, 2.3.9 as the app isn't quite ready for a Rails 3 upgrade yet)</p>
<p><code>rake rails:freeze:gems VERSION=2.3.9</code></p>
<p>This creates vendor/rails with version 2.3.9 of the Rails gems.</p>
<p>3 - Move vendor/rails_old back to vendor/rails so the subversion tracking doesn't break.</p>
<p><code>mv vendor/rails vendor/rails_new<br />
mv vendor/rails_old vendor/rails</code></p>
<p>Do a quick 'svn status' to confirm everything is correct.</p>
<p><code>svn st vendor</code></p>
<p>It should look like this:</p>
<p><code>? vendor/rails_new</code></p>
<p>4 - Now do a diff of the two Rails directories to see what files only exist in the old version of Rails. These are the files we want to delete.</p>
<p><code>diff -qr vendor/rails vendor/rails_new | grep "Only in vendor/rails/" | grep -v -e "svn" > rails_diffs</code></p>
<p>Note the use of grep to return only files that exist in rails/. The output is also written to ./rails_diffs as we need to edit the output slightly. It will look something like this:</p>
<p><code>Only in vendor/rails/actionmailer/lib/action_mailer/vendor: tmail-1.1.0<br />
Only in vendor/rails/actionmailer/lib/action_mailer/vendor: tmail-1.2.3<br />
Only in vendor/rails/actionmailer/lib/action_mailer: vendor.rb<br />
Only in vendor/rails/actionmailer/test/fixtures/first_mailer: share.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/helper_mailer: use_example_helper.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/helper_mailer: use_helper.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/helper_mailer: use_helper_method.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/helper_mailer: use_mail_helper.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/path.with.dots/funky_path_mailer: multipart_with_template_path_with_dots.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/path.with.dots: multipart_with_template_path_with_dots.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures: raw_base64_decoded_string<br />
Only in vendor/rails/actionmailer/test/fixtures: raw_base64_encoded_string<br />
Only in vendor/rails/actionmailer/test/fixtures/second_mailer: share.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/templates: signed_up.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/test_mailer: implicitly_multipart_example.ignored.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/test_mailer: implicitly_multipart_example.text.html.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/test_mailer: implicitly_multipart_example.text.plain.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/test_mailer: implicitly_multipart_example.text.yaml.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/test_mailer: signed_up.erb<br />
Only in vendor/rails/actionmailer/test/fixtures/test_mailer: signed_up.rhtml<br />
Only in vendor/rails/actionmailer/test/fixtures/test_mailer: signed_up_with_url.rhtml<br />
Only in vendor/rails/actionpack/lib/action_controller: assertions.rb<br />
Only in vendor/rails/actionpack/lib/action_controller/caching: sql_cache.rb<br />
Only in vendor/rails/actionpack/lib/action_controller/cgi_ext: session.rb<br />
Only in vendor/rails/actionpack/lib/action_controller: components.rb<br />
Only in vendor/rails/actionpack/lib/action_controller: request_profiler.rb<br />
Only in vendor/rails/actionpack/lib/action_controller: routing_optimisation.rb<br />
Only in vendor/rails/actionpack/lib/action_controller/session: active_record_store.rb<br />
Only in vendor/rails/actionpack/lib/action_controller/session: drb_server.rb<br />
Only in vendor/rails/actionpack/lib/action_controller/session: drb_store.rb<br />
Only in vendor/rails/actionpack/lib/action_view: compiled_templates.rb<br />
Only in vendor/rails/actionpack/lib/action_view/helpers: javascripts<br />
Only in vendor/rails/actionpack/lib/action_view: partial_template.rb<br />
Only in vendor/rails/actionpack/lib/action_view: template_finder.rb<br />
Only in vendor/rails/actionpack/lib/action_view/template_handlers: compilable.rb<br />
Only in vendor/rails/actionpack/test: action_view_test.rb<br />
Only in vendor/rails/actionpack/test/controller: cgi_test.rb<br />
Only in vendor/rails/actionpack/test/controller: components_test.rb<br />
Only in vendor/rails/actionpack/test/controller: custom_handler_test.rb<br />
Only in vendor/rails/actionpack/test/controller: fragment_store_setting_test.rb<br />
Only in vendor/rails/actionpack/test/controller: http_authentication_test.rb<br />
Only in vendor/rails/actionpack/test/controller: integration_upload_test.rb<br />
Only in vendor/rails/actionpack/test/controller: new_render_test.rb<br />
Only in vendor/rails/actionpack/test/controller: session_fixation_test.rb<br />
Only in vendor/rails/actionpack/test/controller: session_management_test.rb<br />
Only in vendor/rails/actionpack/test/fixtures/test: block_content_for.erb<br />
Only in vendor/rails/actionpack/test/fixtures/test: erb_content_for.erb<br />
Only in vendor/rails/actionpack/test/template: deprecated_erb_variable_test.rb<br />
Only in vendor/rails/actionpack/test/template: template_finder_test.rb<br />
Only in vendor/rails/actionpack/test/template: template_object_test.rb<br />
Only in vendor/rails/activerecord/lib/active_record: vendor<br />
Only in vendor/rails/activerecord/test: aaa_create_tables_test.rb<br />
Only in vendor/rails/activerecord/test: abstract_unit.rb<br />
Only in vendor/rails/activerecord/test: active_schema_test_mysql.rb<br />
<snip></code></p>
<p>5 - All the files we want to delete are in rails_diffs, so using your favourite text editor do a I find of all instances of "Only in", replacing it with "svn rm" and also find ": " (note single white space) and replace it with "/". This will modify the file to look something like: </p>
<p><code>svn rm vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0<br />
svn rm vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3<br />
svn rm vendor/rails/actionmailer/lib/action_mailer/vendor.rb<br />
svn rm vendor/rails/actionmailer/test/fixtures/first_mailer/share.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/helper_mailer/use_example_helper.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper_method.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/helper_mailer/use_mail_helper.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/path.with.dots/multipart_with_template_path_with_dots.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/raw_base64_decoded_string<br />
svn rm vendor/rails/actionmailer/test/fixtures/raw_base64_encoded_string<br />
svn rm vendor/rails/actionmailer/test/fixtures/second_mailer/share.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/templates/signed_up.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.ignored.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.erb<br />
svn rm vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.rhtml<br />
svn rm vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up_with_url.rhtml<br />
svn rm vendor/rails/actionpack/lib/action_controller/assertions.rb<br />
svn rm vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb<br />
svn rm vendor/rails/actionpack/lib/action_controller/cgi_ext/session.rb<br />
svn rm vendor/rails/actionpack/lib/action_controller/components.rb<br />
svn rm vendor/rails/actionpack/lib/action_controller/request_profiler.rb<br />
svn rm vendor/rails/actionpack/lib/action_controller/routing_optimisation.rb<br />
svn rm vendor/rails/actionpack/lib/action_controller/session/active_record_store.rb<br />
svn rm vendor/rails/actionpack/lib/action_controller/session/drb_server.rb<br />
svn rm vendor/rails/actionpack/lib/action_controller/session/drb_store.rb<br />
svn rm vendor/rails/actionpack/lib/action_view/compiled_templates.rb<br />
svn rm vendor/rails/actionpack/lib/action_view/helpers/javascripts<br />
svn rm vendor/rails/actionpack/lib/action_view/partial_template.rb<br />
svn rm vendor/rails/actionpack/lib/action_view/template_finder.rb<br />
svn rm vendor/rails/actionpack/lib/action_view/template_handlers/compilable.rb<br />
svn rm vendor/rails/actionpack/test/action_view_test.rb<br />
svn rm vendor/rails/actionpack/test/controller/cgi_test.rb<br />
svn rm vendor/rails/actionpack/test/controller/components_test.rb<br />
svn rm vendor/rails/actionpack/test/controller/custom_handler_test.rb<br />
svn rm vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb<br />
svn rm vendor/rails/actionpack/test/controller/http_authentication_test.rb<br />
svn rm vendor/rails/actionpack/test/controller/integration_upload_test.rb<br />
svn rm vendor/rails/actionpack/test/controller/new_render_test.rb<br />
svn rm vendor/rails/actionpack/test/controller/session_fixation_test.rb<br />
svn rm vendor/rails/actionpack/test/controller/session_management_test.rb<br />
svn rm vendor/rails/actionpack/test/fixtures/test/block_content_for.erb<br />
svn rm vendor/rails/actionpack/test/fixtures/test/erb_content_for.erb<br />
svn rm vendor/rails/actionpack/test/template/deprecated_erb_variable_test.rb<br />
svn rm vendor/rails/actionpack/test/template/template_finder_test.rb<br />
svn rm vendor/rails/actionpack/test/template/template_object_test.rb<br />
svn rm vendor/rails/activerecord/lib/active_record/vendor<br />
svn rm vendor/rails/activerecord/test/aaa_create_tables_test.rb<br />
svn rm vendor/rails/activerecord/test/abstract_unit.rb<br />
svn rm vendor/rails/activerecord/test/active_schema_test_mysql.rb<br />
<snip></code></p>
<p>This creates a list of commands to run to remove those files/directories from version control. So copy the contents of rails_diff and paste it into your command line. You'll see a bunch of output confirming Subversion has removed those files/directories.</p>
<p>6 - While "svn rm" will physically delete files, directories still remain, so lets tidy those up to. Go back to rails_diff and find all instances of "svn rm", replace with "rm -rf" and again copy and paste the contents of the file into the command line. Yes this will try and delete files that have already been deleted but as we're forcing the delete with the '-f' option, it won't complain.</p>
<p>7 - Now that all the unneeded files from the old version of Rails have been removed it's time to update vendor/rails/ to the our newer version.</p>
<p><code>cp -R vendor/rails_new/ vendor/rails/</code></p>
<p>This will modify existing files that have changed in the newer version of Rails and add any new files. Modified files are already tracked by Subversion, but we need to add the new files to version control. So in a similar way to how we diff'd the two rails directories, we'll use 'svn status' to tell us what files are new.</p>
<p><code>svn st vendor/rails | grep ? > rails_diffs</code></p>
<p>The output again goes into ./rails_diff and will look something like:</p>
<p><code>?       vendor/rails/activeresource/test/debug.log<br />
?       vendor/rails/activeresource/test/http_mock_test.rb<br />
?       vendor/rails/activeresource/test/fixtures/proxy.rb<br />
?       vendor/rails/activeresource/lib/active_resource/exceptions.rb<br />
?       vendor/rails/actionmailer/test/mail_layout_test.rb<br />
?       vendor/rails/actionmailer/test/asset_host_test.rb<br />
?       vendor/rails/actionmailer/test/fixtures/auto_layout_mailer<br />
?       vendor/rails/actionmailer/test/fixtures/layouts<br />
?       vendor/rails/actionmailer/test/fixtures/asset_host_mailer<br />
?       vendor/rails/actionmailer/test/fixtures/explicit_layout_mailer<br />
?       vendor/rails/actionmailer/test/fixtures/test_mailer/body_ivar.erb<br />
?       vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.html.erb<br />
?       vendor/rails/actionmailer/lib/action_mailer/vendor/tmail.rb<br />
?       vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7<br />
?       vendor/rails/actionmailer/lib/action_mailer/vendor/text_format.rb<br />
?       vendor/rails/activesupport/lib/active_support/message_verifier.rb<br />
?       vendor/rails/activesupport/lib/active_support/memoizable.rb<br />
?       vendor/rails/activesupport/lib/active_support/secure_random.rb<br />
?       vendor/rails/activesupport/lib/active_support/message_encryptor.rb<br />
?       vendor/rails/activesupport/lib/active_support/locale<br />
?       vendor/rails/activesupport/lib/active_support/rescuable.rb<br />
?       vendor/rails/activesupport/lib/active_support/all.rb<br />
?       vendor/rails/activesupport/lib/active_support/xml_mini.rb</code></p>
<p>8 - Do a find of '?' and replace it with 'svn add'. Again, copy and paste the file contents into the command line. This will add all these files to version control. Once complete, check the svn status of vendor/rails again to confirm that everything is now tracked.</p>
<p><code>svn st vendor/rails | grep ?</code></p>
<p>If this outputs nothing then you're good to go.</p>
<p>9 - Your vendor/rails directory is now up to date and ready to commit to your repository.</p>
<p><code>svn commit vendor/rails -m "Upgraded vendor/rails from vX.X.X to vX.X.X"</code></p>
<p>10 - Finally a bit of tidying up:</p>
<p><code>rm -rf vendor/rails_new<br />
rm ./rails_diffs</code></p>
<p>All done!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abecto.com/2010/upgrading-version-controlled-rails-gems-frozen-in-vendorrails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting up a new VPS on Linode</title>
		<link>http://www.abecto.com/2010/setting-up-a-new-vps-on-linode/</link>
		<comments>http://www.abecto.com/2010/setting-up-a-new-vps-on-linode/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 17:10:38 +0000</pubDate>
		<dc:creator>Niall</dc:creator>
				<category><![CDATA[Systems Administration]]></category>

		<guid isPermaLink="false">http://www.abecto.com/?p=113</guid>
		<description><![CDATA[I host most of my personal and freelance sites on Virtual Private Servers. Why not shared hosting? Primarily because of the word "private". A VPS gives you full control of your own server, and the freedom to configure it as you wish, which in my experience is a must when hosting Ruby on Rails applications.
I [...]]]></description>
			<content:encoded><![CDATA[<p>I host most of my personal and freelance sites on Virtual Private Servers. Why not shared hosting? Primarily because of the word "private". A VPS gives you full control of your own server, and the freedom to configure it as you wish, which in my experience is a must when hosting Ruby on Rails applications.</p>
<p>I recently had to change Virtual Private Server provider and made the switch to the excellent <a href="http://www.linode.com/">Linode</a>. A colleague recommended them and I've been impressed with their service, cost, features and reliability. </p>
<p>While making the switch I took the opportunity to document the steps I took to setup a fresh VPS, primarily for hosting Ruby on Rails, but also as a Git server and Subversion server. Here are those steps, for my own future reference, but if others find it useful, all well and good...</p>
<h3>Initial setup</h3>
<p>Linode comes with a number of pre-configured "StackScripts" which automates setting up of various software on your server when it boots for the first time. As my server would be hosting Ruby on Rails applications, I chose the "Apache, MySQL, Ruby Setup" Stackscript, on Debian 5.</p>
<p>After the initial boot, Apache, Mysql and Ruby were indeed installed by the script. However, I noticed the Ruby Gems installation did not complete, so I did it manually as follows:</p>
<p><code>wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz<br />
tar xzvf rubygems-1.3.6.tgz<br />
cd rubygems-1.3.6<br />
ruby setup.rb</code></p>
<p>This installs the 'gem' binary to /usr/local/bin, so no need to update $PATH.</p>
<p>I won't go into detail about the various gems I installed, as apart from the obvious gems, these vary depending on your application(s) requirements. However, while installing gems, I did encounter problems with the mysql gem failing to compile as it required the libmysqlclient-dev package:</p>
<p><code>apt-get install libmysqlclient-dev<br />
gem install mysql -- --with-mysql-dir=/usr/bin/mysql_config</code></p>
<h3>Hello Joe!</h3>
<p>Before I continued with anything else, I installed my first and favourite Linux text editor - Joe!</p>
<p><code>apt-get install joe</code></p>
<p>Joe is quite paranoid and automatically creates backups of all modified files. This litters the filesystem with lots of files with names ending in ~, which gets irritating, fast. I disable auto-backups like so:</p>
<p><code>edit /etc/joe/joerc<br />
Find line containing 'Default local options'<br />
add under it '-nobackups'<br />
save</code></p>
<h3>Git</h3>
<p>Next up, version control, starting with Git.</p>
<p><code>apt-get install git-core</code></p>
<p>Running a private Git server using gitosis takes a little more work, so I'll point you in the direction of <a href="http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way">Garry Dolley's excellent tutorial</a>.</p>
<p>I did note while following this tutorial that python-setuptools had to be installed:</p>
<p><code>apt-get install python-setuptools</code></p>
<h3>Subversion</h3>
<p>I have a number of older projects which I have not yet ported to Subversion, so better install that too right?</p>
<p><code>apt-get install subversion</code></p>
<p>I like being able to browse my SVN repository in my browser, so I updated Apache with mod-DAV.</p>
<p><code>apt-get install libapache2-svn<br />
a2enmod dav</code></p>
<p>I don't want people snooping my source code, so next up was enabling SSL in Apache:</p>
<p><code>a2enmod ssl</code></p>
<p>I then created a new virtualhost for browsing the repository, with SSL and HTTP authentication:</p>
<pre><code>&lt;VirtualHost *:443&gt;
  ServerName my.host.name

  SSLEngine on
  SSLCertificateFile /path/to/certificate/file
  SSLCertificateKeyFile /path/to/certificate/key/file
  SetEnvIf User-Agent &quot;.*MSIE.*&quot; nokeepalive ssl-unclean-shutdown

  &lt;Location /&gt;
    DAV svn
    SVNPath /path/to/svn/repository/
    AuthType Basic
    AuthName &quot;Restricted Access&quot;
    AuthUserFile /path/to/password/file
    Require valid-user
  &lt;/Location&gt;

  ErrorLog /path/to/error/log
  CustomLog /path/to/access/log combined
&lt;/VirtualHost&gt;</code></pre>
<p>Note, there are still further steps here to setup the SSL certificate (I used self-signed certs) and the HTTP authentication password file. But I'll not go into detail on that, a quick Google search will reveal plenty of guides to doing both. </p>
<h3>Nginx</h3>
<p>Nginx is a slim and snappy web server, great for serving up static files super fast and acting as a reverse proxy to Rails application servers (e.g. Mongrel/Thin/Unicorn). While I often just stick with Apache as a web server, I've been experimenting with Nginx and so installed from source as follows:</p>
<p>Note: For rewrite in Nginx, the PCRE library had to be installed (See <a href="http://www.cyberciti.biz/faq/debian-ubuntu-linux-install-libpcre3-dev/">http://www.cyberciti.biz/faq/debian-ubuntu-linux-install-libpcre3-dev/</a>):</p>
<p><code>apt-get install libpcre3 libpcre3-dev</code></p>
<p>Download the latest stable source code from <a href="http://wiki.nginx.org/NginxInstall">http://wiki.nginx.org/NginxInstall</a>, extract, configure and compile.</p>
<p><code>tar xzfv nginx-0.8.53.tar.gz<br />
cd nginx-0.8.53<br />
./configure --with-http_ssl_module<br />
make<br />
make install</code></p>
<h3>Usergroups</h3>
<p>Simple system administration stuff, but I like to have a staff usergroup where I put all my users. This allows for assigning permissions more easily to this group, and in turn to those users (see the following section on SSH):</p>
<p><code>addgroup &lt;usergroupname&gt;<br />
adduser &lt;username&gt; --ingroup &lt;usergroupname&gt;</code></p>
<h3>Lock it down!</h3>
<p>SSH is the doorway into my server, so I like to keep it locked pretty tight. The following are a few tweaks I make to the default SSH Daemon configuration /etc/ssh/sshd_config:</p>
<p><code>Change: LoginGraceTime 120<br />
To: LoginGraceTime 40</code></p>
<p><code>Change: PermitRootLogin yes<br />
To: PermitRootLogin no</code></p>
<p>Disable password authentication in favour of RSA authentication (<a href="http://www.la-samhna.de/library/brutessh.html#2">read more</a> on setting this up).</p>
<p><code>Change: PasswordAuthentication yes<br />
To: PasswordAuthentication no</code></p>
<p>Under "Authentication:" add:</p>
<p><code>MaxAuthTries 3</code></p>
<p>If a staff group exists and it has existing users, add at the end of the file:</p>
<p><code>AllowGroups staff</code></p>
<p>Finally, after saving those changes, reload the SSH daemon so they take effect (double check all your changes first, as you might lock yourself out if you made a mistake):</p>
<p><code>/etc/init.d/ssh reload</code></p>
<p>Rainer Wichmann's write-up at <a href="http://www.la-samhna.de/library/brutessh.html">http://www.la-samhna.de/library/brutessh.html</a> is well worth reading for more SSH security tips.</p>
<h3>Monitoring</h3>
<p>Monitoring your critical services is a must for any production system, and as far as I'm concerned you need look no further than <a href="http://mmonit.com/monit/">monit</a>. I've played around with <a href="http://god.rubyforge.org/">God</a> and while writing your monitoring configuration with Ruby is nice, I found it unstable, buggy and the memory footprint far too large, as have <a href="http://blog.bradgessler.com/use-monit-with-rails-not-god">others</a>. Monit is proven, stable, lightweight and configuring it is a sintch.</p>
<p><code>apt-get install monit</code></p>
<h3>ImageMagick &amp; Friends</h3>
<p>If you do any kind of image manipulation in your Rails apps you'll inevitably need <a href="http://www.imagemagick.org/">ImageMagick</a> and <a href="http://rmagick.rubyforge.org/">RMagick</a> (or <a href="http://github.com/probablycorey/mini_magick">mini_magick</a>, <a href="http://seattlerb.rubyforge.org/ImageScience.html">ImageScience</a> etc).</p>
<p>Installing these can be a real pain (see OS X!), but thankfully I found it straightforward on Debian 5, with one gotcha, I had to use rmagick v2.12.2 as later versions refused to compile.</p>
<p><code>apt-get install imagemagick<br />
apt-get install libmagick9-dev<br />
gem install rmagick --no-ri --no-rdoc --version=2.12.2<br />
gem install mini_magick --no-ri --no-rdoc</code></p>
<p>Once all installed, remove libmagick9-dev and its dependencies as they are no longer needed:</p>
<p><code>apt-get remove libmagick9-dev<br />
apt-get autoremove</code></p>
<h3>Other bits and bobs</h3>
<p>The Wordpress Google Reader module I use on this site requires the PHP Curl module, installed as follows: </p>
<p><code>apt-get install php5-curl</code></p>
<p>Wordpress also needs mod-rewrite for pretty URLs:</p>
<p><code>a2enmod rewrite</code></p>
<p>I also tend not to use sudo, instead preferring to switch user to root after I SSH into the server, so I usually remove it:</p>
<p><code>apt-get remove sudo</code></p>
<p>And don't forget to update your server's hostname:</p>
<p><code>hostname desired-host-name</code></p>
<h3>Keeping things tidy</h3>
<p>Finally, a little bit of house cleaning to remove any cruft left behind by Aptitude. Who knows, you might need the extra disc space one day!</p>
<p><code>apt-get clean</code></p>
<p>And we're done!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abecto.com/2010/setting-up-a-new-vps-on-linode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New site up and running in no time!</title>
		<link>http://www.abecto.com/2010/new-site-up-and-running-in-no-time/</link>
		<comments>http://www.abecto.com/2010/new-site-up-and-running-in-no-time/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 17:22:48 +0000</pubDate>
		<dc:creator>Niall</dc:creator>
				<category><![CDATA[Site Updates]]></category>

		<guid isPermaLink="false">http://abecto.localhost/?p=4</guid>
		<description><![CDATA[In the words of DHH, "Woops, it worked, we're up and running!"
The power of Wordpress never ceases to amaze me.  In little over an hour, I've gone from an empty htdocs/ directory to a fully functional website with integrated Google Reader, Twitter and Github project feeds. Not bad.
I toyed with the idea of rolling my [...]]]></description>
			<content:encoded><![CDATA[<p>In the words of <a href="http://twitter.com/dhh">DHH</a>, <a href="http://www.youtube.com/watch?v=Gzj723LkRJY">"Woops, it worked, we're up and running!"</a></p>
<p>The power of Wordpress never ceases to amaze me.  In little over an hour, I've gone from an empty htdocs/ directory to a fully functional website with integrated Google Reader, Twitter and Github project feeds. Not bad.</p>
<p>I toyed with the idea of rolling my own new version of Abecto.com, but having played with Wordpress on <a href="http://www.redcafe.net/">RedCafe.net</a> for the Blog and Podcast sections, I knew I could get 90% of the features I wanted through it and so here we are.</p>
<p>The current theme is <a href="http://www.lightwordtheme.org/">Lightword</a> by Andrei Luca, one that caught my eye after some brief browsing of the available Themes from wp-themes.com.  I'll probably reskin with my own theme eventually, but for now, this is more than adequate.</p>
<p>This blog will be as much a resource for myself to remind me of things I have discovered and learnt, but too quickly forgotten.  If somebody somewhere out there finds it of value, all the better.</p>
<p>Enjoy your stay at Abecto.com v2!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abecto.com/2010/new-site-up-and-running-in-no-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

