-
Notifications
You must be signed in to change notification settings - Fork 58
Docker
indi-allsky has full support for operating in a docker containerized environment. Each component (ie process) is broken out to a separate container, per docker best practices. (The container list is below)
If you do not already have a docker host setup, it will be necessary to install and setup docker.
- x86_64
- Linux
- Windows
- Mac
- arm64
- Linux
- Mac - Apple Silicon (Mac M1+)
Install docker from the docker repositories.
🚩 The version of docker that is distributed with Debian and Ubuntu are too old to properly build the containers, therefore it will be necessary to install the latest version of docker from the main docker repositories.
https://docs.docker.com/engine/install/
You can setup a non-privileged user on your docker host to manage your environment.
sudo usermod -a -G docker username
# Logout and login again for change take effect
The indi-allsky code will need to be checked out on your docker host in order to build the container images.
-
Install git
sudo apt-get install git -
Clone the indi-allsky git repository
git clone https://github.com/aaronwmorris/indi-allsky.git
Use the setup_env.sh script to setup your .env environment file and ssl certificates
-
Navigate to the indi-allky sub-directory
cd indi-allsky/docker/ ./setup_env.sh
If you have a ZWO camera, change the driver to the following
INDIALLSKY_INDI_CCD_DRIVER=indi_asi_ccd
- The CSI/MIPI camera must be setup and available in the docker host before starting the containers
- Uncomment the libcamera build script in
Dockerfile.indi_base_debian13 - Uncomment
privilegedflag for capture container indocker-compose.yaml - Uncomment udev volume mapping for capture container in
docker-compose.yaml
docker compose build
If you experience dependency problems with the build, it may be necessary to manually build the base image first.
docker compose build indi.base
docker-compose syntax (with the dash) which implies docker compose v1. Docker compose v2 uses docker compose.
In most cases, INDI (core and 3rd-party) will probably have to be installed on the host running the indiserver container. The indiserver does not need to run on the host, but the host needs to create the device nodes and load the firmware so the indiserver container may connect to the devices. With privileged containers, only the devices that exist when the container is started are created within the container.
The capture container needs to be privileged to permit access to the camera device for libcamera. A udev related folder needs to be mapped to the container, too. These settings are available, but commented out, in the docker-compose.yaml.
The CSI/MIPI camera must be setup and available in the docker host before starting the containers. With privileged containers, only the devices that exist when the container is started are created within the container.
docker compose up
or
docker compose up --detach
Notes
- There are delays up to 120s for services to completely start
- Your camera must be plugged in prior to starting the indiserver_indi_allsky container
docker compose down
The docker compose setup sets up a single container per process.
- indiserver.indi.allsky
- privileged container
- capture.indi.allsky
- capture process
- gunicorn.indi.allsky
- python application server
- Flask database migrations managed here
- webserver.indi.allsky
- reverse proxy
- mariadb.indi.allsky
- MariaDB database
- mosquitto.indi.allsky
- Mosquitto MQTT broker
- indi.base
- intermediate image
- does not run
- indi.allsky.base
- intermediate image
- does not run
- webserver
- 8080:80
- 8443:443
- indiserver
- 17624:7624
- gunicorn
- 8000:8000 (commented out)
- mariadb
- 13306:3306 (commented out)
- mosqutto
- 18883:8883
- 18081:8081
- images_indi_allsky
- migrations_indi_allsky (flask)
- database_indi_allsky (MariaDB)
- mosquitto_indi_allsky (Mosquitto)
-
Navigate to the current git clone
cd indi-allsky -
Pull the latest changes via git
git pull origin main -
Rebuild containers
-
capture.indi.allsky
-
gunicorn.indi.allsky
-
webserver.indi.allsky
docker compose build capture.indi.allsky gunicorn.indi.allsky webserver.indi.allsky
-
docker compose up mariadb.indi.allsky gunicorn.indi.allsky webserver.indi.allsky
Periodically, you may want to clean up artifacts left over by the docker build process. These commands should not result in any data loss.
- Prune images
docker image prune
- Prune volumes
docker volume prune
- Prune full system
docker system prune⚠️ This will delete the intermediate build layers which may trigger a full rebuild if you need to update an image (for a code deploy).
You can run some of the command line scripts in the container using the following pattern. Find the capture container ID by running docker ps | grep capture.indi.allsky
docker exec -it 012345678901 /home/allsky/venv/bin/python3 /home/allsky/indi-allsky/misc/usertool.py adduser
docker exec -it 012345678901 /home/allsky/venv/bin/python3 /home/allsky/indi-allsky/misc/usertool.py setadmindocker exec -it 012345678901 /home/allsky/venv/bin/python3 /home/allsky/indi-allsky/misc/usertool.py genapikeydocker exec -it 012345678901 /home/allsky/venv/bin/python3 /home/allsky/indi-allsky/misc/home_assistant_auto_discovery.py# Create matching user account for allsky
sudo useradd -u 10001 -s /bin/false -M -l allsky-container
# Create dbus policy file
sudo tee /etc/dbus-1/system.d/allsky-timedate-policy.conf << 'EOF'
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="allsky-container">
<allow send_destination="org.freedesktop.timedate1"/>
<allow receive_sender="org.freedesktop.timedate1"/>
<allow send_destination="org.freedesktop.timedate1"
send_interface="org.freedesktop.DBus.Properties"/>
<allow send_destination="org.freedesktop.timedate1"
send_interface="org.freedesktop.timedate1"/>
</policy>
</busconfig>
EOF
# Reload dbus configuration
sudo systemctl reload dbusAdd to [docker-compose.yaml]
services:
gunicorn.indi.allsky:
volumes:
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:roWhy compile INDI from source and not use the PPA?
The Ubuntu INDI PPA is a convenient place to install INDI, however, there have been many instances of package dependency errors or broken functionality. There is no way to install older packages from the PPA, therefore the only way to have enough control to ensure the system works is to compile from source.
Compiling from source also gives you the opportunity to install older versions or install from HEAD if something needs to be tested. The git tag for the source code may be changed in your .env
Why use Debian instead of Ubuntu?
This is somewhat a personal choice, but I feel Debian is a better choice for the foundation of Open Source Projects. If Debian has problems for any reason in the future, I will gladly switch to a different base image for the containers.