Using MySQL on (headless) Linux

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Using MySQL on (headless) Linux

Mark Wieder via use-livecode

With thanks to friends here who helped me install and start using LC on a
headless Linux box. I've now another little problem... my stack tries and
fails to connect to a MySQL database.

When it attempts to call revOpenDatabase, it throws error 219, "error in
function handler". I take it that this means it can't find or hasn't loaded
the revdb external.

I've installed livecodecommunity-9.6.1.x86_64, and I launch it with
   ~/.runrev/components/livecodecommunity-9.6.1.x86_64/LiveCode\
Community.x86_64 -ui <mystack.livecode>

I can see revdb.so and dbmysql.so are in the Externals directory. Is there
something explicit I need to do to load these?

many thanks,

Ben

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
On 2/1/21 11:15 AM, Ben Rubinstein via use-livecode wrote:

>
> With thanks to friends here who helped me install and start using LC on
> a headless Linux box. I've now another little problem... my stack tries
> and fails to connect to a MySQL database.
>
> When it attempts to call revOpenDatabase, it throws error 219, "error in
> function handler". I take it that this means it can't find or hasn't
> loaded the revdb external.
>
> I've installed livecodecommunity-9.6.1.x86_64, and I launch it with
>    ~/.runrev/components/livecodecommunity-9.6.1.x86_64/LiveCode\
> Community.x86_64 -ui <mystack.livecode>
>
> I can see revdb.so and dbmysql.so are in the Externals directory. Is
> there something explicit I need to do to load these?

"error in function handler" is a pretty generic response - sort of the
engine's version of ¯\_(ツ)_/¯. Is the MySQL database local to the server
machine or on a different computer? Does this work locally before moving
the stack to the headless linux box?

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
Hi Mark,

 > "error in function handler" is a pretty generic response - sort of the
 > engine's version of ¯\_(ツ)_/¯. Is the MySQL database local to the server
 > machine or on a different computer?

I should point out that this error is thrown - I take it to mean that the
function isn't even located. I don't think the problem is with the details of
the database connection, I don't think it gets that far.

To test this, I've added a call to revOpenDatabases before doing anything else
- sure enough, this throws the same error.

 > Does this work locally before moving the
 > stack to the headless linux box?

The whole shebang works on my Mac. I tried to see if I could run LiveCode
headless on Mac, to minimise the differences that might be at issue, and got
        Startup error - cannot run in command line mode

I don't know if that's a generic issue that LiveCode can't run headless on
Mac, or if there's something else going on there.

Ben


On 01/02/2021 19:37, Mark Wieder via use-livecode wrote:

> On 2/1/21 11:15 AM, Ben Rubinstein via use-livecode wrote:
>>
>> With thanks to friends here who helped me install and start using LC on a
>> headless Linux box. I've now another little problem... my stack tries and
>> fails to connect to a MySQL database.
>>
>> When it attempts to call revOpenDatabase, it throws error 219, "error in
>> function handler". I take it that this means it can't find or hasn't loaded
>> the revdb external.
>>
>> I've installed livecodecommunity-9.6.1.x86_64, and I launch it with
>>    ~/.runrev/components/livecodecommunity-9.6.1.x86_64/LiveCode\
>> Community.x86_64 -ui <mystack.livecode>
>>
>> I can see revdb.so and dbmysql.so are in the Externals directory. Is there
>> something explicit I need to do to load these?
>
> "error in function handler" is a pretty generic response - sort of the
> engine's version of ¯\_(ツ)_/¯. Is the MySQL database local to the server
> machine or on a different computer? Does this work locally before moving the
> stack to the headless linux box?
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
Update. I have managed to get access to the Rev database external by
explicitly setting the `externals` property of the stack before saving it (on
Mac) to the full path on the linux machine to `revdb.so`.

Consequently the functions such as `revOpenDatabases` and `revOpenDatabase` no
longer throw error 219. Hurrah. Indeed `externalCommands` and
`externalFunctions` now list all the expected commands and functions of the
database library.

This is obviously an appalling solution, since it relies on me knowing the
exact path to the LiveCode bundle on the destination machine. (My recollection
from a decade or so ago is that this property has to already be set at the
time that the stack is opened, i.e. it can't be set dynamically. This may be
erroneous.) However, it will get me going for now.

Now my issue is that when the code tries to open the database,
`revOpenDatabase` returns "revdberr,invalid database type". That suggests that
the drivers aren't found.

I've tried to get past this using `revSetDatabaseDriverPath`.

