4D Client as Webserver

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

4D Client as Webserver

Justin Will
I am doing some testing with using 4DClient as my webserver instead of
serving my website direct from the server.  My client machine is windows 7
and I have my Active4D directory and my web folder on a file server.  I
have added a shortcut to the Active4D directory on the file server to the
following location.
C:\users\myusernamehere\AppData\Roaming\4D\com.aparajita\
My webserver directory in the active4d.ini is set to:

root = /F/a4dweb

I am getting 404 errors when trying to access any of my pages.  Does anyone
have some tips on how to debug where my configuration is wrong?

Thanks
Justin Will


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: 4D Client as Webserver

Peter Jakobsson-2

On 4 Apr 2015, at 18:57, jwill <[hidden email]> wrote:

> I am getting 404 errors when trying to access any of my pages.  Does anyone
> have some tips on how to debug where my configuration is wrong?

Just a few for starters:

 - check you’ve got the “ClientIsWebServer” thingy flag set in the shell (I can’t remember what it’s called these days)
 - check you’ve separated the libraries and config documents (thats the .A4L’s and the .INI’s) into separate folders (libs and conf) and placed them in the hierarchy com.aparajita - Active4D - libs/conf
 - check you’ve got the web root set right wherever you set it (in the Active4D.ini, in code or wherever)

Those are the main 3 differences from serving on single.

Peter


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: 4D Client as Webserver

Aparajita Fishman
In reply to this post by Justin Will
> My webserver directory in the active4d.ini is set to:
>
> root = /F/a4dweb

Look in the Active4d log, it should tell you the resolved path for the web root.

Regards,

  Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: 4D Client as Webserver

Justin Will
In reply to this post by Justin Will
Ok so I checked the logs and here's what i found. I guess I'm not
understanding why it seems to be resolving to web/ instead of my correct
path specified in Active4D.ini?

Apr 04 17:16:19 Active4D: [info] env: log level = info
Apr 04 17:16:19 Active4D: [info] env: ICU data directory:
C:\Users\webuser\AppData\Local\4D\4DNug.4DC_xxx_xxx_xxx_xxx\Plugins\Active4D
.bundle\Contents\Resources
Apr 04 17:16:19 Active4D: [info] env: Active4D 6.1r2 [Windows, release,
32-bit]
Apr 04 17:16:19 Active4D: [info] env: 4D v13.5.0r0 [Client, compiled,
Unicode mode, Microsoft Windows 7  0F1AEF5C (build 7601), 32-bit]
Apr 04 17:16:19 Active4D: [info] env: ICU locale: en_US - English (United
States)
Apr 04 17:16:19 Active4D: [info] env: checked
Apr 04 17:16:19 Active4D: [info] interpreter: default directory:
F:\Active4D
Apr 04 17:16:19 Active4D: [info] server: initialized
Apr 04 17:16:19 Active4D: [info] lexer: initialized
Apr 04 17:16:19 Active4D: [info] interpreter: default directory:
F:\Active4D
Apr 04 17:16:19 Active4D: [info] interpreter: initialized
Apr 04 17:16:19 Active4D: [info] runtime: initialized
Apr 04 17:16:19 Active4D: [info] web_runtime: initialized
Apr 04 17:16:19 Active4D: [info] housekeeper: initialized
Apr 04 17:15:28 Active4D: [info] plugin: starting up web server
Apr 04 17:15:28 Active4D: [error] The library "Active4D" cannot be found:
src\my_plugin.cpp, line 1478, plugin::a4d::importActive4DLib
Apr 04 17:15:28 Active4D: [info] plugin: initializing circuits
Apr 04 17:15:28 Active4D: [info] plugin: scanning for circuits in web root
web/
Apr 04 17:15:28 Active4D: [info] plugin: circuits initialized
Apr 04 17:15:28 Active4D: [info] plugin: web server started, NTK host,
listening on xxx.xxx.xxx.xxx:8888
Apr 04 17:15:28 Active4D: [info] server: receive callback set to
"A4D_NTK_ReceiveCallback"

Here's my line from my active4d.ini file located at F:\Active4D.

root = /F/a4dweb

Thanks
Justin Will

----------------------------------------
From: "Aparajita Fishman" <[hidden email]>
Sent: Saturday, April 04, 2015 3:05 PM
To: [hidden email], "Active4D Developer Discussion List"
<[hidden email]>
Subject: Re: [Active4d-dev] 4D Client as Webserver

> My webserver directory in the active4d.ini is set to:
>  
> root = /F/a4dweb  

