Oily Rag 1: CD Part 5

From The Uniform Server Wiki
Jump to navigation Jump to search

MPG UniCenter

MPG UniCenter

Oily Rag: Be prepared to get your hands dirty.

A complete CD solution

Creating a complete CD solution requires several components. The bare minimum would be USCD2 covered on the previous page this converts Uniform Server to run from a CD, a component to auto-run a CD when inserted finally a friendly user interface preferable a tray menu to control the servers.

Depending on the application it may be desirable to make a fully independent CD for example to avoid using a targets default browser, solution include portable Firefox. Perhaps you want to display your real web address in this browser’s address bar, can be resolved using a PAC file.

I am going to cover the minimum solution it will serve as a foundation for a fully independent CD if you wish to create one.

Preparation

Start by creating a new folder named it uni_cd (or whatever you like) this folder’s content will effectively be the CD’s image.

  • uni_cd Everything in this folder will be copied to a CD.

On the previous page we finished up with a working server suitable for either development and running from a CD, copy folder Uniform Server and all its content into folder uni_cd. (I have assumed it also contains your web site/sites)

Top

User Interface

A user interface (tray menu) is not essential however it does make the CD look more professional and servers easier to control.

For this example I am using ucUniTray remember you can tailor this to suit your own application. You are not restricted to this use an alternative if you prefer.

Download and install ucUniTray.

Before running servers and testing ucUniTray make sure you are in us_mode. Go to folder *uni_cd\Uniform Server\udrive\plugins\uscd2 and double click on us_mode.bat

Run ucUniTray and make sure it functions correctly especially if you have modified it.

After testing stop the servers, you could now switch to CD mode and burn a CD however it will not auto run, I cover this next.

Top

Auto Run

Several years ago I needed to auto-run a program from a CD and came across a superb utility Autorun Pro.

Search the Internet for “Autorun Pro” and you are bound to find a commercial variant however the one I am talking about is freeware developed by Mark Trescowthick and Ross Mack.

Top

Download

Download the latest version from their web site its under the heading Updated Utility at the end of the page. Yep! 98 was the last update.

For convenience you can download autorunpro.zip from Oliy Rag's Download page. Please read the license you will see there are minimal restrictions placed on its use.

Note: Zip file size 104K extracted exe only 108K.

Save the file to a folder of your choice after unzipping you will see the following files:

  • autorun.inf
  • AutorunPro.EXE
  • license.txt
  • readme.txt

Copy files AutorunPro.EXE and autorun.inf the folder "uni_cd"

Top

Configuration

When our CD is inserted it needs to run the following Start_ucUniTray.bat and then Server_Start.bat edit the autorun.inf file add Run directives as shown:

[Autorun]
open=AutoRunPro.exe
action=AutoRunPro.exe

[AutorunPro]
Run1="Uniform Server\Start_ucUniTray.bat"
Run2="Uniform Server\Server_Start.bat"

Note: Because folder Uniform Server contains a space the complete path needs to be enclosed in quotes. Normally the first thing I do is rename this folder and replace that bloody space with an underscore. Spaces in file names and paths are a REAL pain, rant over.


Top

Test Auto-run

Why I like this utility!

Save the file, check it works by double clicking on AutorunPro.EXE, ucUniTray will be displayed bottom right and servers will run.

No need for burning a CD in order to test auto-run, hence an ace little utility.

Top

Index page

At this stage you may want to change Server_Start.bat to start with your index.html page because of mode switching there are three files you need to change:

  • Server_Start.bat Location: *\uni_cd\Uniform Server
  • new_Server_Start.bat Location: *\uni_cd\Uniform Server\udrive\plugins\uscd2\uscd
  • old_Server_Start.bat Location: *\uni_cd\Uniform Server\udrive\plugins\uscd2\uscd

Locate the following line (68) in each file and change accordingly (original line commented out using rem)

rem ### Start Apanel
rem start \home\admin\www\redirect.html
start \www\index.html

Note: Default index page file extension .html .shtml .html.var .htm .php3 .php .pl .cgi

Top

Test

Before creating your coaster select CD mode using cd_mode.bat check auto-run works by double clicking on AutorunPro.EXE if you are happy burn the CD.

  • Close down servers.
  • Copy contents of folder uni_cd to your CD thats it.
  • Insert CD and check it works.

Top

Known Issues

When stopping servers using ucUniTray there is no user feedback confirming the temporary folder is being removed. This is because ucUniTray hides the command window; this can be corrected by modifying a line in ucUniTray's “ini” file.

  • Open the file ucUniTray.ini
  • Location: *\uni_cd\Uniform Server\udrive\plugins\ucUniTray
  • Locate and change the following line (75): (Original line shown commented out)

[StopUniServer]
;Action: run; FileName: "%USRoot%\Stop.bat"; ShowCmd: hidden; Flags: waituntilterminated
Action: run; FileName: "%USRoot%\Stop.bat"; Flags: waituntilterminated

Note: The above is strictly not required its more for user friendliness.

Top

Summary

The following provides a quick reference of the steps required:

  1. Create a new folder uni_cd (or whatever you like) this corresponds to CD’s image.
  2. Unpack a new copy of Uniform Server 3.5-Apollo to folder uni_cd.
  3. Apply Combined bug fix details and download
  4. Download uscd4.exe from Oily Rag Download page. Save to folder Uniform Server double click to extract files.
  5. Download and install ucUniTray.
  6. Download autorunpro.zip from Oliy Rag's Download page. save to any folder and unzip.
  7. Copy files AutorunPro.EXE and autorun.inf the folder "uni_cd"
  8. Edit autorun.inf to include lines Run1="Uniform Server\Start_ucUniTray.bat" and Run2="Uniform Server\Server_Start.bat"
  9. Pop your web site into folder www
  10. Edit Server_Start.bat, new_Server_Start.bat and old_Server_Start.bat to point to your index page.
  11. Optionally edit ucUniTray.ini to provide user feedback when servers stopped (temp file being deleted).
  12. Switch to CD mode and test.
  13. Burn the contents of folder uni_cd to a CD
  14. Test.

Top

Conclusion

I have not offered a definitive solution; everyone has his or her own requirements and preferences. The main building blocks are there all you need to do is hack them around to meet you own needs. I have tested this on XP home, seems to work fine apart from it being perceptively slow, takes my CD player a long time to crank up, its not blistering fast perhaps my expectation is to high.

My original writeup concluded at this point and glossed over how to create a self-contained CD. To conclude this writeup thought I would produce a real CD to mimic UniCenter's web site and Uniform Server's Wiki (my contributions). Portable Firefox is ideal for this and a PAC file will prevent the browser swanning off to resolve real web address. Part 6 shows you how to bolt these components together.

Top


Uc small logo.gif Ric