The documentation says
> Use the revSetDatabaseDriverPath command if you want to place the database
> drivers your application uses somewhere other than the same folder as the
> application.
In fact the drivers are in the standard location, so this shouldn't be needed,
but hey... I started by reporting `revGetDatabaseDriverPath` - but calling
that causes LiveCode to immediately exit on signal 11. (This was in a
try-catch block, but that doesn't stop it crashing out.)

However, after using `revSetDatabaseDriverPath`, `revGetDatabaseDriverPath` no
longer crashes but faithfully reports the value set.

Unfortunately, this doesn't seem to help - although "set the defaultFolder to
revGetDatabaseDriverPath()/put the files" does list the folder which includes
dbmysql.so - revOpenDatabase still returns "revdberr,invalid database type".

Any suggestions gratefully received!

Ben


On 01/02/2021 20:24, Ben Rubinstein via use-livecode wrote:

> Hi Mark,
>
>  > "error in function handler" is a pretty generic response - sort of the
>  > engine's version of ¯\_(ツ)_/¯. Is the MySQL database local to the server
>  > machine or on a different computer?
>
> I should point out that this error is thrown - I take it to mean that the
> function isn't even located. I don't think the problem is with the details of
> the database connection, I don't think it gets that far.
>
> To test this, I've added a call to revOpenDatabases before doing anything else
> - sure enough, this throws the same error.
>
>  > Does this work locally before moving the
>  > stack to the headless linux box?
>
> The whole shebang works on my Mac. I tried to see if I could run LiveCode
> headless on Mac, to minimise the differences that might be at issue, and got
>      Startup error - cannot run in command line mode
>
> I don't know if that's a generic issue that LiveCode can't run headless on
> Mac, or if there's something else going on there.
>
> Ben
>
>
> On 01/02/2021 19:37, Mark Wieder via use-livecode wrote:
>> On 2/1/21 11:15 AM, Ben Rubinstein via use-livecode wrote:
>>>
>>> With thanks to friends here who helped me install and start using LC on a
>>> headless Linux box. I've now another little problem... my stack tries and
>>> fails to connect to a MySQL database.
>>>
>>> When it attempts to call revOpenDatabase, it throws error 219, "error in
>>> function handler". I take it that this means it can't find or hasn't loaded
>>> the revdb external.
>>>
>>> I've installed livecodecommunity-9.6.1.x86_64, and I launch it with
>>>    ~/.runrev/components/livecodecommunity-9.6.1.x86_64/LiveCode\
>>> Community.x86_64 -ui <mystack.livecode>
>>>
>>> I can see revdb.so and dbmysql.so are in the Externals directory. Is there
>>> something explicit I need to do to load these?
>>
>> "error in function handler" is a pretty generic response - sort of the
>> engine's version of ¯\_(ツ)_/¯. Is the MySQL database local to the server
>> machine or on a different computer? Does this work locally before moving the
>> stack to the headless linux box?
>>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
Ben,

I have seen the “invalid database type” error on Linux because of a case error. Make sure you use “mysql” as the database type, not “MySQL” or anything else with upper case letters. LiveCode is not case-sensitive, but Linux is.

Hope this helps.

Devin

> On Feb 1, 2021, at 2:32 PM, Ben Rubinstein via use-livecode <[hidden email]> wrote:
>
> Update. I have managed to get access to the Rev database external by explicitly setting the `externals` property of the stack before saving it (on Mac) to the full path on the linux machine to `revdb.so`.
>
> Consequently the functions such as `revOpenDatabases` and `revOpenDatabase` no longer throw error 219. Hurrah. Indeed `externalCommands` and `externalFunctions` now list all the expected commands and functions of the database library.
>
> This is obviously an appalling solution, since it relies on me knowing the exact path to the LiveCode bundle on the destination machine. (My recollection from a decade or so ago is that this property has to already be set at the time that the stack is opened, i.e. it can't be set dynamically. This may be erroneous.) However, it will get me going for now.
>
> Now my issue is that when the code tries to open the database, `revOpenDatabase` returns "revdberr,invalid database type". That suggests that the drivers aren't found.
>
> I've tried to get past this using `revSetDatabaseDriverPath`.
>
> The documentation says
>> Use the revSetDatabaseDriverPath command if you want to place the database
>> drivers your application uses somewhere other than the same folder as the
>> application.
> In fact the drivers are in the standard location, so this shouldn't be needed, but hey... I started by reporting `revGetDatabaseDriverPath` - but calling that causes LiveCode to immediately exit on signal 11. (This was in a try-catch block, but that doesn't stop it crashing out.)
>
> However, after using `revSetDatabaseDriverPath`, `revGetDatabaseDriverPath` no longer crashes but faithfully reports the value set.
>
> Unfortunately, this doesn't seem to help - although "set the defaultFolder to revGetDatabaseDriverPath()/put the files" does list the folder which includes dbmysql.so - revOpenDatabase still returns "revdberr,invalid database type".
>
> Any suggestions gratefully received!
>
> Ben
>
>
> On 01/02/2021 20:24, Ben Rubinstein via use-livecode wrote:
>> Hi Mark,
>> > "error in function handler" is a pretty generic response - sort of the
>> > engine's version of ¯\_(ツ)_/¯. Is the MySQL database local to the server
>> > machine or on a different computer?
>> I should point out that this error is thrown - I take it to mean that the function isn't even located. I don't think the problem is with the details of the database connection, I don't think it gets that far.
>> To test this, I've added a call to revOpenDatabases before doing anything else - sure enough, this throws the same error.
>> > Does this work locally before moving the
>> > stack to the headless linux box?
>> The whole shebang works on my Mac. I tried to see if I could run LiveCode headless on Mac, to minimise the differences that might be at issue, and got
>>     Startup error - cannot run in command line mode
>> I don't know if that's a generic issue that LiveCode can't run headless on Mac, or if there's something else going on there.
>> Ben
>> On 01/02/2021 19:37, Mark Wieder via use-livecode wrote:
>>> On 2/1/21 11:15 AM, Ben Rubinstein via use-livecode wrote:
>>>>
>>>> With thanks to friends here who helped me install and start using LC on a headless Linux box. I've now another little problem... my stack tries and fails to connect to a MySQL database.
>>>>
>>>> When it attempts to call revOpenDatabase, it throws error 219, "error in function handler". I take it that this means it can't find or hasn't loaded the revdb external.
>>>>
>>>> I've installed livecodecommunity-9.6.1.x86_64, and I launch it with
>>>>    ~/.runrev/components/livecodecommunity-9.6.1.x86_64/LiveCode\ Community.x86_64 -ui <mystack.livecode>
>>>>
>>>> I can see revdb.so and dbmysql.so are in the Externals directory. Is there something explicit I need to do to load these?
>>>
>>> "error in function handler" is a pretty generic response - sort of the engine's version of ¯\_(ツ)_/¯. Is the MySQL database local to the server machine or on a different computer? Does this work locally before moving the stack to the headless linux box?
>>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

Devin Asay
Director
Office of Digital Humanities
Brigham Young University

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
Devin, thank you - that was the last bit I needed.

So my complete stack now works. Hurrah! Thanks everyone who helped me.


Undesirable things found:

1. I've not found how to access externals (in this case the database library)
without explicitly setting the 'externals' property of the stack to a
(generally unreliably) full path before the stack is saved.

2. revGetDatabaseDriverPath crashes the app if invoked before using
revSetDatabaseDriverPath

3. revSetDatabaseDriverPath is required even when the drivers are in the
standard location inside the app 'bundle'.

I'll report (2) and (3) formally when I've done a bit more investigation. I'd
still love to know what I'm doing wrong, in relation to (1).

thanks all,

Ben

On 01/02/2021 21:48, Devin Asay via use-livecode wrote:

> Ben,
>
> I have seen the “invalid database type” error on Linux because of a case error. Make sure you use “mysql” as the database type, not “MySQL” or anything else with upper case letters. LiveCode is not case-sensitive, but Linux is.
>
> Hope this helps.
>
> Devin
>
>> On Feb 1, 2021, at 2:32 PM, Ben Rubinstein via use-livecode <[hidden email]> wrote:
>>
>> Update. I have managed to get access to the Rev database external by explicitly setting the `externals` property of the stack before saving it (on Mac) to the full path on the linux machine to `revdb.so`.
>>
>> Consequently the functions such as `revOpenDatabases` and `revOpenDatabase` no longer throw error 219. Hurrah. Indeed `externalCommands` and `externalFunctions` now list all the expected commands and functions of the database library.
>>
>> This is obviously an appalling solution, since it relies on me knowing the exact path to the LiveCode bundle on the destination machine. (My recollection from a decade or so ago is that this property has to already be set at the time that the stack is opened, i.e. it can't be set dynamically. This may be erroneous.) However, it will get me going for now.
>>
>> Now my issue is that when the code tries to open the database, `revOpenDatabase` returns "revdberr,invalid database type". That suggests that the drivers aren't found.
>>
>> I've tried to get past this using `revSetDatabaseDriverPath`.
>>
>> The documentation says
>>> Use the revSetDatabaseDriverPath command if you want to place the database
>>> drivers your application uses somewhere other than the same folder as the
>>> application.
>> In fact the drivers are in the standard location, so this shouldn't be needed, but hey... I started by reporting `revGetDatabaseDriverPath` - but calling that causes LiveCode to immediately exit on signal 11. (This was in a try-catch block, but that doesn't stop it crashing out.)
>>
>> However, after using `revSetDatabaseDriverPath`, `revGetDatabaseDriverPath` no longer crashes but faithfully reports the value set.
>>
>> Unfortunately, this doesn't seem to help - although "set the defaultFolder to revGetDatabaseDriverPath()/put the files" does list the folder which includes dbmysql.so - revOpenDatabase still returns "revdberr,invalid database type".
>>
>> Any suggestions gratefully received!
>>
>> Ben
>>
>>
>> On 01/02/2021 20:24, Ben Rubinstein via use-livecode wrote:
>>> Hi Mark,
>>>> "error in function handler" is a pretty generic response - sort of the
>>>> engine's version of ¯\_(ツ)_/¯. Is the MySQL database local to the server
>>>> machine or on a different computer?
>>> I should point out that this error is thrown - I take it to mean that the function isn't even located. I don't think the problem is with the details of the database connection, I don't think it gets that far.
>>> To test this, I've added a call to revOpenDatabases before doing anything else - sure enough, this throws the same error.
>>>> Does this work locally before moving the
>>>> stack to the headless linux box?
>>> The whole shebang works on my Mac. I tried to see if I could run LiveCode headless on Mac, to minimise the differences that might be at issue, and got
>>>      Startup error - cannot run in command line mode
>>> I don't know if that's a generic issue that LiveCode can't run headless on Mac, or if there's something else going on there.
>>> Ben
>>> On 01/02/2021 19:37, Mark Wieder via use-livecode wrote:
>>>> On 2/1/21 11:15 AM, Ben Rubinstein via use-livecode wrote:
>>>>>
>>>>> With thanks to friends here who helped me install and start using LC on a headless Linux box. I've now another little problem... my stack tries and fails to connect to a MySQL database.
>>>>>
>>>>> When it attempts to call revOpenDatabase, it throws error 219, "error in function handler". I take it that this means it can't find or hasn't loaded the revdb external.
>>>>>
>>>>> I've installed livecodecommunity-9.6.1.x86_64, and I launch it with
>>>>>     ~/.runrev/components/livecodecommunity-9.6.1.x86_64/LiveCode\ Community.x86_64 -ui <mystack.livecode>
>>>>>
>>>>> I can see revdb.so and dbmysql.so are in the Externals directory. Is there something explicit I need to do to load these?
>>>>
>>>> "error in function handler" is a pretty generic response - sort of the engine's version of ¯\_(ツ)_/¯. Is the MySQL database local to the server machine or on a different computer? Does this work locally before moving the stack to the headless linux box?
>>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> Devin Asay
> Director
> Office of Digital Humanities
> Brigham Young University
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
On 2/1/21 2:25 PM, Ben Rubinstein via use-livecode wrote:

> 1. I've not found how to access externals (in this case the database
> library) without explicitly setting the 'externals' property of the
> stack to a (generally unreliably) full path before the stack is saved.

