Tuesday, March 27, 2007

Hosting at zabor.org is down

sparklin' drops of spring by Steve took it from flickr (CC-NC-SA)Server I used to host most of my projects - zabor.org, is down for a few days now. At first I thought the problem is temporary, but it seems it's going to stay down for good. All data that was there is on my box, but it's somewhat messy, and it will take a few hours before I get it all back. Anyway, a new website is coming. It's going to be faster, better, more automatic, and with real backup. I want to get to the point where I can simply say rake website and all my packages will be checked out, built, tested, packaged, and uploaded together with updated HTML files. I'd also like to have add some WWW::Mechanize or firewatir-based website testing to make sure everything works as expected. Testing by hand is so 1990s. Well, at least it's a good excuse to learn firewatir. New hosting servers are: Thanks to balrog kun for providing hosting zabor.org, and to pio and anubis for new hosting servers. Extra hosting servers are of course welcome :-) To make this post a little less boring, here's fragrement of the Rakefile which builds the website, which is then uploaded to all servers:
website_root = "/home/taw/website"

PROJECTS = %w[jrpg jrpg2 magic_xml magic_help rlisp]

PROJECTS.each do |project|
   #desc "Create #{website_root}/#{project} directory"
   file "#{website_root}/#{project}" do
       mkdir_p "#{website_root}/#{project}"
   end

   desc "Remove old website files for #{project}"
   task :"clean_#{project}" do
       rm_rf "#{website_root}/#{project}", :verbose => true
   end

   desc "Fix permissions of #{project}'s website"
   task :"pub_#{project}" do
       sh "pub #{website_root}/#{project}"
   end

   desc "Build #{project}'s index.html"
   task :"#{project}_index" do
       sh "eruby <#{project}/index.rhtml >#{website_root}/#{project}/index.html"
   end
end

desc "Build everything that can be built automatically (for testing)"
task :test_build => [:jrpg_package, :jrpg, :jrpg2, :rlisp]

desc "Clean everything"
task :clean => PROJECTS.map{|project| :"clean_#{project}"}

def package(glob, dir="packages")
   return glob.map{|g| package(g, dir)} if glob.is_a? Array
   Dir.glob("#{dir}/#{glob}").sort[-1]
end

def rake_remote(dir, *actions)
   Dir.chdir(dir) { sh "rake", *actions }
end

# JRPG
desc "Build jrpg website (doesn't build package automatically)"
task :jrpg => [:clean_jrpg, "#{website_root}/jrpg", :jrpg_index, :jrpg_files, :pub_jrpg]

desc "Copy jrpg image and package files to website"
task :jrpg_files do
   files = Dir["jrpg/jrpg_new_screenshot*.{jpg,png}"] +
           package(["jrpg-20*-*.tar.gz", "jrpg-20*-*.zip", "jrpg-windows-20*.zip"])
   cp files, "#{website_root}/jrpg"
end

# jrpg packages are not built automatically
# It is not possible, as Windows package needs to be build by hand
desc "Build jrpg packgae"
task :jrpg_package do
   rake_remote "../jrpg/", "package"
   mv package(["jrpg-*-*.tar.gz", "jrpg-*-*.zip"], "../jrpg"), "packages/"
end

# JRPG 2
desc "Build jrpg2 website and packgae"
task :jrpg2 => [:clean_jrpg2, "#{website_root}/jrpg2", :jrpg2_index, :jrpg2_files, :pub_jrpg2]

desc "Copy jrpg2 image and package files to website"
task :jrpg2_files do
   files = Dir["jrpg2/jrpg2_*.{jpg,png}"] + package(["jrpg2-*.tar.gz", "jrpg2-*.zip"])
   cp files, "#{website_root}/jrpg2/"
end

desc "Build jrpg2 package"
task :jrpg2_package do
   rake_remote "../jrpg/", "package2"
   mv package(["jrpg2-*-*.tar.gz", "jrpg2-*-*.zip"], "../jrpg"), "packages/"
end

# RLisp
desc "Build RLisp website (doesn't build package automatically)"
task :rlisp => [:clean_rlisp, "#{website_root}/rlisp", :rlisp_index, :rlisp_files, :pub_rlisp]

desc "Copy RLisp package files to website"
task :rlisp_files do
   cp package(["rlisp-*.tar.gz", "rlisp-*.zip"]), "#{website_root}/rlisp/"
end

desc "Build RLisp package (NOT TESTED YET)"
task :rlisp_package do
   rake_remote "../rlisp/", "package"
   mv package(["rlisp-*-*.tar.gz", "../rlisp/rlisp-*-*.zip"], "../rlisp"), "packages/"
end

No comments:

Post a Comment