Monday, November 10, 2014

Issues With Caché Administration On A Personal Computer
(Or how to administer Caché with your tablet)

This post will concentrate on issues I have run into and had to solve while administering the Intersystems Caché® DBMS. Since getting my first iPad in 2010 and Kindle Fire a few years ago I have been using my laptop and Macbook less while using the tablets (and iPhone) more. Some tasks are best suited using a telnet client, but as most would agree, using a telnet client can be painful on a tablet (worse on an iPhone). Fortunately all Unix servers and some of the DBMS I work with provide a web user interface to help administer the system. Caché is one that offers an excellent system administration web UI, that is built on a delivered pared-down version of Apache (called the Private Web Server or PWS). By default the PWS listens on port 57772 (versus the well known port 80). Allowing remote devices to access the PWS pages may require modifying any firewall that is running on the Caché system (either a Windows PC or Mac for the purposes of this article).

Web:

Browsing to the CSP pages that are hosted by a production Caché installation running on a Unix or Windows server is straightforward. Simply enter the URL in the Safari address bar. However, to do the same thing for an installation on a Windows PC (versus a Windows server, typically configured for HTTP services) likely requires opening up the Windows firewall to allow web traffic.

Note: The configuration and programming examples (including screenshots) displayed on this site are for illustrative purposes only. Use at your own risk.







This article assumes that there is no web server already running (IIS, Apache, etc.). Installing Caché automatically installs Apache2 on the PC. It is this program that will be added to the firewall.
On the Windows or Mac computer running Caché attempt to browse to the Management portal. This will establish that the Apache server is running.

Attempting the same thing (browsing to the Windows or Mac computer) from a tablet is likely to fail. To allow browsing to the Caché web UI from another device then add the web server program to the firewall.

Windows 7:

To do this, open the "Network and Sharing center" window in the Windows Control panel, and click "Windows Firewall".


(add cache.web.ui.login.and.windows.firewall.2.png )
Then click "Allow a program or feature through Windows Firewall". The window to allow programs should appear, and may look similar to the following:




At this point click the "Allow another program..." button, and browse to the InterSystems installation directory and drill down into the directories to find the httpd directory, and in the http directory select httpd.exe and click "Open":







The "Add a Program" dialog displays the Apache HTTP Server program in the list. At this point it may I recommend clicking the "Network location types..." button and choosing the home or work network (versus a public network), to provide the option to restrict access, depending on the network.

Click "Add" to close the "Add a Program" window, and then click "OK" in the "Allowed Programs" window to allow web access through the firewall.






At this point with your tablet web browser attempt to bring up the Management portal login page on the PC (or Mac) using its IP address:

http://IP-address:57772/csp/sys/UtilHome.csp

















At a minimum this is all that is required to be able to use your tablet (or any other network device with a web browser) from your home network. If the computer running the personal installation of Caché is behind a router (typical in a home office environment) and there is a need to remotely view the Caché CSP pages, then consider adding a rule in the router to allow remote access (obviously great care should be taken to ensure only authorized access is granted).





To see how the newly installed Apache server is configured (startup options), view Apache's properties. To do this, click Start and right-click Computer and select Manage. Expand Services and then find the web server in the list. Note that it is installed with the option to run as a service. Also note that it is initially set to run manually. You can change this to start automatically on Windows start-up.



































OS X Mavericks 10.9.x:

As with the Windows firewall, add the Intersystems Caché httpd binary to the firewall:





























Or, if when browsing to the computer and the firewall is enabled then when prompted on the Mac to add access to "cache" click "Allow":
Since ipfw has been deprecated (I'm running 10.9.2) I find the GUI firewall does not work consistently. As the Caché delivered https uses a non standard port the OS X firewall appears to still block incoming HTTP traffic (The application firewall does not allow for applications with non-standard ports (see this Apple KB article)).




Telnet:

I want to spend some time discussing telnet. When I teach database administration to customers at our annual user conference, I work in a GUI as much as possible. However, when I am administering a system (or troubleshooting a problem on a customer system) I ONLY work in telnet. The tools in the OS are extremely powerful and with the ability to string Unix commands together there is little reason to use a GUI unless you are unfamiliar working at the OS level.


An issue I have run into is a conflict with the Caché telnet service daemon and an existing telnet server. On my Windows development laptop there is already a UniVerse telnet service running. If I run the Caché telnet client (or any telnet client for that matter) and connect to the localhost (my laptop) the regular UniVerse login dialog appears:
(insert Cache.launcher.start.telnet.png)






There can be only one listener on port 23 (the standard telnet port). To resolve the conflict stop the running telnet server process and start the Caché telnet server process in its place.



























Perhaps a better option is to change the port number that the telnet server is listening on. For the Caché telnet server daemon that can be accomplished by bringing up the Management Portal and going System Administration->Configuration->Device Settings->Telnet Settings and changing the "Telnet Port Number" to a number different than the standard (23). Use netstat to see what ports are in use. Here is a screenshot of the telnet port number setting:





Note: The configuration and programming examples (including screenshots) displayed on this site are for illustrative purposes only. Use at your own risk.

No comments:

Post a Comment