If you type in the messagebox

put the externals of stack "Home"

you should see everything there. If not, your system is misconfigured.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
On 2021-02-01 22:25, Ben Rubinstein via use-livecode wrote:

> Undesirable things found:
>
> 1. I've not found how to access externals (in this case the database
> library) without explicitly setting the 'externals' property of the
> stack to a (generally unreliably) full path before the stack is saved.
>
> 3. revSetDatabaseDriverPath is required even when the drivers are in
> the standard location inside the app 'bundle'.
>
> I'll report (2) and (3) formally when I've done a bit more
> investigation. I'd still love to know what I'm doing wrong, in
> relation to (1).

Please don't - as neither are bugs :)

The standalone engine inside the runtime folders in the IDE install is
just a bare engine.

In community you can certainly run the bare engine without building a
standalone but as you have discovered it is just what it is - a bare
engine, it knows nothing of externals, database drivers, widgets, script
libraries or anything else.

If you want a headless (community) engine which has dependencies then
all you have to do is deploy a standalone with a launcher stack embedded
into it.

The launcher stack should have the inclusions you want configured for
it, and it can just run the stack you pass as an argument on the
command-line.

Doing it this way, it means the standalone builder will take care to
ensure all the 'inclusions' you set are present and configured correctly
(including widgets, externals and script libraries).

