Manually Starting and Stopping Dojo Offline Local Proxy

This document helps provide some hints on debugging Dojo Offline-based applications.

Sometimes, you might need to manually restart the Dojo Offline background processes during debugging. For Mac OS X, there is a start/stop script installed at /Applications/Dojo Offline Toolkit/dotlauncher.sh. To stop the Dojo Offline local proxy, type:

/Applications/Dojo\ Offline\ Toolkit/dotlauncher.sh stop

To start:

/Applications/Dojo\ Offline\ Toolkit/dotlauncher.sh start

Windows doesn't have a nice script like this. You must manually kill the Dojo Offline processes. Open the Windows Task Manager by pressing Cntrl-Alt-Delete. Dojo Offline starts two processes: 'dot' and 'proxy'. 'proxy' is the actual local proxy that caches offline files, while 'dot' is an automatic restarter that will restart the proxy if it crashes for some reason (we want to ensure that Dojo Offline is always running so the browser can use it). First, kill 'proxy'. Wait till it disappears. Then kill the 'dot' process.

To start Dojo Offline manually on Windows, type the following:

"C:\Program Files\Dojo Offline Toolkit\dot.exe" "C:\Program Files\Dojo Offline Toolkit\"

Assuming DOT was installed on to the C: drive.

Caching Issues

If while you are working Dojo Offline refuses to serve up the latest version of something that you are repeatedly iterating and changing, it can be useful to wipe out the Dojo Offline cache directory, located at ~/.offline-cache on Mac OS X and \Documents and Settings\\Application Data\Dojo\dot\.offline-cache on Windows. Delete everything inside this directory, but leave it present. You also should remember to clear the browser cache. Both of these techniques are rarely needed, but could be useful.

Testing Locally

If you want to run the server-side portion of a Dojo Offline-enabled app on your local machine, the same machine that you are testing the client-side browser in, you will not be able to use 'localhost' or '127.0.0.1'. Instead, you must use a domain name that only resolves on your own machine; I use brad.com, for example. The usual way to do this is to add an entry to your /etc/hosts file; unfortunately, the local proxy does not use this file to resolve DNS names. I have provided a workaround in this scenario. Go to where Dojo Offline is installed on your client-side machine (/Applications/Dojo Offline Toolkit/ on Mac OS X and C:\Program Files\Dojo Offline Toolkit on Windows -- the drive name might differ). Open the file 'config' located there. Find the following section in this config file:

	
# A test URL that will actually resolve to the address given by 
# 'testDomainAddress'; useful because Polipo does not resolve your local 
# etc/hosts.conf file, which can
# make testing disconnected web applications running on your local machine
# difficult
testDomain = "brad.com"
testDomainAddress = "10.37.129.2"

Change 'testDomain' to your test host, such as 'foobar.com', and change 'testDomainAddress' to be your localhost address (i.e. 127.0.0.1). Now restart Dojo Offline using the instructions above. In your browser, you can now go to 'foobar.com' (assuming you have a web server running on your own machine), and the Dojo Offline runtime will resolve that to '127.0.0.1' automatically. Basically, what we have here is a cheap /etc/hosts file without having to parse the full /etc/hosts file.