Setting up your own LiveCode Server

This is a “simple” guide for helping you set up a low-cost but pretty powerful development server for your LiveCode development or live environment needs. It’s been a while since I started putting this guide together – but hopefully it will help. Any problems, leave a comment and I’ll see what I can do to help.

Why setup your own server?

While setting up your own server can seem like a daunting task, it does have a number of advantages:

  • You are in control of everything – you don’t have to worry about not being able to have access to features you may need
  • Dedicated resources
  • You can trouble shoot problems, probably faster than dealing with inexperienced tech staff
  • Cost (a great VPS should cost less than great shared hosting)
  • Install only what you want to
  • Upgrade software as and when you want to

Setting up your LiveCode Server

Sign up for an account at Digital Ocean (you should also get $10 in credits – good for 2 free of hosting)

Firstly, go through their tutorial on creating your first server: https://www.digitalocean.com/community/tutorials/how-to-create-your-first-digitalocean-droplet-virtual-server. Select the image that comes with Ubuntu and LAMP. Once you have completed this, you will have a fully functioning LAMP server.

Once this is complete, go through the tutorial on hardening your server: https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-12-04 (it’s for on older version of Ubunutu, but still good.)

This will leave you with a fully functioning server with good level of protection.

You are now ready for installing LiveCode and hooking it into Apache.

First add support for 32 bit libraries as LiveCode does not currently support 64-bit

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

Now install LiveCode Install LiveCode (credit to the comments by Russel Martin on http://lessons.runrev.com/spaces/lessons/buckets/809/lessons/36652-How-do-I-install-LiveCode-Server-on-Linux-with-Apache-)

We will install LiveCode Server to: /usr/lib/cgi-bin this directory should already exist

cd /usr/lib/cgi-bin

Install unzip as we will need to unzip the LiveCode

sudo apt-get install unzip

First check the LiveCode.com website for the latest version and substitute it below.

sudo wget http://downloads.livecode.com/livecode/6_7_0/LiveCodeCommunityServer-6_7_0_dp_4-Linux.zip
sudo unzip LiveCodeCommunityServer-6_7_0_dp_4-Linux.zip
sudo chmod a+x livecode-community-server

add a symlink so you can access this from anywhere on the server

sudo ln -s /usr/lib/cgi-bin/livecode-community-server /usr/local/bin/livecode-community-server

You now have to make a few adjustments to /etc/apache2/sites-enabled/000-default.conf

sudo nano /etc/apache2/sites-enabled/000-default.conf

Below “DocumentRoot /var/www/html” add the following 2 lines:

AddHandler livecode-script .lc
 Action livecode-script /cgi-bin/livecode-community-server

Now, at the bottom of the file, uncommment (by deleting the #) this line:

Include conf-available/serve-cgi-bin.conf

Save and exit

When I went through the entire process, apache refused to start, so to be on the safe side, run the following to commands (this will enable actions, cgi and mod_rewrite that you may need at some point:

sudo a2enmod actions
sudo a2enmod cgi
sudo a2enmod rewrite

You can now restart apache.

sudo service apache2 restart

We should now have a fully running LiveCode powered web server, create a test script and see if it executes.

sudo nano /var/www/html/test.lc

Type the following script, then save and quit. You should now be able to load up your web browser and view the script via: http://server-ip/test.lc – if all is in order your browser will show

put "hello world!"

You should now have a fully functioning LiveCode server, just no way to upload your scripts to the server, so there are still a few things left to do. Rather than installing a separate FTP client, we can use SFTP, which is not only easier, it is a much more secure solution.

Lets change the default directory used for storing web files as the current html directory is also owned by root and its a good practise to not use it.

sudo mkdir /var/www/webroot

Assign this new directory to the apache group

sudo chgrp www-data /var/www/webroot
sudo chmod g+s /var/www/webroot

Add our SSH user that we login with to the www-data group

sudo useradd -g www-data ssh-user-name

Now update the apache config to point to this directory

sudo nano /etc/apache2/sites-enabled/000-default.conf

Add umask to /etc/apache2/envvars

sudo nano /etc/apache2/envvars

add “umask 002” to the end of the file. Save and quit.

sudo service apache2 restart

If everything goes according to plan, you should be done. You should now be able to access files on your web server. You will also be able to login to your LiveCode Server via SFTP and manage your web server files via an application like FileZilla.

Good luck, and happy LiveCoding 🙂

Questions

Why DigitalOcean?

You can go with any server / vps provider you like, I went with Digital Ocean based on their price, server performance and their reputation.

Why Ubuntu?

Performance wise, there should be little performance difference between the different Linux distributions, I chose Ubuntu primarily as it’s probably the easiest Linux version to get help with should you run into problems.

3 thoughts on “Setting up your own LiveCode Server

  1. This is an interesting write up, I see its been a while since it was published has anything changed along the way? I am really very interested in running a cloud version of livecode server at digital ocean but to be honest the list of tasks seems like it would be better handed in a script rather than slogging along in the command line. Still quite interesting and thanks for publishing.

    1. Hi.
      Very little has changed. Once you are use to installing it, it goes pretty quickly. You also don’t need to install it very often. Happy you enjoyed it.
      – Simon

Leave a Reply