You only need to rebuild the standalone if your inclusion requirements
change, or you want to change engine version.

Warmest Regards,

Mark.

P.S. In regards to (1) the trick is to do this:
```
set the externals of the templateStack to <external files list>
create invisible stack "Externals" -- or any name you like
inser the script of it into back
reset the templateStack
```
This allows you to compute the external paths at runtime when the engine
starts (e.g. by using the engine folder, or the filename of the stack
and computing the paths).

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
Thanks Mark. The issue here is that the stack was running headless, not in the
IDE. But I had it write the externals to stdout and indeed the result was
empty, so then I resaved it with the embedded property... etc. But this is
moot given other-Mark's message.

cheers,

Ben

On 02/02/2021 00:55, Mark Wieder via use-livecode wrote:

> On 2/1/21 2:25 PM, Ben Rubinstein via use-livecode wrote:
>
>> 1. I've not found how to access externals (in this case the database
>> library) without explicitly setting the 'externals' property of the stack to
>> a (generally unreliably) full path before the stack is saved.
>
> If you type in the messagebox
>
> put the externals of stack "Home"
>
> you should see everything there. If not, your system is misconfigured.
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode

Hi Mark,

On 02/02/2021 09:03, Mark Waddingham via use-livecode wrote:
>> I'll report (2) and (3) formally when I've done a bit more
>> investigation. I'd still love to know what I'm doing wrong, in
>> relation to (1).
>
> Please don't - as neither are bugs :)

