Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #60

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__
*.svg
*.swo
*.swp
*.tar.gz

**/build

Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ Quick overview of what you will be able to see and manage through this project

# Install

## System requirements when using macOS
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install python@3.9
brew install virtualenv
brew install graphviz
export GRAPHVIZ_DIR="$(brew --prefix graphviz)"
export C_INCLUDE_PATH=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/Headers
export CPLUS_INCLUDE_PATH=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/Headers
pip install pygraphviz --global-option=build_ext --global-option="-I$GRAPHVIZ_DIR/include" --global-option="-L$GRAPHVIZ_DIR/lib"
```

## System requirements when using ubuntu
```bash
sudo apt-add-repository ppa:mutlaqja/ppa
Expand Down Expand Up @@ -100,6 +112,13 @@ sudo apt-get install \
pip install -r requirements.txt
```

## Build and use docker for development (for macos dev for instance)

```console
cd ./docker
./build_images.sh latest linux/amd64
```

## Building the nice reporting / latex reports
```bash
sudo apt-get update
Expand Down
Empty file modified ScopeSimulator/data/bsc5.dat.gz
100755 → 100644
Empty file.
Empty file modified apps/Arduino/configure_tty.sh
100755 → 100644
Empty file.
Empty file modified apps/Arduino/upload.sh
100755 → 100644
Empty file.
Empty file modified apps/indi_lemarchand_box.sh
100755 → 100644
Empty file.
Empty file modified apps/launch_PAWS.sh
100755 → 100644
Empty file.
Empty file modified apps/launch_arduino_capture.py
100755 → 100644
Empty file.
Empty file modified apps/launch_backyard_conf.sh
100755 → 100644
Empty file.
Empty file modified apps/launch_indi_ASI120MC_alone.sh
100755 → 100644
Empty file.
Empty file modified apps/launch_indi_aag.sh
100755 → 100644
Empty file.
Empty file modified apps/launch_indi_eqmod_simu.sh
100755 → 100644
Empty file.
Empty file modified apps/launch_indi_gemini2_alone.sh
100755 → 100644
Empty file.
Empty file modified apps/launch_indi_gemini_asi.sh
100755 → 100644
Empty file.
Empty file modified apps/launch_indi_gemini_canon.sh
100755 → 100644
Empty file.
Empty file modified apps/launch_indi_scope_controller_debug.sh
100755 → 100644
Empty file.
Empty file modified apps/launch_indi_simu.sh
100755 → 100644
Empty file.
Empty file modified apps/launch_indi_ticfocus.sh
100755 → 100644
Empty file.
Empty file modified apps/launch_weather_capture.py
100755 → 100644
Empty file.
Empty file modified apps/plot_weather.py
100755 → 100644
Empty file.
Empty file modified apps/prototyping/Solvercpp/build.sh
100755 → 100644
Empty file.
Empty file modified apps/prototyping/messaging/listen_mqtt.sh
100755 → 100644
Empty file.
Empty file modified apps/prototyping/messaging/send_mqtt.sh
100755 → 100644
Empty file.
Empty file modified conf_files/dockers/influxdb-remoteobservatory/config/config.yml
100755 → 100644
Empty file.
Empty file modified conf_files/dockers/mosquitto-remoteobservatory/mosquitto.conf
100755 → 100644
Empty file.
Empty file modified conf_files/dockers/telegraf-remoteobservatory/telegraf.conf
100755 → 100644
Empty file.
10 changes: 5 additions & 5 deletions conf_files/indi_driver_conf/Shelyak Spox_config.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<INDIDriver>
<newSwitchVector device='Shelyak Spox' name='DEBUG'>
<newSwitchVector device='Shelyak SPOX' name='DEBUG'>
<oneSwitch name='ENABLE'>
Off
</oneSwitch>
<oneSwitch name='DISABLE'>
On
</oneSwitch>
</newSwitchVector>
<newNumberVector device='Shelyak Spox' name='POLLING_PERIOD'>
<newNumberVector device='Shelyak SPOX' name='POLLING_PERIOD'>
<oneNumber name='PERIOD_MS'>
1000
</oneNumber>
</newNumberVector>
<newSwitchVector device='Shelyak Spox' name='DEBUG_LEVEL'>
<newSwitchVector device='Shelyak SPOX' name='DEBUG_LEVEL'>
<oneSwitch name='DBG_ERROR'>
On
</oneSwitch>
Expand All @@ -29,7 +29,7 @@
Off
</oneSwitch>
</newSwitchVector>
<newSwitchVector device='Shelyak Spox' name='LOGGING_LEVEL'>
<newSwitchVector device='Shelyak SPOX' name='LOGGING_LEVEL'>
<oneSwitch name='LOG_ERROR'>
On
</oneSwitch>
Expand All @@ -46,7 +46,7 @@
Off
</oneSwitch>
</newSwitchVector>
<newSwitchVector device='Shelyak Spox' name='LOG_OUTPUT'>
<newSwitchVector device='Shelyak SPOX' name='LOG_OUTPUT'>
<oneSwitch name='CLIENT_DEBUG'>
On
</oneSwitch>
Expand Down
258 changes: 258 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
ARG BASE_IMAGE=ubuntu:24.04
FROM ${BASE_IMAGE}