Look in the Active4d log, it should tell you the resolved path for the web
root.

Regards,

  Aparajita


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: 4D Client as Webserver

Aparajita Fishman
> Ok so I checked the logs and here's what i found. I guess I'm not
> understanding why it seems to be resolving to web/ instead of my correct
> path specified in Active4D.ini?

Turn on debug logging, it will show more info. Check the archives of the mailing list, I’m pretty sure I’ve heard of this problem before. Is F: a network share?

Regards,

  Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: 4D Client as Webserver

Justin Will
In reply to this post by Justin Will

In an effort to see if I had some sort of problem of my own doing I
attempted to change my logging level and see what was going on.

So I tried to turn on debug level in the logs as well.  I added a text file
to my log directory of
C:\users\myusername\local\4D\mydatabasename\logs\active4d named log_level
and the word debug was the only thing in the file, restarted 4D and the
amount of logging was exactly the same.  I removed the word debug and put
in the word off and rebooted 4d and still the same logging level existed.  
I added the extension .txt to my file and restarted 4D and again the same
logging level existed.  I moved the file up a directory and tried with and
without the file extension.  No matter what I did I could not get more/less
logging to occur.

Thanks
Justin Will

----------------------------------------
From: "Aparajita Fishman" <[hidden email]>
Sent: Saturday, April 04, 2015 3:05 PM
To: [hidden email], "Active4D Developer Discussion List"
<[hidden email]>
Subject: Re: [Active4d-dev] 4D Client as Webserver

> My webserver directory in the active4d.ini is set to:
>
> root = /F/a4dweb

Look in the Active4d log, it should tell you the resolved path for the web
root.

Regards,

  Aparajita


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: 4D Client as Webserver

Justin Will
In reply to this post by Justin Will
 F: is a network share

Thanks
Justin Will

----------------------------------------
From: "Aparajita Fishman" <[hidden email]>
Sent: Saturday, April 04, 2015 9:39 PM
To: [hidden email], "Active4D Developer Discussion List" <[hidden email]>
Subject: Re: [Active4d-dev] 4D Client as Webserver

> Ok so I checked the logs and here's what i found. I guess I'm not
> understanding why it seems to be resolving to web/ instead of my correct
> path specified in Active4D.ini?

Turn on debug logging, it will show more info. Check the archives of the mailing list, I'm pretty sure I've heard of this problem before. Is F: a network share?

Regards,

  Aparajita


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: 4D Client as Webserver

Aparajita Fishman
> F: is a network share

IIRC, I don’t think link resolution works across network shares. You’ll have to copy the Active4D files to each client.

Regards,

  Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: 4D Client as Webserver

Aparajita Fishman
In reply to this post by Justin Will
> So I tried to turn on debug level in the logs as well.  I added a text file
> to my log directory of
> C:\users\myusername\local\4D\mydatabasename\logs\active4d named log_level

There seems to be a bug in the code or the docs, name the file log_debug_level.

Regards,

  Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: 4D Client as Webserver

Justin Will
In reply to this post by Justin Will
So I have brought all files local.  I placed my Active4D directory at the location C:\ProgramData\4D\Licenses\com.aparajita and my web directory is located as C:\a4dweb
I changed my web root in the active4d.ini to /c/a4dweb  and I still get 404 errors everywhere.  Here's my debug log now.