The "investigation" I referred to was putting this message on the mailing list
and waiting to be corrected! Investigation complete.

And more generally -
> If you want a headless (community) engine which has dependencies then all
> you have to do is deploy a standalone with a launcher stack embedded into
> it.
  - thank you. A very long time ago I think I knew this, and indeed used to
send colleagues to Ken Ray's page where he made some handy standalones
available. I'll take your advice.

best regards,

Ben

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
LC Server doesn't handle externals, so for that we need a standalone?

I think I'm missing something.

--
  Richard Gaskin
  Fourth World Systems



Mark Waddingham wrote:

> On 2021-02-01 22:25, Ben Rubinstein via use-livecode wrote:
>> Undesirable things found:
>>
>> 1. I've not found how to access externals (in this case the database
>> library) without explicitly setting the 'externals' property of the
>> stack to a (generally unreliably) full path before the stack is saved.
>>
>> 3. revSetDatabaseDriverPath is required even when the drivers are in
>> the standard location inside the app 'bundle'.
>>
>> I'll report (2) and (3) formally when I've done a bit more
>> investigation. I'd still love to know what I'm doing wrong, in
>> relation to (1).
>
> Please don't - as neither are bugs :)
>
> The standalone engine inside the runtime folders in the IDE install is
> just a bare engine.
>
> In community you can certainly run the bare engine without building a
> standalone but as you have discovered it is just what it is - a bare
> engine, it knows nothing of externals, database drivers, widgets, script
> libraries or anything else.
>
> If you want a headless (community) engine which has dependencies then
> all you have to do is deploy a standalone with a launcher stack embedded
> into it.
>
> The launcher stack should have the inclusions you want configured for
> it, and it can just run the stack you pass as an argument on the
> command-line.
>
> Doing it this way, it means the standalone builder will take care to
> ensure all the 'inclusions' you set are present and configured correctly
> (including widgets, externals and script libraries).
>
> You only need to rebuild the standalone if your inclusion requirements
> change, or you want to change engine version.
>
> Warmest Regards,
>
> Mark.
>
> P.S. In regards to (1) the trick is to do this:
> ```
> set the externals of the templateStack to <external files list>
> create invisible stack "Externals" -- or any name you like
> inser the script of it into back
> reset the templateStack
> ```
> This allows you to compute the external paths at runtime when the engine
> starts (e.g. by using the engine folder, or the filename of the stack
> and computing the paths).
>
> --
> Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
My simple rule on this is:

If I need to write code, use the IDE.

If I need to deploy code, use a standalone.
You get the best possible performance. They are flexible since you can dynamically load code. They do not have the burden of  the IDE. It seems the right path to go.

Maybe there is a reason Ben wants to deploy with the IDE?

Best regards,

Mark Talluto
livecloud.io <http://livecloud.io/>
nursenotes.net <http://nursenotes.net/>
canelasoftware.com <http://www.canelasoftware.com/>


