As I couldn't find this on the 40m elog/wiki I'm putting notes here on how to configure a fresh webserver + python server for the Zurich box (model HF2LI) that runs an autobooting service job.
The Zurich box (model HF2LI) has no front panel interface. All controls are done from a USB interface to a host computer (running windows or Ubuntu/Debian). This computer then hosts a web-server that runs an interface in a browser (through http) or responds to requests from python/matlab/labview/C API over the network.
Installing data and webserver
Set up on a Linux box is fast and easy from a fresh install. A thin low powered computer is ideal. Start with a fresh install of Debian, use the latest stable release. Then download the latest stable release for the HF2LI, HF2IS, HF2PLL instruments from the Zurich downloads page. You’ll probably want the 64bit linux. You can untar this file with
> tar xzvf LabOneLinux<arch>-<release>-<revision>.tar.gz
(Insert your filename details above)
Then cd into the directory it created and run
> sudo bash install.sh
It will ask a bunch of questions, just hit enter and y all the way through. The install should immediately boot the HF2 data server at the end. You can check the data server is running with
> ziService status
Now plug in your Zurich box using the USB cable. Note: there are ethernet ports on the box, but these are NOT for network ethernet. If the box is powered up the data server should find the box.
Running the web server
In another terminal you’ll want to to start a Webserver so you can view the box status, settings and live data. Go to another terminal and run
> ziWebServer
Your Zurich device should now be exposed on port 8006 of that machine. You are read to go.
Now on that computer you can got to http://localhost:8006, alternatively on any other computer on the network you can go to the host machine’s IP address and see your Zurich interface. I.e. if the computer IP is 192.168.1.121 then go to http://192.168.1.128:8006.
Remote access
If you wanted to access the Zurich interface remotely (outside network) you can do some SSH forwarding if you have a gateway machine to outside the lab. The standard command for this is
> ssh -nNT -L <clientport>:localhost:<hostport> <controls>@<Host-IP-Address>
where controls is the username, Host-IP-Address is the IP address of the machine to be forwarded from, clientport is the port on your machine (the one you are ssh'ing from) and hostport is the port on the remote machine (for Zurich this is 8006). Then when you go to http://localhost:<clientport> and you'll see Zurich interface.
Python API
Since the release 2.18 (Nov 2018) the python access tools are now just in Pypi. You can install them with pip:
> pip install --upgrade zhinst
This should now allow you to use python API to access your Zurich box.
Setting up service to keep host alive from when box is booted
You’ll want to set up a service on your Debian box with systemd. Make a unit
> cd /etc/systemd/system
> sudo vim ziServer.service
You must use sudo to be able to save the file here.
Paste the following in, this assumes that your username and its group is called controls on your machine:
[Unit]
Description=Zurich Instruments HF2LI data server
After=syslog.target network.target
[Service]
User=controls
Group=controls
WorkingDirectory=/home/controls/services/
ExecStart=/bin/bash -c "exec ziServer"
Restart=no
RestartSec=30
[Install]
WantedBy=multi-user.target
|
Tip: in vim you can type “:set paste” to get exact paste without auto indent etc.
Save the file and exit. You'll also need to create the working director, or change the above to your desired directory
> mkdir /home/controls/services/
Finally, tell systemd to look for new things:
> systemctl daemon-reload
and enable the service,
> systemctl enable ziServer.service
and manually start the service,
> systemctl start myservice.service
It should be running, try to see if this is so:
> ps | grep ziServer
It should run on reboot of the machine and restart every 30 seconds if it crashes for whatever reason. Try rebooting the host machine to check it is still running
Configuring web-server service
Follow the above steps to also auto load the webserver with a unit file named /etc/systemd/system/ziWebServer.service:
[Unit]
Description=Zurich Instruments HF2LI web server
After=syslog.target network.target
[Service]
User=controls
Group=controls
WorkingDirectory=/home/controls/services/
ExecStart=/bin/bash -c "exec ziWebServer"
Restart=no
RestartSec=30
[Install]
WantedBy=multi-user.target
|
Now you have a local network ready server for accessing the Zurich box through a web browser. |