Apr 05 07:28:28 Active4D: [notice] *****************************************************************
Apr 05 07:28:28 Active4D: [notice]   Active4D
Apr 05 07:28:28 Active4D: [notice] *****************************************************************
Apr 05 07:28:28 Active4D: [info] env: log level = debug
Apr 05 07:28:28 Active4D: [debug] env: looking for ICU data in plugin bundle
Apr 05 07:28:28 Active4D: [info] env: ICU data directory: C:\Users\webuser\AppData\Local\4D\4DNug.4DC_xxx.xxx.xxx.xxx\Plugins\Active4D.bundle\Contents\Resources
Apr 05 07:28:28 Active4D: [info] env: Active4D 6.1r13 [Windows, release, 32-bit]
Apr 05 07:28:28 Active4D: [info] env: 4D v13.5.0r0 [Client, compiled, Unicode mode, Windows 7, 32-bit]
Apr 05 07:28:28 Active4D: [debug] env: Windows user locale: en_US
Apr 05 07:28:28 Active4D: [info] env: ICU locale: en_US - English (United States)
Apr 05 07:28:28 Active4D: [info] env: checked
Apr 05 07:28:28 Active4D: [info] license: searching for key file in /C/Users/webuser/AppData/Roaming/4D/com.aparajita/Active4D
Apr 05 07:28:28 Active4D: [info] license: searching for key file in /C/ProgramData/4D/Licenses/com.aparajita/Active4D
Apr 05 07:28:28 Active4D: [info] license: found key file: C:\ProgramData\4D\Licenses\com.aparajita\Active4D\Active4D.xxx.xxx.xxx.xxx.key
Apr 05 07:28:28 Active4D: [info] license: found deployment license, checking IP addresses
Apr 05 07:28:28 Active4D: [debug] xtoolkit: match IP address: xxx.xxx.xxx.xxx
Apr 05 07:28:28 Active4D: [debug] xtoolkit: found IP: xxx.xxx.xxx.xxx
Apr 05 07:28:28 Active4D: [info] license: matched IP address: xxx.xxx.xxx.xxx
Apr 05 07:28:28 Active4D: [info] license: valid key: key version = 0x61, plugin version = 0x61
Apr 05 07:28:28 Active4D: [info] license: type = deployment, unlimited time
Apr 05 07:28:28 Active4D: [info] server: initialized
Apr 05 07:28:28 Active4D: [info] lexer: initialized
Apr 05 07:28:28 Active4D: [debug] lexer: decimal point='.', grouping separator=','
Apr 05 07:28:28 Active4D: [info] interpreter: default directory: C:\ProgramData\4D\com.aparajita\Active4D
Apr 05 07:28:28 Active4D: [info] interpreter: initialized
Apr 05 07:28:28 Active4D: [info] runtime: initialized
Apr 05 07:28:28 Active4D: [info] web_runtime: initialized
Apr 05 07:28:28 Active4D: [info] housekeeper: initialized
Apr 05 07:28:35 Active4D: [info] plugin: starting up web server
Apr 05 07:28:35 Active4D: [error] The library "Active4D" cannot be found: src\my_plugin.cpp, line 1480, plugin::a4d::importActive4DLib
Apr 05 07:28:35 Active4D: [info] plugin: initializing circuits
Apr 05 07:28:35 Active4D: [info] plugin: scanning for circuits in web root web/
Apr 05 07:28:35 Active4D: [info] plugin: circuits initialized
Apr 05 07:28:35 Active4D: [info] plugin: web server started, NTK host, listening on xxx.xxx.xxx.xxx:8888
Apr 05 07:28:35 Active4D: [info] server: receive callback set to "A4D_NTK_ReceiveCallback"
Apr 05 07:28:39 Active4D: [error] env: error -1 setting wd (C:\ProgramData\4D\com.aparajita\Active4D): ..\framework\4d\env4d.cpp, line 1290, plugin::StDefault4DDirectory::StDefault4DDirectory
Apr 05 07:28:40 Active4D: [error] env: error -1 setting wd (C:\ProgramData\4D\com.aparajita\Active4D): ..\framework\4d\env4d.cpp, line 1290, plugin::StDefault4DDirectory::StDefault4DDirectory
Apr 05 07:28:41 Active4D: [error] env: error -1 setting wd (C:\ProgramData\4D\com.aparajita\Active4D): ..\framework\4d\env4d.cpp, line 1290, plugin::StDefault4DDirectory::StDefault4DDirectory

Thanks
Justin Will

----------------------------------------
From: "Aparajita Fishman" <[hidden email]>
Sent: Saturday, April 04, 2015 11:44 PM
To: [hidden email], "Active4D Developer Discussion List" <[hidden email]>
Subject: Re: [Active4d-dev] 4D Client as Webserver

> F: is a network share

IIRC, I don't think link resolution works across network shares. You'll have to copy the Active4D files to each client.

Regards,

  Aparajita


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: 4D Client as Webserver

Aparajita Fishman
> Apr 05 07:28:28 Active4D: [info] interpreter: default directory: C:\ProgramData\4D\com.aparajita\Active4D
> Apr 05 07:28:35 Active4D: [error] The library "Active4D" cannot be found: src\my_plugin.cpp, line 1480, plugin::a4d::importActive4DLib

The path to Active4D.a4l must be C:\ProgramData\4D\com.aparajita\Active4D\lib\Active4D.a4l.

If the Active4D lib can’t be found, serving is deactivated.


> Apr 05 07:28:39 Active4D: [error] env: error -1 setting wd (C:\ProgramData\4D\com.aparajita\Active4D): ..\framework\4d\env4d.cpp, line 1290,

Does this directory exist?

Regards,

  Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: 4D Client as Webserver