> On Feb 2, 2021, at 10:58 AM, Richard Gaskin via use-livecode <[hidden email]> wrote:
>
> LC Server doesn't handle externals, so for that we need a standalone?
>
> I think I'm missing something.
>
> --
> Richard Gaskin
> Fourth World Systems
>
>
>
> Mark Waddingham wrote:
>> On 2021-02-01 22:25, Ben Rubinstein via use-livecode wrote:
>>> Undesirable things found:
>>> 1. I've not found how to access externals (in this case the database
>>> library) without explicitly setting the 'externals' property of the
>>> stack to a (generally unreliably) full path before the stack is saved.
>>> 3. revSetDatabaseDriverPath is required even when the drivers are in
>>> the standard location inside the app 'bundle'.
>>> I'll report (2) and (3) formally when I've done a bit more
>>> investigation. I'd still love to know what I'm doing wrong, in
>>> relation to (1).
>> Please don't - as neither are bugs :)
>> The standalone engine inside the runtime folders in the IDE install is just a bare engine.
>> In community you can certainly run the bare engine without building a standalone but as you have discovered it is just what it is - a bare engine, it knows nothing of externals, database drivers, widgets, script libraries or anything else.
>> If you want a headless (community) engine which has dependencies then all you have to do is deploy a standalone with a launcher stack embedded into it.
>> The launcher stack should have the inclusions you want configured for it, and it can just run the stack you pass as an argument on the command-line.
>> Doing it this way, it means the standalone builder will take care to ensure all the 'inclusions' you set are present and configured correctly (including widgets, externals and script libraries).
>> You only need to rebuild the standalone if your inclusion requirements change, or you want to change engine version.
>> Warmest Regards,
>> Mark.
>> P.S. In regards to (1) the trick is to do this:
>> ```
>> set the externals of the templateStack to <external files list>
>> create invisible stack "Externals" -- or any name you like
>> inser the script of it into back
>> reset the templateStack
>> ```
>> This allows you to compute the external paths at runtime when the engine starts (e.g. by using the engine folder, or the filename of the stack and computing the paths).
>> --
>> Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
>> LiveCode: Everyone can create apps
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
Good rules in general, but my question was about something else entirely.

As for the IDE, it's a GUI; I'm not sure what could be done with it on a
headless system.  (Yes, instructions are provided for sys admins to
automate *installing* it via command line -- great for computer labs and
such -- but I can't imagine how one would *use* the IDE from Terminal.)


As for my post, it was a question in reply to Mark Waddingham's note
about how only standalones can be expected to use externals.  That is,
at least as I read it.

I'm hoping I misread it because for headless systems LC Server is
designed to be the optimal solution:

- Lean runtime

- Can run scripts in stack files, script-only stacks, and even
   plain executable text files in the traditional shebang way:
   https://livecode.com/a-livecode-shell/

- The same engine installed once for general system programming
   can also be aliased in cgi-bin to offer all of the above plus
   PHP-style implicit merge under Apache or Lighttpd. Even if you
   don't need public-facing web hosting, there are a great many
   benefits to having systems communicate via REST.


I was resistant to using LC Server for many years when it first came
out, because I missed the shebang simplicity we'd enjoyed with MC, and I
wasn't sure how long LC Ltd would stick with it.  Both concerns have
been well addressed now, and it's my go-to for headless.  I've even
replaced many installs that had been standalones during my reluctant years.

--
  Richard Gaskin
  Fourth World Systems



Mark Talluto wrote:

> My simple rule on this is:
>
> If I need to write code, use the IDE.
>
> If I need to deploy code, use a standalone.
> You get the best possible performance. They are flexible since you can dynamically load code. They do not have the burden of  the IDE. It seems the right path to go.
>
> Maybe there is a reason Ben wants to deploy with the IDE?
>
> Best regards,
>
> Mark Talluto
> livecloud.io <http://livecloud.io/>
> nursenotes.net <http://nursenotes.net/>
> canelasoftware.com <http://www.canelasoftware.com/>
>
>
>> On Feb 2, 2021, at 10:58 AM, Richard Gaskin via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> LC Server doesn't handle externals, so for that we need a standalone?
>>
>> I think I'm missing something.
>>
>> --
>> Richard Gaskin
>> Fourth World Systems
>>
>>
>> Mark Waddingham wrote:
>>> On 2021-02-01 22:25, Ben Rubinstein via use-livecode wrote:
>>>> Undesirable things found:
>>>> 1. I've not found how to access externals (in this case the database
>>>> library) without explicitly setting the 'externals' property of the
>>>> stack to a (generally unreliably) full path before the stack is saved.
>>>> 3. revSetDatabaseDriverPath is required even when the drivers are in
>>>> the standard location inside the app 'bundle'.
>>>> I'll report (2) and (3) formally when I've done a bit more
>>>> investigation. I'd still love to know what I'm doing wrong, in
>>>> relation to (1).
>>> Please don't - as neither are bugs :)
>>> The standalone engine inside the runtime folders in the IDE install is just a bare engine.
>>> In community you can certainly run the bare engine without building a standalone but as you have discovered it is just what it is - a bare engine, it knows nothing of externals, database drivers, widgets, script libraries or anything else.
>>> If you want a headless (community) engine which has dependencies then all you have to do is deploy a standalone with a launcher stack embedded into it.
>>> The launcher stack should have the inclusions you want configured for it, and it can just run the stack you pass as an argument on the command-line.
>>> Doing it this way, it means the standalone builder will take care to ensure all the 'inclusions' you set are present and configured correctly (including widgets, externals and script libraries).
>>> You only need to rebuild the standalone if your inclusion requirements change, or you want to change engine version.
>>> Warmest Regards,
>>> Mark.
>>> P.S. In regards to (1) the trick is to do this:
>>> ```
>>> set the externals of the templateStack to <external files list>
>>> create invisible stack "Externals" -- or any name you like
>>> inser the script of it into back
>>> reset the templateStack
>>> ```
>>> This allows you to compute the external paths at runtime when the engine starts (e.g. by using the engine folder, or the filename of the stack and computing the paths).
>>> --
>>> Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
>>> LiveCode: Everyone can create apps



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
On 2021-02-03 00:31, Richard Gaskin via use-livecode wrote:
> As for my post, it was a question in reply to Mark Waddingham's note
> about how only standalones can be expected to use externals.  That is,
> at least as I read it.

