The perfect LiveCode cloud server

So what does it take to build the perfect cloud server? Everyone has their own ideas, preferences and software requirements. Many developers also need a server solution but want to just focus on coding and not having to worry about the intricacies of setting up and managing their own server.

While the following solution may not solve everyone’s needs, I think it comes pretty close to being the perfect cloud server and if you are also wanting to get started with your own cloud based server – this is well worth considering. Easy to setup, easy to manage combined with great performance. And if you follow the walk through below – it won’t cost you anything to get started.

So how did I go about setting up the perfect cloud server? Let me walk you through everything.

Part 1 – The server

For the server, we need to setup a droplet with Digital Ocean. Starting at only $5 – they are a great value wise and work fantastically. (My last server has run for 2 years since I first booted it up, without any issues or reboots)

If you are just starting with running your own server, I would suggest starting with the $5 option as you can scale it up when ever you need, or even migrate to a new server. There is one requirements in terms of the operating system, you need to make sure that you use Ubuntu 16.04.2 x64. Don’t underestimate what you can run on a $5 server.

Part 2 – Setting up the server & the control panel

So now we have a server, we still need to configure everything and setup a web server, MySQL and install a control panel to manage the server. Don’t worry this is much easier than it sounds – and you won’t have to manually edit anything on the server. You won’t even need to login to the server until we need to configure LiveCode.

I have gone with ServerPilot. It’s a simple, easy to use control panel designed for Digital Ocean server’s. It includes Nginx in front of Apache and supports PHP 5.4, 5.5, 5.6, 7.0, and 7.1. and best of all – there is no manual configuration we need to do. And the performance is great.

While ServerPilot is designed for PHP and WordPress based websites, once we are setup, we can install LiveCode on a per app basis (Server Pilot calls sites “apps”) – giving an almost perfect cloud based solution for hosting LiveCode.

Once you have signed up for a an account at ServerPilot you simply add the details or your newly created droplet and they will automatically do everything we need to get our server up and running. Best of all, we will be using their free option – so setting up our control panel and configuring our server costs us nothing and take only a minute or two.

While the free option does have some limitations it is perfect to get going and once you start hosting a few sites and apps, it may well be worth upgrading the control panel.

While the server we are creating is indeed powerful and apps can send email, ServerPilot does not install a mail server and does not advice it either. If you are needing to host email address you will need to use an external provider.

The servers also do not handle DNS. You can use Digital Oceans DNS service for this, or a service like CloudFlare. One of the advantages of CloudFlare is their free SSL solution.

Part 3 – LiveCode

So after giving this a bit of thought, I have gone with setting up LiveCode on an site by site (app by app) basis. The advantage of this approach is being able to run different version LiveCode on different apps. While the installation does require that it is setup for each app and means logging into the server and editing a file or two, restarting Apache etc, it is not to difficult to do.

The Walk Through

I have used affiliate links below – as both Digital Ocean and ServerPatrol offer a $10 credit – perfect for trying out everything – at no cost.

Step 1. Sign up for Digital Ocean

Sign up for an account at Digital Ocean. Use the link below and receive $10 in credit

Signup and get $10 credit

Step 2. Create a droplet

Once you have signed up at Digital Ocean, create a droplet, by clicking “Create Droplet”

You need a blank server running Ubuntu 16.04.2 x64

Choose any region

Choose any extra’s you may want – for now, I would recommend taking the backups option.

Ignore the SSH Keys

Finalise and create your droplet. Once your droplet is created, you will receive an email with the login details for the server.

Step 3. Sign up at ServerPilot

Sign up at serverpilot.io. Use the link below and receive $10 in credit.

Signup and get $10 credit

Step 4. Link your droplet

Now we need to link the droplet in step 2 to Server Pilot. Login in to Server Pilot and click “connect server”.

Enter in the details for your server you received via email from Digital Ocean.Once you gone through this, you will now be able to administer your newly created cloud server through Server Pilot’s admin panel.

From here you can add websites and look after your server

Step 5. Adding your first site / app

In ServerPilot, click the server link to manage servers and select your server from the server list.

Click the “Create App” button

Fill in the form on the next page with all your details of your app / web site.

When you click “Create App” the hosting for your app will be created. From here you can create databases and SSH / SFTP into the server, and of course enable LiveCode.

Step 6. Enabling LiveCode

By now, we have created a phenomenal web server, setup a great control panel and not have to edit any configuration files.

Unfortunately to get LiveCode running, we have no choice but too. Time to dust off the old SSH client and get to work.

For the first part, we need to create and enable the CGI-BIN directory.

You need to SSH into the server as root and create the following file:

/etc/apache-sp/vhosts.d/APPNAME.d/cgi-bin.conf

replacing APPNAME with the name of your app.

Once the file has been created, you need to edit the file and add the following:

Define CGI_BIN ${DOCUMENT_ROOT}/../cgi-bin/
ScriptAlias /cgi-bin/ ${CGI_BIN}
<Directory ${CGI_BIN}>
 Require all granted
</Directory>

Once the file has been created,  you need to restart Apache by running this command as root:

sudo service apache-sp restart

And logout of SSH.

Now we need to create the actual cgi-bin directory and to do so we must now SSH in as the app’s system user. If you have a default / free installation, it is “serverpilot”

Once logged in as serverpilot, create the cgi-bin directory with these commands:

mkdir ~/apps/APPNAME/cgi-bin
chmod 755 ~/apps/APPNAME/cgi-bin

You can now upload the LiveCode community server into the newly created cgi-bin directory. I just FTP’d it. You can download it from http://downloads.livecode.com/livecode/ and make sure you take the Linux 64 option.

Once its downloaded, you can change to the cgi-bin directory , once again substituting APPNAME for the name of your app and then running chmod

cd ~/apps/APPNAME/cgi-bin
chmod 755 livecode-community-server

The last step is to create an .htaccess file in the site root of our app, with the following contents.

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

We can now create a simple LiveCode file and test to see if LiveCode is running – good luck

 

Leave a Reply