Results 1 to 3 of 3

Thread: [Answers] Cloud Server-1

  1. #1
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135

    [Answers] Cloud Server-1

    Enabling Port 80
    If you do not have an existing web server and want to run the Lianja Cloud Server on port 80 as well as port 8001:

    Linux
    =====
    Edit the text configuration file /etc/lianja.d/lianja.conf and change the line
    DB_PORT80_ENABLED="false" ;export DB_PORT80_ENABLED

    to
    DB_PORT80_ENABLED="true" ;export DB_PORT80_ENABLED

    Then restart the Lianja Server.

    Windows
    =======
    Check the 'Enable HTTP requests on port 80' Setting in the Lianja Server Manager:

    Then restart the Lianja Server.



    Amazon AppStream Update - Access Windows Apps on Chromebooks, MacBooks, Kindle Fires, and More
    http://aws.amazon.com/blogs/aws/apps...pps-on-devices
    We will be testing this out running Lianja Desktop Apps in the Amazon Cloud and will report back our findings.



    implemented in the Cloud Server.
    - Cursoradaptor
    - NetworkRequest
    - COM/ActiveX
    - Virtual tables



    In the v1.2.4 release we have now made the Lianja ISAPI Extension for IIS available in the distribution.
    This provides seamless integration with IIS and the ability to use https/SSL encryption.
    Performance is almost as good as the native Lianja Cloud Server as we have implemented it using intelligent connection pooling.



    Q:
    how to bypass the login screen for the cloud server
    A:
    There is an app setting to run as guest. That should prevent the login screen. If it doesn't let me know.




    Just to make you all aware of a few changes in the Lianja v1.2 Cloud Server distribution.
    1. No sample apps are included so that it can be installed for live use.
    2. Port 80 is disabled by default. Port 8001 is enabled. This prevents any conflict with IIS and/or Apache.
    The App Builder automatically detects what port the server is running on.
    This has been done to make it easier to upgrade existing sites without having to remove the example apps.
    Any Apps needing deployed should be done in the "Web App View", "Tablet App View" or "Phone App View".
    The "Save" button in the Web App View has now been renamed to "Deploy".
    The Lianja App Builder APaaS Developer now handles 50 local/remote connections for testing your Web and Mobile Apps.
    Creating a new App now has an "App Wizard" to provide a more streamlined experience.



    Yes the Lianja cloud server is used with web and mobile.
    The appliance has everything installed to save time.
    Lianja Cloud Server is preinstalled as is guacamole.



    if you need OData access you will need Cloud Server as SQL Server only supports ODBC Data access.



    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352
    This same topic is extended to another thread: http://www.lianja.com/community/show...Cloud-Server-2
    Last edited by josipradnik; 2016-10-24 at 03:15.

  2. #2
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Q:
    I am using the cloud server as I am running everything on my desktop as per a standard install - or do all web apps use the cloud server?
    A:
    If you install a apass developer the cloud server is also installed on your development machine. Please open the web examples, view as web app then preview. Once you are familiar with these steps proceed to experiment with calling server side JavaScript if that's your server side scripting kanguage of choice.



    Lianja Cloud Server incorporates an embedded database and Lianja SQL Server. If you have Lianja cloud server installed you do not need (and should not) install LuanhaLianja SQL server.



    Q;
    I have a wedding application (for my son) that guests will be using during the wedding.
    I would like them to not have to type in the entire url.

    Meaning - to get there now, you need to type in.
    Samswedding.online/apps/wedding/index.html

    I would like them to only type samswedding.online and have it re-directed.
    A:
    you can create a QR code for a URL. There are several free sites. Then print the QR code on folding cards, and put them on each table.
    you need to obtain a domain from someone like network solutions or setup a CNAME in DNS.
    http://www.networksolutions.com/supp...d-dns-records/
    I use easydns.com for my domains and DNS. They have Forward and Stealth options (the latter continues to show the original entered URL).

    If you're using the IIS plug-in then you will have actual rewrite capabilities, of course. http://nicolas.guelpa.me/blog/2015/0...irect-iis.html I haven't tried a rewrite with the LCS, so let us know if you try it. <s>



    Because Lianja uses the .dbo files, a cloud server app can be upgraded on-the-fly.



    The Lianja Cloud Server includes the following features/functionality:

    -- An embedded version of the Lianja database engine
    -- Lianja SQL Server for ODBC data access
    -- Lianja OData Server
    -- Lianja WebSockets Server
    -- Lianja/VFP Server Pages (.rsp files)
    -- Lianja/JavaScript Server Pages (.jssp files)
    -- Handles interaction with Lianja HTML5/JavaScript Web Apps
    -- Handles interaction with Lianja HTML5/JavaScript PhoneGap Mobile Apps

    Dynamic server pages contain HTML5 and directives that tell the Cloud Server how to process the contents of the page.

    <%@ Language=VFP %>
    or
    <%@ Language=JavaScript %>

    Let's see some example code.
    Code:
    <%@ Language=JavaScript %>
    <!--
        Lianja/VFP Server pages (.rsp) have the complete Lianja scripting engine embedded in them.
        ---------------------------------------------------------------------------------------------
        When a Lianja/VFP Server Page is executed the following are available to the script
        in addition to the complete VFP compatible cross-platform scripting language 
        implemented in Lianja.
        
        Global associative arrays:
        
             _REQUEST[]
             _SERVER[]
             _ARGS[]
             _GET[]
             _POST[]
             _FILES[]
             _COOKIE[]
             _SESSION[]
        
        Global objects:
        
            Response
                write( text )
                writeFile( filename )
                addCookie(name, value)
                addHeader(name, value)
                clear()
                flush()
                redirect( url )
                authenticate( [message] )
                appendToLog( message )
                include( filename )
                
        Built-in commands/functions:
        
            ? cExpression 
            echo cExpression 
            move_uploaded_file(tofilename, fromfilename)
            die(message)
            include( cExpression )
            object = require( cExpression )
            odata_Create( url, jsondatastring )
            odata_Read( url [, filename] )
            odata_Update( url, jsondatastring )
            odata_Delete( url, jsondatastring )
        
        JavaScript Server Pages are modelled on PHP Server Pages. 
        ---------------------------------------------------------
        When a JavaScript Server Page is executed the following are available to the script
        in addition to the built-in JavaScript functions. These will be familiar to PHP 
        Web developers.
        
        Global associative arrays(objects):
        
            $_REQUEST[]
            $_SERVER[]
            $_ARGS[]
            $_GET[]
            $_POST[]
            $_FILES[]
            $_COOKIE[]
            $_SESSION[]
        
        Global objects:
        
            Lianja.
                execute( vfp_command )
                evaluate( vfp_expression )
                openDatabase( databasename )
                    openRecordSet( table_or_sqlselect )
                        moveFirst()
                        moveNext()
                        movePrevious()
                        moveLast()
                        move()
                        moveRelative()
                        moveBookmark()
                        findFirst( condition )
                        findNext( condition )
                        findPrevious( condition )
                        findLast( condition )
                        edit()
                        update()
                        delete()
                        requery()
                        field( name_or_number )
                            .name
                            .type
                            .width
                            .decimals
                            .value
                        close()
                        bof
                        eof
                        found
                        nomatch
                        recno
                        reccount
                        fieldcount
                        index
                        filter
                    close()
            Response
                write( text )
                writeFile( filename )
                addCookie(name, value)
                addHeader(name, value)
                clear()
                flush()
                redirect( url )
                authenticate( [message] )
                appendToLog( message )
                include( filename )
        
        Built-in functions:
        
            print( cExpression );
            echo( cExpression );
            move_uploaded_file(tofilename, fromfilename);
            die(message);
            debugout(message);
            include( cExpression );
            object = require( cExpression );
            odata_Create( url, jsondatastring );
            odata_Read( url [, filename] );
            odata_Update( url, jsondatastring );
            odata_Delete( url, jsondatastring );
            tmpnam()
            objectType( object_fieldname )
            objectRead( from_filename, object_fieldname )
            objectWrite( to_filename, object_fieldname )
            base64_encode_object( object_fieldname, width, height)
            unlink( filename )
    
    
        The following is an example Lianja JavaScript Server Page.
                
    -->
    <html>
    <body>
    <%
        // Note that just as in PHP, JavaScript Server Pages can use include_once( filename) and include(filename)
        // The path of the filename is relative to the directory containing this script.
        include_once("library_example.jssp");
    
    
        // The Lianja global object provides embedded database access
        db = Lianja.openDatabase("southwind");
        print("db=" + typeof db); 
        print("<br>");
        
        // Lianja.openDatabase() returns a Database object so now we can open a RecordSet
        rs = db.openRecordSet("select * from customers");
        print("rs=" + typeof rs); 
        print("<br>");
        print("Fieldcount="+rs.fieldcount);
        print("<br>");
    %>
    <table>
    <%
        print("<tr>");
        for (i=0; i<rs.fieldcount; ++i)
        {
            print("<td>"+rs.field(i).name+"</td>");
        }
        print("</tr>");
        rs.moveFirst();
        for (j=0; j<rs.reccount; ++j)
        {
            print("<tr valign='top'>");
            for (i=0; i<rs.fieldcount; ++i)
            {
                print("<td>"+rs.field(i).value+"</td>");
            }
            print("</tr>");
            rs.moveNext();
        }
        rs.close();
        db.close();
    %>
    </table>
    </body>
     </html>


    http://localhost/examples/example_request.rsp

    Reading these examples will show you how to upload files, handle authentication and much more.

    Question:

    Do you need to write code like this to run Lianja Web and Mobile Apps.

    Answer:

    If you follow best practices no you don't
    but if you want to format a custom WebView section or use a third party JavaScript framework this is when you would use dynamic server pages.

    And by the way, they are *very* fast. HTTP web connections and ODBC connections to MSSQL / MySQL / PostgreSQL etc are pooled internally.



    Q:
    I am wanting to set Lianja Cloud Server,
    follow the instructions in the documentation,
    but want to connect to http: //localhost/login.rsp
    I get browser error "HTTP Error 404.0 - Not Found"
    is this is something of the IIS configuration, but still the steps and it does not work.
    A:
    try this.

    http://localhost:8001/

    A2:
    Was a bad IIS Configuration,

    IIS Default directory, was originally C:\INETPUT\WWWROOT
    and change to:
    C:\lianja\cloudserver\tenants\public\wwwroot
    You do not need to change the IIS default directory. That would interfere with existing web configuration.

    The Lianja extension takes care of all that based on how it is configured.

    I run with IIS and did not change the IIS default directory.



    Some clients do not like the idea of using mapped network drives.
    That doesn't seem to be an issue.
    In my testing, I create the public folder shared on the cloudserver (it is installed on the server as C:\Lianja\cloudserver\tenants\public\.
    Then in the client desktop shortcut, I just set the target to the runtime library, and then use \\myservername\public\apps\myapp
    like so.

    C:\Lianja\bin\lianjaruntime.exe -a \\<myserver>\public\apps\<appname> --nosplashscreen



    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...p?2717-Answers
    This same topic is extended to another thread: http://www.lianja.com/community/show...Cloud-Server-2

    Last edited by josipradnik; 2016-10-24 at 03:14.

  3. #3
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Q:
    Is there a way to log the detailed http activity on the Lianja cloud server?
    I'm in the process of writing and testing a Lianja authentication module in Angular 2 and I'm having problems getting access.
    I have been able to use the Login() in LianjaCloudDataServer.js to login via a standard html page with no problems however I can't seem to translate the process into Angular 2.
    I format my headers and send using an http get and I get a valid OK response but no auth token is set. I've even modified the authenticate.rsp to include the contents of the _SERVER array in the response and it shows the AUTHTYPE, REMOTE_USER and REMOTE_PASSWORD fields have been updated, so the server thinks I'm logged in, but no token is set in the browser.
    I've done some checking and the http headers I'm sending from Angular 2 appear to be the same as those sent by the LianjaCloudDataServer Login(). The only difference I can see if that there appears to be a query string being appended to the URL from Login() but I can't seem to track down where that's coming from.

    A:
    If you set the HKEY_LOCAL_MACHINE\SOFTWARE\Lianja\Lianja Server\NetServer\DB_WWWDEBUG Registry value to true, you will get firecat_debugXXXX.txt files under \lianja\debug\ reporting server activity.
    (On 64 bit this will be HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Lianja\Lia nja Server\Netserver\DB_WWWDEBUG).

    Q2:
    I've worked out my Angular 2 Lianja login problem.
    Enabling logging allowed me to see that my Http headers were missing the Accept and X-Requested-With headers.
    I added the missing headers, which made my headers look identical to those generated by the LianjaCloudDataService.js Login(), but I was still unable to get authenticated.
    Then, pretty much by accident, I cleared my browser cookies and sent my request and, will wonders never cease, it worked.
    I did a bit more digging and found that the LianjaCludDataService.js Login() removes browser cookies before attempting to authenticate so, apparently, it was the presence of these cookies preventing me from getting authenticated.



    on Windows you can integrate Lianja Cloud Server with IIS using the Lianja ISAPI Extension for IIS.



    Q:
    my question about individual databases of items...each customer I sell the application to (even if they use a cloud option) will have their databases residing on their own pc?
    A:
    Yes, individual database (i.e. table of items) of each customer you sell your application to will reside on his PC.
    If it is LAN, then database will reside on one PC in that LAN.
    In cloud, databases will be all together somewhere (e.g.Amazon Cloud) , but separated as "tenants" - and not aware of each other.

    In Lianja folder you will find the table CUSTOMERS.DBF in 3 folders.
    C:\lianja\cloudserver\tenants\public\data\southwin d\
    C:\lianja\data\southwind\
    C:\lianja\server\data\southwind\

    As you can see, there is the same structure where the database southwind (and the table customers.dbf) is located for development, app center, cloud.
    About mapping the drives
    : https://www.lianja.com/doc/index.php..._Line_Switches
    --runtimedatadir
    --networkshare

    --runtimedir
    --tenancy



    you can use Lianja Cloud Server to handle OData CRUD operations from other third party UI frameworks if that is a requirement. To use these OData functions on the client (no server side coding required) you should include the following files in your App:

    /library/jquery-1.10.2/jquery-1.10.2.min.js
    /library/LianjaWebFramework/LianjaCloudDataServices.js
    This provides core javascript client side functionality for working with the LIanja Cloud Server. It is not required with Lianja Apps as they have the full framework included.



    Q:
    We are looking at using Lianja's OData interface for our non-Lianja web and mobile clients.
    Our specification calls for us to secure the interface using web tokens requiring clients to include a valid token in the header of every request which Lianja will have to validate prior to transmitting any data. Does Lianja include any mechanism's for this type of security ? If not, do you have any suggestions as to how we should address this requirement?

    A:
    Lianja cloud server requires authentication and it uses a similar technique that you mention using an API KEY that is created as a server side session cookie. Once created on the server the cookie cannot be modified on the client.
    We do not enforce this when using odata but we could, so I suggest you submit an enhancement request and we can add a setting for cloud server that requires login authentication before issuing odata calls.
    in fact there is a Lianja.login() method in LianjaCloudServices.js already.
    Also, I should mention that authentication can be via the Lianja users table or with AD/LDAP.
    There is no state maintained on the server.
    If you use OData calls you cannot inspect the http headers. OData is a RESTful interface.
    If you write your own RESTful API you can do whatever you want at the expense of time and effort.
    This has now been implemented in Lianja 3.2.1.

    So if you check "Authenticated OData service" all OData RESTful API calls should be authenticated first. The user can be setup in Lianja or AD/LDAP. If the optional APIKEY is specified then no authentication is required but the HTTP headers must contain "lianjaOdataApiKey:yourkey" and your key must match the specified APIKEY.
    As I mentioned earlier you need to include jquery and LianjaCloudDataServices.js which has methods for:
    Lianja.login()
    Lianja.isLoggedIn()
    Lianja.logout
    Lianja.OData_Create()
    Lianja.OData_Read()
    Lianja.OData_Update()
    Lianja.OData_Delete()
    Lianja.evaluate()
    Lianja.getUrl()
    Lianja.json_encode()
    Lianja.json_decode()
    Lianja.base64_encode()
    Lianja.base64_decode()
    and other useful methods.

    Q2:
    If I were hitting the page from a non-Lianja application, how would I authenticate initially? Is there a way to use User and UserRoles in this scenario?
    I am imagining something like the initial oData call from the external app either passing a username and password assuming https or a vpn or a call to a method passing an encrypted username and password where other encryption isn't in place.

    A2:
    You need to specify credentials in the HTTP headers and the client needs to be able to handle session cookies. If the client is not a browser it needs to be able to read the HTTP headers sent back by the cloud server and resend the session cookies for each request.
    The cloud server does more than check the username and password. It also creates an authentication token as well as determine the roles assigned to the specified user.
    These roles are used not only to control permissions in web and mobile apps but also (in 3.4 as stated in the roadmap) provide row level security and column masking.
    So you need to go through the proper authentication mechanism.

    http or https is the same technique. You just need to read the login() code in LianjaCloudDataServices.js and you will see how to send the authentication username and password. If you are not running in a browser you need to read the raw http response header and send the cookies it contains back on future requests. That's how browsers work so you just have to look like a browser to the remote Lianja Cloud Server. In other words use the http protocol.



    Q:
    If you enable an option to require users to login prior to using the OData service, how would the server determine if a request comes from a logged in user?
    A:
    We create an encrypted session cookie. The details of this are internal and I would not like to explain for security reasons.
    Any cookie created on the server and included in the http headers sent back to the client cannot be modified on the client. These are known as session cookies.
    We inspect the http headers and check for the encrypted session cookie. It contains information to allow us to determine who the user is and what machine authenticated. We can then verify this authentication for each request made to the server.
    I'm testing Beta7 with my server configured as so...

    I'm finding that I am unable to access http:\localhost:8001/login.rsp.

    This also appears to be preventing non-local access to the login.rsp as well...

    This might be down to my being confused about how these new settings are meant to work together but, as it currently stands, with this configuration, Lianja clients wouldn't be able to authenticate if they can't get to the login page.
    ADDENDUM: I've now tested the the system with the server configured with Allow unauthenticated local access ENABLED and...

    both local and remote unauthenticated users are allowed to access login.rsp as well as other pages and odata resources. Authenticated users have full access.
    ADDENDUM: I've now tested the system with the server configured with Allow unauthenticated local access, Authenticate OData requests and Authenticate Page requests all enabled and...

    both local and remote unauthenticated users are allowed to access login.rsp but are prevented from accessing any active pages or OData resources. Authenticated users are allowed full access.
    A:
    Allow unauthenticated local access should be left checked. It's only relevant to Lianja SQL server.
    The other settings you have screenshots of are working as expected.



    Q:
    Does the Lianja Cloud Server provides any means of tracking active sessions, active connections, active users etc?
    A:
    On windows, the Lianja server manager does that and displays the active connections.
    Bear in mind though, when using the IIS plugin on Windows, connections may timeout and be kept alive and reused. The IIS plugin creates a bunch of connections when it starts up and allocates these when a connection request is made. If the number of connection requests exceeds the number of available connections new ones are created. Only when connections that are kept alive for a period of time timeout are they destroyed. This provides optimum throughput on a heavily loaded system.



    Lianja Cloud will provide integrated Continuous Delivery using Amazon CodePipeline from an Amazon CodeCommit or GitHub git repository.

    Amazon CodeCommit


    Anyone with an AWS account can get started with AWS CodeCommit for free. Your account gets 5 active users per month for free (within limits), after which you pay $1 per additional active user per month. There are no upfront fees or commitments.
    This AWS Free Tier offer for AWS CodeCommit is available to both new and existing AWS customers indefinitely, and does not expire at the end of the standard 12 month Free Tier term.
    https://aws.amazon.com/codecommit/
    We will provide more information about configuration when Lianja Hosted Cloud is available.

    Amazon CodeDeploy


    AWS CodeDeploy is a service that automates code deployments to any instance, including Amazon EC2 instances and instances running on-premises. AWS CodeDeploy makes it easier for you to rapidly release new features, helps you avoid downtime during application deployment, and handles the complexity of updating your applications. You can use AWS CodeDeploy to automate software deployments, eliminating the need for error-prone manual operations, and the service scales with your infrastructure so you can easily deploy to one instance or thousands.
    One of the things we are also looking at is continuous database schema updates as part of the continuous delivery pipeline.

    Amazon CodePipeline


    AWS CodePipeline is a continuous integration and continuous delivery service for fast and reliable application and infrastructure updates. CodePipeline builds, tests, and deploys your code every time there is a code change, based on the release process models you define. This enables you to rapidly and reliably deliver features and updates. You can easily build out an end-to-end solution by using our pre-built plugins for popular third-party services like GitHub or integrating your own custom plugins into any stage of your release process. With AWS CodePipeline, you only pay for what you use. There are no upfront fees or long-term commitments.



    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352
    This same topic is extended to another thread: http://www.lianja.com/community/show...Cloud-Server-2
    These answers are also systematized on the site "Lianja developer": https://lianjadeveloper.wordpress.co.../cloud-server/
    Last edited by josipradnik; 2017-11-30 at 00:42.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us