Mark said nothing of the sort :)

LC Server had already been ruled out (for whatever reason) in an earlier
part of the thread so I was just advising on how to solve Ben's issue of
wanting a non-server engine that can be run in -ui mode which has
dependencies.

Warmest Regards,

Mark.

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
Yes sorry Richard et al for confusion.

I was using LC standard on a headless Linux machine, i.e. launching the IDE
but with -ui. It worked fine and ran my stack OK, until it tried to access a
database. At that point I listened to advice and made a minimal standalone
configured as a launcher - and built with the necessary libraries - and all
was right with the world.

At no point was I using LC Server (for whatever reason).

Thanks to everyone who helped me!

Ben


On 03/02/2021 07:01, Mark Waddingham via use-livecode wrote:

> On 2021-02-03 00:31, Richard Gaskin via use-livecode wrote:
>> As for my post, it was a question in reply to Mark Waddingham's note
>> about how only standalones can be expected to use externals.  That is,
>> at least as I read it.
>
> Mark said nothing of the sort :)
>
> LC Server had already been ruled out (for whatever reason) in an earlier part
> of the thread so I was just advising on how to solve Ben's issue of wanting a
> non-server engine that can be run in -ui mode which has dependencies.
>
> Warmest Regards,
>
> Mark.
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
Mark Waddingham wrote:
> On 2021-02-03 00:31, Richard Gaskin via use-livecode wrote:
>> As for my post, it was a question in reply to Mark Waddingham's note
>> about how only standalones can be expected to use externals.  That is,
>> at least as I read it.
>
> Mark said nothing of the sort :)

Very glad to be wrong on that.


> LC Server had already been ruled out (for whatever reason) in an earlier
> part of the thread...

That's too bad. LC Server is LiveCode build designed specifically for
command line use.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
That the deployment needs to be headless doesn’t prevent you from running it n the IDE to gain access to single stepping, breakpoints, and the like.

I don’t remember why offhand, but before finding the -ui option, I did some experimenting and fount that I could get the linux version of 5.something to begin execution.  It ran at least preOpenStack before attempting to start the X GUI
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
On 2021-02-03 20:07, Richard Gaskin via use-livecode wrote:
>> LC Server had already been ruled out (for whatever reason) in an
>> earlier part of the thread...
>
> That's too bad. LC Server is LiveCode build designed specifically for
> command line use.

Interesting - I don't remember that being what I specifically designed
it for :P

LiveCode Server was *specifically designed* to be used just like PHP -
allowing you to interpolate code with HTML output for the purposes of
constructing webpages on the fly, sitting behind a web-server... That's
why it has unique syntax designed precisely for a CGI environment, and
operating in that PHP-like manner.

Making it run in command-line mode as well was an obvious thing to do,
and also made up for the fact (at the time) that bare standalone engines
would not launch a stack on the command-line (as that was a rather
gaping licensing hole which was closed between v3 and v4
IIRC). [ It also made it easier to test the general features of it! ]

