Skip to content

Setting up Huntsman Control Computer

danjampro edited this page May 25, 2020 · 12 revisions

This page describes how to do a clean install of everything that is required to run Huntsman POCS.

Note: This setup assumes a Max OSX High Sierra installation

Setup environment

Environment Variables
A few environment variables should be added to your $HOME/.bash_profile. These settings might require opening a new terminal before they take effect.

Edit the file and add these at the end:

export PANUSER=huntsman
export PANDIR=/var/huntsman
export POCS=${PANDIR}/POCS
export PAWS=${PANDIR}/PAWS
export HUNTSMAN_POCS=${PANDIR}/huntsman-pocs

Install folders

sudo mkdir $PANDIR && sudo chown $PANUSER $PANDIR
mkdir -p $PANDIR/logs
mkdir -p $PANDIR/images
mkdir -p $PANDIR/mongo_data

Anaconda Python

Anaconda is used to install python and all related modules.

Setup anaconda .

curl https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o anaconda.sh
# The -b option assumes you agree to license
bash anaconda.sh -b -p $HOME/anaconda3
rm anaconda.sh
echo 'export PATH="$HOME/anaconda3/bin:$PATH"' >> $HOME/.bash_profile

Setup Huntsman environment . Open a new terminal and verify that you are running the anaconda version of Python. Type python -V and you should see something similar to Python 3.6.3 :: Anaconda, Inc..

To create a new environment with some default modules:

conda create -n huntsman-pocs-env python=3 numpy scipy jupyter

You will be prompted to confirm packages and will probably see a large number or them. This is okay and you should agree to them. This may take a while to run.

After install we want to ensure that the terminal is always loading this environment:

echo 'source activate huntsman-pocs-env' >> $HOME/.bash_profile

System packages

Homebrew
A few items are installed via Homebrew:

brew install pkg-config
brew install md5sha1sum
brew install cairo
brew install netpbm
brew install libpng
brew install libjpeg
~~brew install libz~~ #Not found
brew install bzip2
brew install swig
brew install cfitsio
brew install gcc
brew install gphoto2

Note: when installing cairo using homebrew, you may have to set the PKG_CONFIG_PATH environment variable manually. To do this, copy and paste:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig

Note 2: gphoto2 is not used by Huntsman, but it is needed in order for the POCS test suite to run successfully.

astrometry.net
Install astrometry.net as per the instructions.

curl http://astrometry.net/downloads/astrometry.net-latest.tar.gz -o astrometry.tgz
tar zxvf astrometry.tgz
cd astrometry.net*
make
make py
make extra
make install INSTALL_DIR=$PANDIR/astrometry
cd ../ && rm -rf astrometry.*

Clone required repositories

cd $PANDIR
git clone https://github.com/panoptes/POCS.git
git clone https://github.com/panoptes/PAWS.git
git clone https://github.com/AstroHuntsman/huntsman-pocs.git

Install module

First we need to install the requirements:

Note: You may need to install pip setuptools if you have trouble with installing gunagala. To do this, run:

pip install --upgrade setuptools
# Go to directory and install requirements
cd $POCS && pip install -r requirements.txt
# Install the POCS module
python setup.py install

# Install requirements for PAWS website
cd $PAWS && pip install -r requirements.txt

# Install requirements for HUNTSMAN
cd $HUNTSMAN_POCS && pip install -r requirements.txt
python setup.py develop

Note: You might get a failure with the install of pygraphviz while installing POCS. This can be ignored.

NGAS server

# Install the cache server
cd $PANDIR
git clone https://dev.aao.org.au/datacentral/cluster/dcngas
cd dcngas && make

You now need to add the SSH key to AAO's gitlab. Go to the webpage and enter the full output of $cat deploy.pub as the key, also providing a suitable name. Then you can continue with the setup:

# Build the docker service
sudo docker-compose -f docker-compose.huntsman.yml build --build-arg SSH_PRIVATE_KEY="$(cat deploy)" ngas_cache

# Setup the certificate
cd cache-server && mkdir workdir && cd workdir
<copy the .key and .crt files found on Google drive>

# Start the server
cd ../.. && sudo docker-compose -f docker-compose.huntsman.yml up

# After the server is running (only do this once)...
./scripts/setup_huntsman_aao_subscription.sh 

If this returns Status="SUCCESS" then you're good to go. If instead you see Status="FAILURE" with UNIQUE constraint failed, you may need to modify SUB_ID in /scripts/setup_huntsman_aao_subscription.sh (this applies if you are setting NGAS up on a new machine and have not already unsubscribed the previous NGAS instance).

Weather

Huntsman uses agg-weather to read weather data and share it with a POCS instance. We can use its docker image:

# Get the latest docker image
docker pull gcr.io/panoptes-exp/aag-weather

The following should appear in huntsman_local.yaml:

environment:
  ...
  ...
  weather:
    ...
    ...
    url: http://localhost:5000/latest.json

Misc

Data download
We need to download the astrometry.net index files as well as a coordinate database.

cd $POCS && python pocs/utils/data.py

crontab
The coordinate database downloaded above needs to be downloaded regularly to ensure accurate coordinates. In order to do this we add an entry to the crontab:

Note: The default editor for crontab is vim. If you don't know how to use vim ask a friend for help here.

Type crontab -e to edit the crontab and then enter the following line:

* 12 * * 0 /Users/huntsman/anaconda3/envs/huntsman-pocs-env/bin/python $POCS/pocs/utils/data.py

This will cause the files to be downloaded every Sunday (0) at noon (12).

Clone this wiki locally