Skip to content

Install Guide

Riad Shash (Ray) edited this page May 9, 2023 · 22 revisions

Instrument Server was developed on MS Windows, so Windows is the only supported OS at this time. It is a Python Flask & QT application that uses lots of Python packages (like pyMeasure).

1. Installing Python 3.11.0+

image

2. Install NI VISA Backend

  • Since Instrument Server uses pyVISA to connect to VISA Instruments, a suitable host VISA backend is necessary. Since pyVISA was tested to worked with National Instrument's (NI) NI-VISA, it to recommended to install this one.
  • NI-VISA

3. Install PicoScope Backend (optional)

  • Instrument server uses picoscope Python package to connect to Picscope Instruments. Just like for VISA, it also needs a backend.
  • Download & Install the appropriate PicoScope Downloads backend & application from Pico Technology.

4. Install Docker Desktop

  • Instrument Server uses PostgreSQL DB for persistence. In order to easily facilitate easy deployment of DB with minimal effort, Instrument Server will connect to a containerized instance of PostgreSQL running inside of a Docker container. To enable running on Docker containers, Docker Desktop is needed.
  • Docker Desktop

5. Clone Instrument Server Repository

  • In order to use git features, git needs to be installed on the host system.
  • Git for Windows
  • Clone the Repository:
      1. Navigate to where you would like to clone Instrument Server.
      1. In Windows Explorer, right-click and click GIt Bash Here. This will pop-up a terminal style CLI. If the option is not available, navigate to the desired directory via Git Bash app for Windows.
      1. Run git clone https://github.com/DataCQProject/InstrumentServer.git (HTTPS). We prefer you setup a SSH Private/Public keypair to use with GitHub
      1. A new directory will be created called InstrumentServer.

image

6. Setting up a Python Virtual Environment

  • Instrument Server uses various Python packages, these packages need to be installed prior to running Instrument Server. This project uses the Python pip package-management system to facilitate this. These packages will be installed into an isolated Python environment (separate from host python) facilitated by virtualenv.
  • A Windows "Batch" script was written to automate this: setupEnv.bat which is meant to run from a Windows CMD Terminal:
  1. Open Terminal / Command Prompt
  2. Navigate to the cloned InstrumentServer directory... (You can also right-click in File Explorer and click "Open Terminal" (might not be present).
  3. Run the batch script (press return twice):

Example:

C:\GitHub\Test\InstrumentServer>setupEnv.bat
"This script will install virtualenv & setup a Python Virtual Environment -> venv"
Press any key to continue . . .
"Installing Python virtualenv"
"Checking for pip updates..."
...
(venv) C:\GitHub\Test\InstrumentServer>
  1. Notice the venv in front of the command prompt. That indicates that you are inside of the venv python virtual environment that was just created. Leave the terminal open while proceeding to the next step.

7. Installing all required Python Packages (via pip)

  • We will use pip to install all the packages we need. All the required packages and specific versions are specified in requirements.txt.
  • Another Windows "Batch" script was written to automate this: installPackages.bat
  • (Inside of venv virtual environment, run installPackages.bat:
(venv) C:\GitHub\Test\InstrumentServer>installPackages.bat
  • This might take a while... make some ☕ and or take a break 🙂

8. Deploy PostgreSQL Database

  • Now with docker desktop installed, we are ready to deploy the PostgreSQL database.
  • In Windows Command Prompt (Terminal), navigate to where InstrumentServer was clone and go into the \DB directory.
  • There is a docker-compose.yaml file that defines the containerized PostgreSQL as well as a local web application called adminer which can be used to manage the DB (optional, but enabled by default). It also sets up a Docker Volume called db_pgdata which will be used for DB storage (persistence).
  • In the same directory as docker-compose.yaml, run the following command to deploy the DB:
C:\GitHub\InstrumentServer\DB>docker-compose up -d
  • You can see all running containers with docker ps (optional):
C:\GitHub\InstrumentServer\DB>docker ps
CONTAINER ID   IMAGE                  COMMAND                  CREATED       STATUS          PORTS                    NAMES
14b42997fd70   postgres:15.2-alpine   "docker-entrypoint.s…"   5 weeks ago   Up 33 minutes   0.0.0.0:5432->5432/tcp   instrument_server_db
cb4242c9e441   adminer                "entrypoint.sh php -…"   5 weeks ago   Up 33 minutes   0.0.0.0:8080->8080/tcp   adminer_client
  • You can also see all the Docker containers & volumes in Docker Desktop application:

image

9. Running Instrument Server

  • A script was written to easily deploy Instrument Server (note: The DB needs to be deployed/enabled prior to running).
  • In File Explorer, navigate to the area where InstrumentServer repository was cloned.
  • Double-click on startServer.bat. This will deploy instrument server in a couple of seconds.

Screenshot 2023-05-08 152311

Table of Contents

Clone this wiki locally