# prevent keyboard related user input to be asked for
ENV DEBIAN_FRONTEND noninteractive

# Useless docker cache for pip
ENV PIP_NO_CACHE_DIR 1

# Versioning
ENV INDI_VERSION v2.0.8
ENV PYINDI_VERSION v1.9.1
ENV INDI_3RD_PARTY_VERSION v2.0.8
ENV PYTHON_VERSION 3.12.3

# Generic install / utilities / dev
RUN apt-get update && apt-get --assume-yes --quiet install --no-install-recommends \
build-essential \
cmake \
gettext \
git \
libgraphviz-dev \
libz3-dev \
python3 \
python3-dev \
python3-numpy-dev \
python3-pip \
python3-setuptools \
python3-six \
software-properties-common \
vim && \
apt-get clean

# pyenv dependencies
RUN apt-get --assume-yes --quiet install --no-install-recommends \
build-essential \
curl \
libbz2-dev \
libffi-dev \
liblzma-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
llvm \
make \
python3-openssl \
tk-dev \
wget \
xz-utils \
zlib1g-dev

## Install astrometry.net packages
# Check cat /usr/local/astrometry/etc/astrometry.cfg to make sure destination path is correct
# 4100-series built from the Tycho-2 catalog; scales 7-19 available, good for images wider than 1 degree. Recommended.
# Mean satellite observation epoch ~J1991.5
# Epoch of the Tycho-2 catalog J2000.0
# Reference system ICRS
# see https://heasarc.gsfc.nasa.gov/W3Browse/all/tycho2.html

