Home

CloudTk FAQ

CloudTk FAQ

FAQ Index

  • 1. What is ...?
  • 1.1. What is CloudTk?
  • 1.2. What is TclHttpd?
  • 1.3. What is a Tclkit?
  • 1.4. What is a Starkit?
  • 1.5. What is the default HTTP port?
  • 1.6. What is the default HTTPS(SSL) port?
  • 1.7. What is the version of OpenSSL the Tcl TLS extension uses that comes with CloudTk?
  • 1.8. What is the version of SSL/TLS CloudTk is configured to use?
  • 2. How to ...?
  • 2.1. How to display a Tk application in a web browser using CloudTk?
  • 2.2. How to display your Tk and other X11 apllications in a web browser using CloudTk?
  • 2.3. How to launch your Tk application from another Web Server?
  • 2.4. How to make your Tk application appear in a Web page?
  • 2.5. How to enable Authentication when accessing your Tk Applications(VNC) or the Website?
  • 2.6. How to change the default HTTP and HTTPS(SSL) ports?
  • 2.7. How to turn off HTTP?
  • 2.8. How to Setup HTTPS(SSL)?
  • 2.9. How to use your own Apache-style htpasswd file?
  • 2.10. How to Upgrade noVNC?
  • 2.11. How to run CloudTk at startup on Linux?
  • 3. General Questions
  • 3.1. What do the messages mean when CloudTk is started?
  • 1. What is ...?

    1.1. What is CloudTk?

    CloudTk is based on WebSockit2me - a TCP to WebSocket gateway that uses a noVNC to display Tk applications in modern Web Browser. It runs on Linux and requires Xvnc server (Tigervnc) to be loaded. Tk applications are listed on a web page. TclHttpd dynamically launches an Xdisplay via Xvnc and then starts a matchbox window manager and launches the Tk application.

    1.2. What is TclHttpd?

    TclHttpd is a pure Tcl implementation of a Web server. See

    wiki.tcl.tk TclHttpd wiki page

    TclHttpd Web Server.

    TclHttpd Reference.

    1.3. What is a Tclkit?

    A Tclkit is a single-file executable that provides a complete Tcl and Tk runtime and can execute both normal Tcl scripts or script archive files known as StarKits. Tclkit is provided pre-built for a number of platforms and is updated to track Tcl releases for the major platforms (Windows, Linux and MacOS X).

    For pre-built files see the Tclkit Downloads page.

    See also Brent Welch's sample book chapters from Practical Programming in Tcl and TK.

    1.4. What is a Starkit?

    A Starkit is a single-file packaging of a directory hierarchy containing Tcl scripts, platform-specific compiled code, and application data. A starkit leverages Tcls virtual filesystem to provide writeable filesystem, meaning that a starkit is modified at runtime as data is saved by the program.

    Starkits facilitate simple deployment of cross platform applications.

    The name comes from STandAlone Runtime.

    See also Brent Welch's sample book chapters from Practical Programming in Tcl and TK.

    1.5. What is the default HTTP port?

    The default http port is 8015.

    1.6. What is the default HTTPS(SSL) port?

    The default https port is 8016.

    1.7. What is the version of OpenSSL the Tcl TLS extension uses that comes with CloudTk?

    OpenSSL 1.0.2d 9 Jul 2015

    1.8. What is the version of SSL/TLS CloudTk is configured to use?

    CloudTk is configured to use TLS 1.2 only. Modern browsers that support WebSockets will support TLS 1.2 also.

    2. How to ...?

    2.1. How to display a Tk application in a web browser using CloudTk?

    On startup CloudTk creates a directory Tk/TkPool in the same directory CloudTk.kit is installed. A sample application TkPool.tcl and a startup script TkStartup.tcl are copied into this directory.

    Point your browser to http://<<Your IP Address>>:8015/cloudtk/

    A web page with a radio button with TkPool is display. Select the radio button and click submit. The TkPool application is displayed. Click below the white line and start to play.

    2.2. How to display your Tk and other X11 apllications in a web browser using CloudTk?

    Create a directory with the Tk or X11 application name in the Tk/ directory like TkPool. The directory name is what is displayed in the webpage but this can be anything really. Copy the TkStartup.tcl file from the TkPool directory into your directory. Open TkStartup.tcl file in a text editor and edit the line starting with the command "source" and adjust the path to where your Tk application is. TclHttpd does not need to be restarted as the web page is generated on the fly. The web page should display two radio buttons. TkPool and the directory name you created. If you do not want TkPool to be displayed just delete the TkPool directory.

    N.B. If you are running an X11 application (or older Tk app less than Tcl8.6) replace the "source" command with an "exec" command and the full path of your application.

    e.g. exec /usr/bin/python3 /usr/local/cloudtk/Tk/FeetToMeters/FeetToMeters.py

    e.g. exec /usr/bin/xclock

    e.g. exec /usr/local/tclkit-8.4.18 /usr/local/cloudtk/Tk/GooWee/GooWee.tcl

    2.3. How to launch your Tk application from another Web Server?

    Put a link to your Tk application like for example TkPool

    http://<<Your IP Address>>:8015/cloudtk/VNC?session=new&Tk=TkPool

    Make sure the first query parameter is "session=new"

    2.4. How to make your Tk application appear in a Web page?

    By using inline frame <iframe> HTML tag in your Web page.

    Put a link to your Tk application like for example TkPool

    <iframe height="600" width="600" src="http://<<Your IP Address>>:8015/cloudtk/VNC?session=new&Tk=TkPool" allowfullscreen></iframe>

    Make sure the first query parameter is "session=new"

    2.5. How to enable Authentication when accessing your Tk Applications(VNC) or the Website?

    CloudTk has the ability to turn on Authentication for any combination of Tk Application page and the rest of CloudTk website pages.

    In the directory where CloudTk.kit is installed an "auth" directory is created. In this directory there is an "AuthTarget.txt" file. The following is written to "AuthTarget.txt" file by default:

    VNC 0

    Website 0

    "1" equals Authentication is "ON" and "0" is "OFF".

    Just edit this file to your requirements.

    2.6. How to change the default HTTP and HTTPS(SSL) ports?

    To change the http port use -port <port no.> on the command line.

    To change the https port use -https_port <port no.> on the command line.

    e.g. ./tclkit CloudTk.kit -port 8080 -https_port 8443

    2.7. How to turn off HTTP?

    Don't turn off HTTP by setting -port 0 on the command like

    e.g. ./tclkit CloudTk.kit -port 0

    This actually lets the OS choose a random high port to listen on.

    To stop access to the HTTP port I would suggest filtering via a firewall or router and only allow access to HTTPS port.

    2.8. How to Setup HTTPS(SSL)?

    To setup HTTPS, a Server certificate (server.pem) and a Server key (skey.pem) file need to be installed in the "certs" directory that is created where CloudTk.kit is installed. Openssl needs to be installed to generate a self signed certificate. On most Linux distributions this is usually standard.

    • On Linux change directory to the "certs" directory where CloudTk.kit is installed. Enter the following on the commandline. e.g.

      /usr/local/cloudtk/certs# openssl req -new -x509 -days 365 -nodes -out server.pem -keyout skey.pem

      Hit the "Enter" key to accept the defaults to the questions.

    This creates a server.pem and a skey.pem file in the "certs" directory. Restart CloudTk and now HTTPS should be configured.

    Point your browser to https://<<Your IP Address>>:8016/

    To use Let's Encrypt copy from the let's encrypt the fullchain.pem file to server.pem and privkey.pem file to skey.pem in the "certs" directory. Restart CloudTk and now HTTPS should be configured.

    2.9. How to use your own Apache-style htpasswd file?

    In the directory where CloudTk.kit is installed an "auth" directory is created. In this directory an AuthUserFile exists which has the webmaster username and password. Copy the contents of your htpasswd file and paste into the AuthUserFile. If you go to the Access Control Editor you should see the new users added.

    2.10. How to Upgrade noVNC?

    In the directory where CloudTk.kit is installed, create a "noVNC" directory. In the "noVNC" directory, install the new version of noVNC with the "include/", "images/" "vnc.html" etc... files and directories. Restart CloudTk and it should detect the created "noVNC" directory and use the new version of noVNC. To go back to the inbuilt version of noVNC included with CloudTk just delete the "noVNC" directory you just created.

    2.11. How to run CloudTk at startup on Linux?

    You need to be familiar with how to create an "rc" script on your Linux distribution. The "rc" script would execute a shell script that you create usually in /usr/local/bin.

    Create a shell script in /usr/local/bin with the following

    #!/bin/sh

    exec /usr/local/cloudtk/tclkit /usr/local/cloudtk/CloudTk.kit -port 8080 -https_port 8443

    Most modern Linux distributions use Systemd. Refer to the man page.

    3. General Questions

    3.1. What do the messages mean when CloudTk is started?

    The mesages that appear like below:

    can't find package limit
    Running with default file descriptor limit
    /debug user "debug" password "XXXXXXXXXX"
    httpd started on port 8015
    secure httpd started on SSL port 8016

    The first two lines can be ignored as they are just informational messages.

    The /debug line shows the username and password for the user "debug". This is used when the server encounters an error in a Tcl script, the server requires authorisation from the user "debug" before the error message is displayed.

    The "httpd started on port 8015" informs that the server started and is listening on port 8015.

    The "secure httpd started on SSL port 8016", this message appears if there is a server.pem file present in the "certs" directory. It informs that the server will be listenining for https connections on port 8016.

    Home/kanaka/noVNCFAQAccess Control