How to deploy Rails on Windows, NOT!

Vlado Cingel / vlado@cingel.hr

Requirements

  • Easy way to manage projects, employees, clients, cooperators
  • Easy to keep content up to date
  • Multilingual
  • Make it look pretty
  • They don't want to move from their server (Windows)

Deploying Rails on Windows servers

http://weblog.rubyonrails.org/2006/5/11/deploying-rails-on-windows-servers
Most Rails applications are deployed in a Unix server environment. Tools like Capistrano make this dead easy. For those working in a Windows environment, deployment can get considerably harder. The good news is that it’s still possible and just got a lot easier.

Deploying Rails on Windows servers

http://weblog.rubyonrails.org/2006/5/11/deploying-rails-on-windows-servers
Brian Hogan has developed a series of articles with instructions for various methods of deploying Rails applications in a Windows server environment.

http://napcs.com/howto/rails/deploy

Deploying Rails on Windows servers

http://napcs.com/howto/rails/deploy
  • Serving Multiple Rails Applications on Windows with Apache and Mongrel
  • Integrate Rails into an Existing IIS Web infrastructure using Apache and FastCGI
  • Integrate Rails into an Existing IIS Web infrastructure using Mongrel
  • Integrate Rails into an Existing IIS Web Infrastructure using Lighttpd and Mongrel

Other solutions

  • JRuby?
  • Microsoft technology?
  • ...

WINDOWS

I HAVE AN ...

Standard Rails hosting

+

Point www.hidroing-os.hr to it

Content input problem?

And the winner is ...

Phrasing

  • Content management system solved :)
  • Multilingual site solved :)
  • Easy to make mistakes on live site :(

I HAVE ANOTHER ...

Standard Rails hosting

+

Generate and copy HTML to Windows server

Generate HTML ...

wget http://example.com \
--domains example.com \
--recursive \
--page-requisites \
--no-clobber \
--html-extension \
--convert-links

... AND COPY TO WINDOWS

class NewReleaseWorker

  def perform
    require 'ftp_sync'

    domain = ENV['HIDROING_DOMAIN_NAME']
    login = ENV['HIDROING_FTP_LOGIN']
    password = ENV['HIDROING_FTP_PASSWORD']
    wget_domains = ENV['WGET_DOMAINS']
    wget_host = ENV['WGET_HOST']

    timestamp = Time.now.strftime("%Y%m%d%H%M%S")
    local_root = "#{Rails.root}/tmp/site/#{timestamp}"

    msg "Downloading site to #{local_root}"
    FileUtils.mkdir_p(local_root)
    run("wget --domains #{wget_domains} --recursive --no-parent --html-extension --convert-links --restrict-file-names=windows #{wget_host}/index -P #{local_root}")

    release_dir_name = Dir.entries(local_root).select { |e| !e.start_with?(".") }.first

    ftp = FtpSync.new(domain, login, password, passive: true)
    ftp.push_dir "#{local_root}/#{release_dir_name}", "hidroing-os.hr/wwwroot/cingel"
  end

  private

  def msg(text)
    puts "[NewReleaseWorker] #{text}"
  end

  def run(command)
    msg "Running #{command}"
    system command
  end

end

More info

  • Rails app deployed on Heroku
  • DelayedJob + Workless
  • HTTP Basic authentication
  • wget
  • Ruby FtpSync
  • Zurb Foundation 5 (for frontend and backend)
  • Select2
  • Cloudinary (+Attachinary)
  • Phrasing
  • Rollbar

THANK YOU!

QUESTIONS?

vlado@cingel.hr