[racket] Some newbie trouble on running Web Server on EC 2

From: Noel Welsh (noelwelsh at gmail.com)
Date: Wed Apr 20 20:23:45 EDT 2011

On Wed, Apr 20, 2011 at 6:03 PM, J G Cho <gcho at fundingmatters.com> wrote:
> 1. Following along the system (aka '/more') tutorial: When evaluating
> (require readline), REPL sometimes hangs but not all the time.

Dunno.

> 2. Following along the blog webapp: When running model-3.rkt (sqlite3)
> fails due to missing something.  (libsqlite.so ?)  [I realize there is
> v5 now but this was done with sqlite v4 from PLanet per tutorial.
> Lots of warnings and complaints during require phase, it seems.]

Those warning would hopefully tell us what is going on. Reading the
source, the SQLite .so is loaded here:

http://planet.plt-scheme.org/package-source/jaymccarthy/sqlite.plt/4/6/sqlite-ffi.ss

Try the equivalent code and see if it works:

(require scheme/foreign)
(unsafe!)
(define sqlite (ffi-lib "libsqlite3"))

> Question is: Has anybody done this on EC2 or other 'cloud' platform?
> If so, I would love to hear/read about pitfalls.

Yeah. Works fine IME.

HTH,
N.

PS: Here is the important part of a Chef (http://www.opscode.com/)
recipe for installing Racket. I haven't used it for a little while,
but it worked last time I did. It also isn't as abstracted as I'd like
-- it hardcodes 5.0.2 at the moment.


require 'net/http'

package "g++"

# The version number to download
# String
racket_version =
  if node[:racket][:version] == :latest then
    "recent"
  else
    node[:racket][:version]
  end

# String
racket_type =
  if node[:racket][:type] == :textual then
    "-textual"
  else
    ""
  end

racket_base_path = "/installers/#{version}/racket#{racket_type}/"
racket_file =
  begin
    h = Net::HTTP.new("download.racket-lang.org", 80)
    resp, data = h.get(racket_base_path, nil)
  end


# Fetch Racket tarball
remote_file "/usr/local/racket-textual-5.0.2-src-unix.tgz" do
  source "http://download.racket-lang.org/installers/recent/racket-textual/racket-textual-5.0.2-src-unix.tgz"
  mode "0644"
end

directory "/usr/local/racket-textual-5.0.2" do
  mode "0755"
  action :create
end

script "install_racket-textual-5.0.2" do
  interpreter "bash"
  cwd "/usr/local"
#  user "kahu"
  code <<-EOH
  pwd
  ls
  tar zxf racket-textual-5.0.2-src-unix.tgz
  cd racket-textual-5.0.2/src
  mkdir build
  cd build
  pwd
  ../configure
  make
  make plain-install
  cd ../../bin
  ./racket -N raco -l- raco setup -D
  EOH
end

file "/usr/local/racket-textual-5.0.2-src-unix.tgz" do
  action :delete
end

directory "/usr/local/racket-textual-5.0.2" do
#  owner "kahu"
#  group "kahu"
  mode "0755"
end

link "/usr/local/plt" do
  to "/usr/local/racket-textual-5.0.2"
end



Posted on the users mailing list.