The Perfect Server [SOLVED]

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

The Perfect Server [SOLVED]

Post by sphere » Sun Oct 20, 2019 1:16 pm

Hi,

although i'm almost ready having my webpart build with html and php.
I'm trying to get LC server running on my VPS. It's not easy, the lesson on how to install it, is not actually current, one of the comments comes close, but still no joy.

On https://www.howtoforge.com/ you can find tutorials for several linux distributions with complete in depth howto's in combination with ISPconfig. (search for The Perfect Server on that site or just look under tutorials) i used Ubuntu 18.04 LTS server with Apache.

So it seems the apache things have to be set in ISPconfig onder the website options tab. This way it should not be needed to fiddle with any files.
With ispconfig you can setup multiple domains so you could play your own host. And this way you can allow LC server for just one domain.
It's not working yet, so i posted a few questions there, and hopefully figure it out.
When it works i'll post here of course.
Last edited by sphere on Sat Nov 02, 2019 3:27 pm, edited 1 time in total.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: The Perfect Server

Post by FourthWorld » Sun Oct 20, 2019 5:26 pm

Would a shell script to automate installation of LC Server on a VPS be useful?

Or an Ansible playbook?

I believe there's a Docker container out there already.

Installing LC by hand is a good thing to do once, to know how the parts come together. But production systems need to automated deployment for portability and recovery.

I had considered writing a shell script, but with all the benefits of modern containers I've been considering adopting Docker for deployments.

Too many compelling options. It's funny how all the freedom of choice we have in tech these days sometimes makes getting started hard as we sort through them all.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: The Perfect Server

Post by sphere » Sun Oct 20, 2019 5:48 pm

Perhaps a shell script would be usefull, but i'm not sure how it would go with ISPconfig running.

I also don't know i can use a docker. First have to check what it exactly does, as i just quickly checked it's a container with stuff in it, it seems.
But it's new for me.

I think i'm almost there, the last part is to let the server use lc server when .lc files are called. As that is still refusing, not when altering conf files and not when the apache directives are added in ISPconfig to the domain. Although ISPconfig also seems to be a cgi executable.

*edit* someone made one for ispconfig: https://hub.docker.com/r/jerob/docker-ispconfig/

and the one you've mentioned https://hub.docker.com/r/techstrategies/livecode

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: The Perfect Server

Post by FourthWorld » Sun Oct 20, 2019 6:18 pm

Is the ISPconfig dependency necessary?

I've been deploying LC on VPSes for more than a decade and I've never had to contend with that. I prefer to keep production systems pared down to the packages needed for customer delivery.

A solution dependent on a specific external package can be useful to some, but something that can run on any Linux system would benefit all VPS deployments.

That's not to discourage you from pursuing whatever works well within your configuration. But for myself, I'm most motivated to flesh out solutions that can help anyone running any stock Linux system, or at least a stock Debian-based system, but I can't afford the time to help with anything more restricted than that.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: The Perfect Server

Post by sphere » Sun Oct 20, 2019 7:38 pm

No it's not necessary to have ISPconfig, but for me it was my first VPS set-up ever. It's as you know completely different than running Xampp or the like packages, or even separate Apache and php packages on local Windows or other OS.
And there are several setup tutorials for centos debian ubuntu with also a good support via their forum. So it's a good place to start.

For me it's not even needed to run an website there, i only have my php files as middle-ware to connect to the DB.
I wanted the DB total separate from the main website, as the mobile app also uses the DB on the VPS.
And will now only put some html/php and html/lc files there, but run them via an i-frame on another site.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: The Perfect Server

Post by FourthWorld » Sun Oct 20, 2019 8:33 pm

That makes good sense for what you're doing. And that's why I haven't take the time to write a shell script to automate LC Server installs. So many devs are doing so many different things that attempting a single solution becomes difficult to justify.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: The Perfect Server

Post by sphere » Sun Oct 20, 2019 10:10 pm

I totally agree

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: The Perfect Server

Post by sphere » Wed Oct 30, 2019 1:19 pm

Had no luck yet with altering some conf files.
So i will try if i can do similar as with xammp which is working.
Seems on the other forum from ISPconfig they are out of options too.

Mostly it is something simple in hindsight.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: The Perfect Server

Post by FourthWorld » Wed Oct 30, 2019 4:19 pm

If you wish to bypass ISPconfig and work directly with Apache via shell, the LC Server installation lesson works well on Ubuntu.

