Advice on porting Qt server application to Qt cloud services



  • Dear all,

    I developed a web server application in Qt. The application creates for each incoming connection a new thread and opens a QTcpSocket. The client connection is kept open until the client application shuts down. The client uploads some data on offers, which are then stored in a MongoDB database and forwarded to all other clients which are connected to the server. These other clients may accept this offer, a request is then sent using a QTcpSocket to the server etc.

    I have the following questions:

    1. I understood it is not possible to work directly with QTcpSocket at the server level. Which alternative would be the least effort to port this application to Qt cloud services?
    2. At this moment the application is not REST compliant. I looked at the demo code of QHttpServer. Can this code be used in an industrial application or is there an SDK available?
    3. I currently compiled the MongoDB database driver and integrated this driver in my IDE. Which steps should I follow to integrate the driver offered by Qt cloud services?
    4. I saw none of the examples used multithreading at the server level. Is this possible or not necessary because of the MAR load balancing?

    Thank you in advance!


  • cid:52:privileges:purge

    @Hatchi said:

    1. I understood it is not possible to work directly with QTcpSocket at the server level. Which alternative would be the least effort to port this application to Qt cloud services?

    Pure TCP sockets are not possible but WebSockets are supported. Qt has included websockets since 5.3.

    1. At this moment the application is not REST compliant. I looked at the demo code of QHttpServer. Can this code be used in an industrial application or is there an SDK available?

    I'm not sure about this. Personally I wouldn't use QHttpServer in an industrial application but there are other frameworks available. I would just use websockets given that your app already is built using tcp sockets.

    1. I currently compiled the MongoDB database driver and integrated this driver in my IDE. Which steps should I follow to integrate the driver offered by Qt cloud services?

    Qt Cloud Services has MongoDB 2.6 available (in MDB). I think you should bundle the database driver so it gets compiled correctly when you push the code to MAR.

    1. I saw none of the examples used multithreading at the server level. Is this possible or not necessary because of the MAR load balancing?

    Multithreading should work just fine. You can also scale out your backend to multiple separate instances and load-balancing should work automatically (without any extra steps). You can even tweak load-balancing logic (round-robin, source etc).



  • Dear sir

    We have rebuilt and completed the development of our application such that it is compatible with Qt Cloud Services.

    We are currently working on a custom build pack which combines your code with the code for pulling in the MongoDB binaries. The final version will be found at https://github.com/jonaspoelmans/p2/tree/master/bin

    We changed the parameters of our MAR:
    qtc-cli mar envs:set BUILDPACK_URL=https://github.com/jonaspoelmans/p2 --app mar-eu-1-p9n144f0

    When pushing the code to the MAR we experience the following issue:

    $ git push qtc master
    Enter passphrase for key '/c/Users/Guest/.ssh/id_rsa':
    Counting objects: 52, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (52/52), done.
    Writing objects: 100% (52/52), 104.89 KiB | 0 bytes/s, done.
    Total 52 (delta 2), reused 0 (delta 0)
    -----> Fetching custom buildpack
    remote: /tmp/builder/build.sh: line 102: /tmp/buildpacks/custom/bin/detect: Permission denied
    -----> Unable to select a buildpack
    ERROR: build failed to complete
    To git@git-mar-eu-1.qtc.io:mar-eu-1-p9n144f0

    • [new branch] master -> master

    What is causing this problem?

    Kind regards and thanks
    Jonas


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.