Play compile error – java.util.NoSuchElementException: Either.left.value on Right

Got this mysterious error when trying to build a scala play solution containing multiple projects (common projects which the play projects had dependencies on):

[error] {file:/mnt/jenkins/workspace/myproj/}mysubproj/compile:sources: java.util.NoSuchElementException: Either.left.value on Right

Turned out the problem was I hadn’t specified the scala version for the common projects, so they were being built with scala 2.9.2 while the play projects tried to build with 2.9.1, causing the issue.

Fixed it by specifying the scala version for all projects in my Build.scala:

scalaVersion := "2.9.1"
Advertisements

Capistrano for Ruby/Sinatra deployments onto server without source access

I put off using Capistrano as I thought it would take as much effort to learn as msbuild or ant, but after trying it I regret not doing it sooner. It’s really simple to use, has great source integration and offers a very reliable process for deployments using ssh onto unix boxes. It works well with other languages/frameworks, so you can also deploy your Java/Scala/php projects. The focus of this post is deploying a simple Ruby/Sinatra app from git onto a server which doesn’t have direct access to source (e.g. private git host).

To use you will need SSH access to your servers

First install Capistrano:

gem install capistrano

Prepare your project (in project dir, will generate default deployment files):

capify .

Ignore the Capfile created, it’s pretty standard and you shouldn’t have to touch it. Edit the config/deploy.rb file and clear down, this contains some standard Rails deployment stuff which you won’t need.

set :application, “My Sinatra Application”

set :scm, :git

set :repository,  “git@github.com:mygit/myproject.git”

set :deploy_via, :copy # makes capistrano clone and copy source locally rather than on server

set :deploy_to, “/var/www/mysite.com” # current release will be symlinked in ‘/var/www/mysite.com/current’

set :user, “deploy” # user used to ssh onto server and perform tasks

server “mysite.com”, :app, :web, :db, :primary => true # server to deploy to, must be able to “ssh deploy@mysite.com”

set :use_sudo, false # whether to use sudo on deploy actions

namespace :deploy do

  task :restart, :roles => :web do

    run “echo this is where the actions necessary to restart the application should go”

  end

  task :finalize_update, :roles => :web do

    # Overwrite default rails action and perform any steps before symlink

    run “echo this is the path to the release folder #{ current_release }”

  end

end

Run setup before deployment to create deployment folders:

cap deploy:setup

Check:

cap deploy:check

Deploy!

cap deploy

Now you should have your application copied over to the server under the :deploy_to ‘current’ folder. Old releases (default 5) will be stored in the ‘release’ folder. You can use the restart task to call any commands necessary to restart the application. You can do a lot more complex things, like setup dbs, stage multiple servers simultaneously, tag release in source etc.

Useful links:

Windows XP IE6/IE7 cannot use SSL when hosted on servers with multiple SSL sites

Users reporting SSL certificate errors? They’re on Windows XP IE6/IE7? Other users not seeing the same issues, even on Vista IE7?

Confused? I was. Turns out the answer is pretty simple and well known, IE is crap. Specifically IE7 and lower on Windows XP does not support SNI (Server Name Indication).

This means that if you are hosting your HTTPS site on a server with other sites using HTTPS (port 443) IE will not tell your web server which subdomain to look for when requesting the certificate (e.g. give me the cert for  mysite1.com versus mysite2.com, like it does when making the normal request). So your web server returns the first one under port 443 that matches, because it has nothing to id the target configuration. If this is the incorrect cert it won’t match the domain and IE will give an SSL error.

There’s no smart way around this, nothing can force the client to send the right info in the certificate request, so if you want your SSLs to work for older machines you need to split out your sites onto different machines.