If you run into any snags with it (missing an a2enmod command is common) I may be able to help with a stock setup.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: The Perfect Server

Post by sphere » Wed Oct 30, 2019 10:01 pm

Thanks Richard very kind, i will just try for a few days more :)

I'm trying according the .htaccess lesson now and have reversed the conf version.
Also reversed the ispconfig version. When one added a website in ispconfig, you can add apache directives specific for that website, so i removed that.

Module actions and cgi are already enabled

First the server was placed here:
/var/www/clients/client1/web1/cgi-bin/livecode-community-server

The index.php or index.lc are here: /var/www/clients/client1/web1/web
Now i added a folder cgi-bin into the web folder

Now i had a 404 and now an error 500 so we're getting somewhere i guess.

I also read some threads where someone had luck by putting .cgi behind livecode-community-server and change it also in .htaccess accordingly

will try some more

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: The Perfect Server

Post by FourthWorld » Wed Oct 30, 2019 10:22 pm

At the point you're at 500s are probably related to permissions. Setting the engine to 755 may help if you haven't done that already. Some configurations require setting the cgi-bin folder to 644 also.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: The Perfect Server

Post by sphere » Wed Oct 30, 2019 10:33 pm

i just checked, the permissions are set, also for the server file itself.

I noticed that even for a index.html file i get an error 500 when using the .htaccess file

it contains:

Code: Select all

#Options ExecCGI FollowSymLinks
AddHandler livecode-script .lc
DirectoryIndex index.irev index.lc index.php index.html
Action livecode-script /web/cgi-bin/livecode-community-server

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond $1 !^(index\.lc|image|img|assets|robots\.txt|css|js)
  RewriteRule ^(.*)$ index.lc?/$1 [L]
</IfModule>
will try tomorrow again,thx!

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: The Perfect Server

Post by sphere » Sat Nov 02, 2019 3:25 pm

Yes!! got it running finally, never give up. :mrgreen:
So got 2 choices which both work: alter 2 scripts on the server or alter 1 script and add a piece to ISPconfig website-->option tab
I tested them both and work ok now pfeew!

First i added a folder cgi-bin into /var/www/clients/client1/web1/web/ so i'm not using the cgi-bin which is already in web1, and copied the LC server into it

i added this to 000-default.conf which is in etc/lib/apache2/sites-available (make a backup of the file first)
You need this else either choice below will not work:

Code: Select all

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

Then added this to mywebsite.nl.vhost (which is also in etc/lib/apache2/sites-available)(make a backup first) just before the rewrite part in both the 80 and 443 (http/https) section:
Or the other choice is when using ISPconfig add this to the website-->options tab into the Apache directives

Code: Select all

	#livecodeserver#
<Directory /var/www/clients/client1/web1/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
AddHandler livecode-script .lc
Action livecode-script /livecode-cgi/livecode-community-server
</Directory>

<Directory /var/www/clients/client1/web1/web/cgi-bin>
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

ScriptAlias /livecode-cgi/ /var/www/clients/client1/web1/web/cgi-bin/
###############
But most important here was the ScriptAlias which was pointing to the wrong dir and does not need quotes and neither the lc-community-server at the end
I blindly copied it from the LC lessons, but examining the vhost script which also contains directives to perl and apache it becomes clear it's not correct
.htaccess is not needed

then sudo service apache restart in Putty terminal
and run a test lc script like https://mywebsite.com/hello.lc

This lesson needs a massive update: http://lessons.livecode.com/m/4070/l/36 ... ith-apache

keliko
Posts: 85
Joined: Thu Aug 01, 2019 8:15 am

Re: The Perfect Server [SOLVED]

Post by keliko » Tue Jun 02, 2020 9:20 pm

Hai Sphere,

can you share step by step install livecode server via vps. This will really help us all.

Thanks

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: The Perfect Server [SOLVED]

Post by sphere » Tue Jun 02, 2020 9:43 pm

Hi Keliko,

installing the LC server is not so difficult, it's merely unzipping and copying to the correct cgi folder.
the difficulty is in the script aliases like in the post above.

And that can be different per vps setup.

What is the point where you are stuck, maybe we can help, I'm not an expert on Linux, it's trial and error and some basics i know or find.
Last edited by sphere on Wed Jun 03, 2020 11:59 am, edited 1 time in total.

Post Reply

Return to “CGIs and the Server”