Source

racket-bertrpc-demo /

Filename Size Date modified Message
blog-bertrpc-server
blog-web-server
45 B
2.1 KB
365 B

racket-bertrpc-demo

A project demonstrating usage of racket-bertrpc, a BERT-RPC client library implementation for Racket language.

Installation

  1. Create the blog database, tables, user, grants

    1. Create database:

      mysql> create database blog character set = 'utf-8';
      
    2. Create database tables:

      $ mysql -u root -p -D blog < blog.sql
      
    3. Create database user, grant privileges:

      mysql> CREATE USER 'blogfu'@'localhost' IDENTIFIED BY 'hackme';
      mysql> GRANT INSERT, SELECT, DELETE ON blog.* TO 'blogfu'@'localhost'
                   IDENTIFIED BY 'hackme';
      
  2. Obtain a copy of erlang-mysql-driver and install it:

    1. Extract erlang-mysql-driver files to Erlang libraries path /usr/local/lib/erlang/lib/mysql-driver/ (YMMV). Let's call this directory $MYSQLDRV.

    2. Compile erlang-mysql-driver source files in $MYSQLDRV/src and put them to $MYSQLDRV/ebin/:

      $ sudo erlc ./src
      $ sudo mkdir ebin && mv ./src/*.beam ./ebin
      
    3. Run Erlang shell and make sure that module mysql is loaded:

      1> mysql:module_info().
      [{exports,[{log,4},
                {start_link,5},
                {start_link,6},
                {start_link,7},
                {start_link,8},
                {start,5},
      ...
      
  3. Install ernie, a BERT-RPC hybrid Erlang/Ruby server

    $ sudo gem install bertrpc RUBYOPT=rubygems
    

    You should now be able to use command ernie on your console. If not, your gem was not installed properly.

  4. Change the working directory to blog-bertrpc-server and run the BERT-RPC blog server:

    $ ernie -p 9999 -c blog.cfg -E '-run blog start_mysql'
    
  5. Run Racket application:

    $ racket -t blog.rkt
    
  6. Have fun! :-)

Copyright (c) 2011 Yasir M. Arsanukaev. See LICENSE for details.