Embedded web application stack

Created: by Pradeep Gowda Updated: May 22, 2020 Tagged: embedded · lua

As I discussed previously, we will get down to installing the components of the stack. For easy recognition, i call this stack – rugosa.

File system structure

We are going to put the rugosa stack under the $HOME directory.

    $ cd
    $ mkdir rugosa && cd rugosa
    $ mkdir -p bin etc logs run src sbin www/cgi-bin
    $ cd src
    # get lua and compile it
    $ wget -c http://www.lua.org/ftp/lua-5.1.4.tar.gz
    $ tar -zxvf lua-5.1.4.tar.gz
    $ cd lua-5.1.4
    $ make linux
    $ cd $HOME/rugosa/src
    # get haserl and compile it
    $ wget -c http://iweb.dl.sourceforge.net/project/haserl/haserl-devel/0.9.27/haserl-0.9.27.tar.gz
    $ tar -zxvf haserl-0.9.27.tar.gz
    $ cd haserl-0.9.27
    $ ./configure --enable-luashell --with-lua=/home/pradeep/rugosa/src/lua-5.1.4/src/ --with-lua-headers=/home/pradeep/rugosa/src/lua-5.1.4/src/
    $ make
    $ cp src/haserl ../../bin
    $ cd $HOME/rugosa/src
    # get thttpd and compile it
    $ wget http://www.acme.com/software/thttpd/thttpd-2.25b.tar.gz
    $ tar -zxvf thttpd-2.25b.tar.gz
    $ cd thttpd-2.25b
    $ ./configure
    $ make
    $ cp thttpd $HOME/rugosa/sbin
    $ cp cgi-bin/* $HOME/rugosa/www/cgi-bin
    $ cd $HOME/rugosa
    $ cat > etc/thttpd.conf
        # run the server. I'm keeping the port no. high so that you don't need supervisor permissions, yet.
        $ thttpd -C etc/thttpd.conf

visit http://localhost:8080/cgi-bin/printenv. If you see the CGI environ variables printed, your thttpd is up and serving CGI content!

What’s next:

  • Hello, World! with Rugosa
  • Web programming with shell scripting languages (eg:bash)
  • CGI web programming with Lua
  • A CGI app to configure network setting(s) on your device.