Post

Installing WebDSL

In DSLs on January 11, 2010 by guwac Tagged: , , ,

WebDSL is a domain-specific language for the implementation of dynamic web applications. It consists of a core language with constructs to define entities, pages and business logic. Higher-level abstractions, modelling access control and workflow, are defined in a modular fashion as extensions of the core language. To develop your own web applications with WebDSL, you need two things: The WebDSL tools and a runtime for web applications.

I needed to install both on a Mac running Snow Leopard. Here is how it works.

1. Installing Apple’s Xcode Developer Tools.

Xcode is Apple’s development environment for Mac OS X. You will find an installer on your Snow Leopard installation DVD and on the Apple Developer Connection site. Make sure to install the optional components for Unix development. Next, you should install the latest software updates for Mac OS X and Xcode by running Software Update.

2. Installing MacPorts.

MacPorts is a free and open-source package management system that simplifies the installation of open-source software on a Mac. Follow the instructions on the MacPorts installation site. For me, the Snow Leopard Package installer worked fine. Make sure to update MacPorts by running

sudo port -v selfupdate

Afterwards, your ~/.profile file should include this line:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

3. Installing Nix.

Nix is another free and open-source package management system. In order to build Nix from source, you will need some tools which can easily be installed with MacPorts:

sudo port install curl m4 autoconf automake pkgconfig libtool

Now, you should get the source of the latest development release of Nix. After extraction, switch to the source directory and build Nix using these commands:

./configure
make
sudo make install
sudo chown -R $USER /nix

Next, you need to add these lines to your ~/.profile file:

. /usr/local/etc/profile.d/nix.sh
export PKG_CONFIG_PATH=~/.nix-profile/lib/pkgconfig:$PKG_CONFIG_PATH

4. Installing WebDSL.

WebDSL is continuously built, tested and released by Hydra, a Nix-based continuous build system. You register for the latest builds by running these commands:

nix-channel --add http://hydra.nixos.org/channel/latest
nix-channel --update

Now, you can install the latest build of WebDSL:

nix-env --system-filter x86_64-darwin -i webdsl

The --system-filter x86_64-darwin option ensures that you get the 64-bit version appropriate for Snow Leopard. Since 64-bit pointers need some space, you need to increase the stack size. Add this line to your ~/.profile file:

ulimit -s 64000

5. Installing Apache Tomcat.

Apache Tomcat provides a web server environment. In this environment, you can run your web applications developed with WebDSL. You should download the Binary Distribution Core from the Apache Tomcat Download Page. Extract the archive to an appropriate directory. Include the bin subdirectory to your PATH environment in your .profile file:

export PATH=YourInstallationDirectory/bin:$PATH

6. Installing MySQL.

MySQL is a relational database management system. Your WebDSL applications rely on it for data persistence. You can download a package installer for the current version of the MySQL Community Server. Make sure to get the 64-bit version and run the package installer. Furthermore, you should install the preference pane by double-clicking it. For more details, see the installation instructions. Update your PATH environment in your .profile file:

export PATH=usr/local/mysql/bin:$PATH

7. Test your installation.

Now it’s time to test your installation. First, start Tomcat:

startup.sh

Next, start MySQL from the MySQL preference pane:

You have now a working runtime environment for dynamic web applications. In order to test WebDSL, create a sample application by running

webdsl new

You need to provide some information. In most cases, default values work fine. Here is a sample configuration (bold user input):

Application name (one word): test
---- Database information ----
You will now be asked for database info such as hostname, username, password and database. Do note that this script will check if this information is valid, if it is not, it will attempt to create the database with the given username and password for you.
MySQL Host [localhost]:
MySQL Username [webdsluser]:
MySQL Password []:
MySQL Database [webdsldb]:
Hibernate database mode (create-drop / update / false) [create-drop]
Now checking if database info works.
Enter password:
Unsuccessful, will now attempt to create database. For this we need your MySQL's root password (by default this is blank).
MySQL root password:
Now checking if database creation worked...
Enter password:
Yes!
Do you want to configure your application for sending email? [y/n] n
---- Tomcat information ----
Tomcat path for deployment [/opt/tomcat]: /Users/guwac/Programs/apache-tomcat-6.0.20
Now creating bare-bones application in application.app...
override r--r--r-- guwac/staff for APPLICATION_NAME.app? n
Application created in application. You can now cd to this directory and call the webdsl script to compile your program.

You can now build and deploy the test application:

cd test
webdsl build
webdsl deploy

If everything worked fine, the test application is running at http://localhost:8080/test. Finally, you can stop MySQL from the MySQL preference pane and stop Tomcat by running

shutdown.sh

8. Have fun.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.