Justin Will
In reply to this post by Justin Will
Peter
Your tips were the ones that put me over the top.  Thank you!  For anyone else trying this in the future you have to do this.
Take your Active4D folder and create two sub folders in the Active4D folder
1.  libs2.  conf
all of your .ini files go in the conf and all your .a4l files go in the libs folder.
So your directories go like this on each client machine.

C:\ProgramData\4D\com.aparajita\conf
C:\ProgramData\4D\com.aparajita\lib

Also, based on minimal testing you also cannot serve your files from a network share.  I will be testing on this some more to see if I can find a solution.

Thanks
Justin Will

----------------------------------------
From: "Aparajita Fishman" <[hidden email]>
Sent: Sunday, April 05, 2015 2:04 PM
To: [hidden email], "Active4D Developer Discussion List" <[hidden email]>
Subject: Re: [Active4d-dev] 4D Client as Webserver

> Apr 05 07:28:28 Active4D: [info] interpreter: default directory: C:\ProgramData\4D\com.aparajita\Active4D  
> Apr 05 07:28:35 Active4D: [error] The library "Active4D" cannot be found: src\my_plugin.cpp, line 1480, plugin::a4d::importActive4DLib  

The path to Active4D.a4l must be C:\ProgramData\4D\com.aparajita\Active4D\lib\Active4D.a4l.

If the Active4D lib can't be found, serving is deactivated.

> Apr 05 07:28:39 Active4D: [error] env: error -1 setting wd (C:\ProgramData\4D\com.aparajita\Active4D): ..\framework\4d\env4d.cpp, line 1290,  

Does this directory exist?

Regards,

  Aparajita


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: 4D Client as Webserver

Aparajita Fishman
> Your tips were the ones that put me over the top.  Thank you!  For anyone else trying this in the future you have to do this.
> Take your Active4D folder and create two sub folders in the Active4D folder
> 1.  libs2.  conf
> all of your .ini files go in the conf and all your .a4l files go in the libs folder.
> So your directories go like this on each client machine.
>
> C:\ProgramData\4D\com.aparajita\conf
> C:\ProgramData\4D\com.aparajita\lib
>
> Also, based on minimal testing you also cannot serve your files from a network share.  I will be testing on this some more to see if I can find a solution.

I’ll document this better in the future. As for not being able to server files from a network share, I’m not so sure you would *want* to do that for performance reasons.

Regards,

  Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Exit Include File

Oliver Brodwolf-2
Hello Aparajita

Sometime it would be easier scripting, if we could exit a Include File, instead of using If else end if.
Similar to a method, where you can leave the method with return, in the middle of a block.


In the moment I do it in two ways.
Version A:
index.a4d
        include preview.inc
                preview.inc
                        if($ajax)
                                include preview_ajax.inc
                        else
                                include preview_default.inc
                        end if


Version B:

include.a4d
        include preview.inc
                preview.inc
                        if($ajax)
                                include preview_ajax.inc
                        else
                                Normal Preview-Block
                        end if



Version C: (for this a new Active4D command would be needed.

index.a4d
        include preview.inc
                preview.inc
                        if($ajax)
                                include preview_alax.inc
                                exit include
                        end if
               
                        Normal Preview-Block




The advantage in Version C is, that I can break a Include File, Similar to return in a method.


Regards, Oliver
_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: Exit Include File

Aparajita Fishman
> Sometime it would be easier scripting, if we could exit a Include File, instead of using If else end if.

Use 'return'.

From the docs for 'return', page 92 (note the last sentence):

"This keyword (used on a line by itself) transfers execution to the first line of code after the current code block. If you are within an Active4D method, execution will continue at the first line of code after the line that called the method. If you are within an included file, execution continues after the include statement that included that file.”

Regards,

  Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: Exit Include File

Oliver Brodwolf-2
Hello Aparajita

Thanks a lot for this information. This helps.

Regards, Oliver

> Am 06.04.2015 um 19:27 schrieb Aparajita Fishman <[hidden email]>:
>
>> Sometime it would be easier scripting, if we could exit a Include File, instead of using If else end if.
>
> Use 'return'.
>
> From the docs for 'return', page 92 (note the last sentence):
>
> "This keyword (used on a line by itself) transfers execution to the first line of code after the current code block. If you are within an Active4D method, execution will continue at the first line of code after the line that called the method. If you are within an included file, execution continues after the include statement that included that file.”
>
> Regards,
>
>  Aparajita
>
> _______________________________________________
> Active4D-dev mailing list
> [hidden email]
> http://list.aparajitaworld.com/listinfo/active4d-dev
> Archives: http://active4d-nabble.aparajitaworld.com/

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/