Since the advent of the community edition, however, and perhaps more
importantly script-only-stacks - standalone engines running with -ui can
be just as convenient...

Assuming there isn't a feature-requiring reason to use one over the
other, then it pretty much comes down to how you want to write your text
based scripts.

Warmest Regards,

Mark.

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
Mark Waddingham wrote:

> On 2021-02-03 20:07, Richard Gaskin via use-livecode wrote:
>>> LC Server had already been ruled out (for whatever reason) in an
>>> earlier part of the thread...
>>
>> That's too bad. LC Server is LiveCode build designed specifically for
>> command line use.
>
> Interesting - I don't remember that being what I specifically designed
> it for :P
>
> LiveCode Server was *specifically designed* to be used just like PHP -
> allowing you to interpolate code with HTML output for the purposes of
> constructing webpages on the fly, sitting behind a web-server... That's
> why it has unique syntax designed precisely for a CGI environment, and
> operating in that PHP-like manner.
>
> Making it run in command-line mode as well was an obvious thing to do,
> and also made up for the fact (at the time) that bare standalone engines
> would not launch a stack on the command-line (as that was a rather
> gaping licensing hole which was closed between v3 and v4
> IIRC). [ It also made it easier to test the general features of it! ]
>
> Since the advent of the community edition, however, and perhaps more
> importantly script-only-stacks - standalone engines running with -ui can
> be just as convenient...


Indeed it can.  The -ui option for running standalones was something
many of us enjoyed back in the MetaCard days; AFAIK it was first
implemented with v1.0 back in '92; it least it was there when I first
started with MC back in '96.

In addition to being an option for standalones, one could even run the
bare engine with -ui as well.

And being a command line tool that uses stdin/stdout, running the engine
or a standalone with -ui also worked well as a CGI under Apache or
Lightly (though in a flavor more like Perl, Python, or Ruby than PHP).

Your fine addition in more recent years with a special Server build to
allow PHP-like co-mingling of code and content was well done and much
appreciated for those who enjoy that workflow on web servers.

And back in '14 David Williams reminded us that the standard shebang
option for running a script text file is still available, though with a
slight syntactic difference from how we used to do that with MC (entry
point used to be a startup message, now just bare script statements
outside of a handler):
https://livecode.com/a-livecode-shell/


With all this flexibility in one lean install, for me the pros of LC
Server for headless work are clear:

- We get the benefits of a standalone without having to make a
   standalone (indeed the engine can be kept up to date with a
   scrape-n-wget from the Downloads page, without needing to run
   it through the Standalone Builder on a separate GUI system).

- We have the same options for running it as a standalone, without
   needing to remember to add -ui (minor, but every little simplicity
   is nice).

- BONUS: We get the bonus option of running it aa a CGI without
   needing to write our own libraries for that (reading and parsing
   POST, writing to stdOut, handling every little detail about
   headers, sessions, and more).  And when we do, we can enjoy
   PHP-style implicit merge, mixing content and code much more
   conveniently than with the merge function.

That bonus may be irrelevant for some use cases, but probably not many.
After all, a headless machine is usually not our main dev machine; it's
probably being deployed to provide services for client machines. When
those services are being delivered over a network we'll need a protocol,
and in most cases HTTP will be a great choice, certainly the most common
one. And though we can write our own HTTP daemon in LC, letting Apache
do that generic work gives us better throughput, robustness, and
security, with lower maintenance costs.

Letting Apache do what it does best lets us do what we do best: focus on
the functionality unique to our application service.


All that said, perhaps my appreciation for your work with LC Server is
indeed misplaced, and maybe it shouldn't be encouraged as the go-to
choice for headless LiveCode development. :)

But as one who resisted using it for many years after it was released,
continuing to use standalones with -ui, I must admit that the
efficiencies in both execution time and my development and maintenance
time eventually made me uniquely enamored of LC Server as my default
choice for any headless system.

So if this makes me an LC Server fanboy, guilty as charged, your honor.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using MySQL on (headless) Linux

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
I don’t remember what I had for dinner on Friday. :-)

Bob S


On Feb 3, 2021, at 10:58 PM, Mark Waddingham via use-livecode <[hidden email]<mailto:[hidden email]>> wrote:

On 2021-02-03 20:07, Richard Gaskin via use-livecode wrote:
LC Server had already been ruled out (for whatever reason) in an earlier part of the thread...
That's too bad. LC Server is LiveCode build designed specifically for
command line use.

Interesting - I don't remember that being what I specifically designed it for :P

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
12