# 5200-series, LIGHT version built from Tycho-2 + Gaia-DR2; scales 0-6 available, good for images narrower than 1 degree. Combine with 4100-series for broader scale coverage.
# The LIGHT version contains smaller files with no additional Gaia-DR2 information tagged along. Recommended.
# Gaia DR2 astrometry consistently uses the ICRS reference system and provides stellar coordinates valid for epoch J2015.5
# see https://www.cosmos.esa.int/web/cheops-guest-observers-programme/coordinates
RUN apt-get --assume-yes --quiet install --no-install-recommends libcairo2-dev libnetpbm11-dev \
&& mkdir -p $HOME/projects/astrometry.net \
&& cd $HOME/projects/astrometry.net \
&& wget https://astrometry.net/downloads/astrometry.net-0.95.tar.gz \
&& tar -xvf ./*.tar.gz \
&& cd astrometry.net-0.95 \
&& export NETPBM_LIB="-L/usr/lib -lnetpbm" \
&& export NETPBM_INC="-I/usr/include" \
&& ./configure --prefix=/usr \
&& make reconfig \
&& make all -j8 \
&& make install \
&& ln -s /usr/local/astrometry/bin/an-fitstopnm /usr/local/bin/an-fitstopnm \
&& wget --recursive --no-parent --no-host-directories --cut-dirs=6 --accept "*.fits" --continue --directory-prefix=/usr/local/astrometry/data/ https://portal.nersc.gov/project/cosmo/temp/dstn/index-5200/LITE/
## Indi dependencies for pre-packages binaries
#RUN apt-add-repository ppa:mutlaqja/ppa && apt-get --assume-yes --quiet install --no-install-recommends \
# gsc \
# libcfitsio-dev \
# libnova-dev \
# libindi1 \
# indi-bin \
# kstars-bleeding \
# swig

# Dependencies to build indi from sources + pyindi-client that is linked with binaries through swig
# astrometry.net was built from source
RUN apt-get --assume-yes --quiet install --no-install-recommends \
cdbs \
dkms \
fxload \
libboost-regex-dev \
libcfitsio-dev \
libcurl4-gnutls-dev \
libdc1394-dev \
libev-dev \
libfftw3-dev \
libftdi-dev \
libftdi1-dev \
libgps-dev \
libgsl0-dev \
libjpeg-dev \
libkrb5-dev \
libnova-dev \
libraw-dev \
libtiff5-dev \
libusb-1.0-0-dev \
libusb-dev \
swig

# Build indi from sources
RUN mkdir -p $HOME/projects \
&& cd $HOME/projects \
&& git clone https://github.com/indilib/indi.git \
&& cd $HOME/projects/indi \
&& git checkout $INDI_VERSION \
&& cd $HOME/projects \
&& mkdir -p build/indi \
&& cd build/indi \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr $HOME/projects/indi \
&& make -j8 \
&& make install

# Dependencies to build indi-3rd party from sources
RUN apt-get --assume-yes --quiet install --no-install-recommends \
libnova-dev \
libcfitsio-dev \
libusb-1.0-0-dev \
zlib1g-dev \
libgsl-dev \
libjpeg-dev \
libcurl4-gnutls-dev \
libtiff-dev \
libftdi-dev \
libraw-dev \
libdc1394-dev \
libgphoto2-dev \
libboost-dev \
libboost-regex-dev \
librtlsdr-dev \
liblimesuite-dev \
libftdi1-dev \
libgps-dev \
libavcodec-dev \
libavdevice-dev \
libzmq3-dev

# Additional dependencies with indi-3rd party - clone the whole thing
RUN mkdir -p $HOME/projects \
&& cd $HOME/projects \
&& git clone https://github.com/indilib/indi-3rdparty.git \
&& cd $HOME/projects/indi-3rdparty \
&& git checkout $INDI_3RD_PARTY_VERSION

RUN for i in indi-duino libasi indi-asi libplayerone indi-playerone indi-shelyak libaltaircam; \
do cd $HOME/projects \
&& mkdir -p $HOME/projects/build/$i \
&& cd $HOME/projects/build/$i \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr $HOME/projects/indi-3rdparty/$i \
&& make -j8 \
&& make install; \
done

## OpenPhd2 might later be replaced by the original source ?
#RUN add-apt-repository ppa:pch/phd2 && apt-get --assume-yes --quiet install --no-install-recommends \
# phd2
# Dependencies to build phd2 from sources
RUN apt-get --assume-yes --quiet install --no-install-recommends \
libwxgtk3.2-dev

RUN mkdir -p $HOME/projects \
&& cd $HOME/projects \
&& git clone https://github.com/gnthibault/phd2.git \
&& mkdir -p build/phd2 \
&& cd build/phd2 \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr $HOME/projects/phd2 \
&& make -j8 \
&& make install

RUN cp /opt/remote_observatory/infrastructure/phd2.service /etc/systemd/system/
RUN chmod 644 /etc/systemd/system/phd2.service

## Dependencies for nice reporting / latex reports
RUN apt-get --assume-yes --quiet install --no-install-recommends \
texlive-latex-recommended \
texlive-publishers \
texlive-bibtex-extra \
texlive-science

# Using bash for lower level scripting from now-on
SHELL ["/bin/bash", "-l", "-c"]
RUN echo 'export PS1="\u@\h \w> "' | cat - /root/.profile > temp && mv temp /root/.profile

# Actual application code and configs
RUN mkdir -p /opt/remote_observatory
ADD code.tar.gz /opt/remote_observatory

# Python environment
RUN curl https://pyenv.run | bash
RUN echo 'export PYENV_ROOT=/root/.pyenv' >> /root/.bashrc
RUN echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> /root/.bashrc
RUN echo 'eval "$(pyenv init -)"' >> /root/.bashrc
RUN pyenv install -v $PYTHON_VERSION
RUN pyenv global $PYTHON_VERSION

# Python virtual environment
ENV VIRTUAL_ENV=/opt/remote_observatory_venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN echo 'source /opt/remote_observatory_venv/bin/activate' >> /root/.bashrc

# Python packages
#COPY requirements.txt .
RUN pip install -r /opt/remote_observatory/requirements.txt

# Build and install pyindi-client
RUN mkdir -p $HOME/projects \
&& cd $HOME/projects \
&& git clone https://github.com/indilib/pyindi-client.git \
&& cd $HOME/projects/pyindi-client \
&& git checkout $PYINDI_VERSION \
&& pip install -e .


# Indi webmanager for dev
RUN pip install indiweb==0.1.8
RUN cp /opt/remote_observatory/infrastructure/indiwebmanager*.service /etc/systemd/system/
RUN chmod 644 /etc/systemd/system/indiwebmanager.service
RUN chmod 644 /etc/systemd/system/indiwebmanager_guiding_camera.service
RUN chmod 644 /etc/systemd/system/indiwebmanager_pointing_camera.service
RUN chmod 644 /etc/systemd/system/indiwebmanager_science_camera.service

#RUN systemctl daemon-reload
#RUN systemctl enable indiwebmanager.service


# # Add Docker's official GPG key:
# sudo apt-get update
# sudo apt-get install ca-certificates curl
# sudo install -m 0755 -d /etc/apt/keyrings
# sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
# sudo chmod a+r /etc/apt/keyrings/docker.asc

# # Add the repository to Apt sources:
# echo \
# "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
# $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
# sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# sudo apt-get update && sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Build with
# ./build_images.sh latest linux/amd64
# launch with
# docker run --user $(id -u):$(id -g) -it --rm -v /main/machine/volume:/docker/mount/point --net host gnthibault/remote_observatory:latest
Loading
Loading