Docker - aaronwmorris/indi-allsky GitHub Wiki

Indi Allsky Docker support

docker compose v2

Please ensure you have the latest docker packages installed from the Docker site. The docker build for indi-allsky requires docker compose v2.

Platforms

  • x86_64
    • Linux
    • Windows
    • Mac
  • arm64
    • Linux
    • Mac - Apple Silicon (Mac M1+)

Host setup

INDI

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.

libcamera

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.

Setup

Use the setup_env.sh script to setup your .env environment file and ssl certificates

./setup_env.sh

Example .env

  • Note: in July 2023, I renamed several variables starting with INDI_ALLSKY_ to INDIALLSKY_ for consistency.
INDIALLSKY_INDI_CCD_DRIVER=indi_simulator_ccd
INDIALLSKY_INDI_GPS_DRIVER=

INDIALLSKY_TIMEZONE=America/New_York

# This folder needs to be shared to the capture, gunicorn, and webserver containers
INDIALLSKY_IMAGE_FOLDER=/var/www/html/allsky/images

# Set to "true" (without quotes) to take dark frames instead of normal image capture
INDIALLSKY_DARK_CAPTURE_ENABLE=false
INDIALLSKY_DARK_CAPTURE_MODE=sigmaclip
INDIALLSKY_DARK_CAPTURE_BITMAX=16
INDIALLSKY_DARK_CAPTURE_DAYTIME=--daytime

# Folder for temporary files in capture process.  Uncomment to activate
#CAPTURE_TMPDIR=/tmp

INDIALLSKY_FLASK_AUTH_ALL_VIEWS=false
INDIALLSKY_FLASK_SECRET_KEY=0000000000000000000000000000000000000000000000000000000000000000
INDIALLSKY_FLASK_PASSWORD_KEY=00000000000000000000000000000000000000000000

INDIALLSKY_WEB_USER=username
INDIALLSKY_WEB_PASS=password
INDIALLSKY_WEB_NAME=First Last
[email protected]

INDIALLSKY_MOSQUITTO_USER=username
INDIALLSKY_MOSQUITTO_PASS=password

# Set to "true" (without quotes) to generate a users API key
# remember to set back to "false" after first run
INDIALLSKY_WEB_GENERATE_APIKEY=false

# Only used on the debian build
INDIALLSKY_INDI_VERSION=v2.0.3
INDIALLSKY_LIBCAMERA_TAG=HEAD
INDIALLSKY_RPICAM_APPS_TAG=HEAD

INDIALLSKY_MARIADB_HOST=mariadb.indi.allsky
INDIALLSKY_MARIADB_PORT=3306
INDIALLSKY_MARIADB_SSL=false
INDIALLSKY_MARIADB_CHARSET=utf8mb4
INDIALLSKY_MARIADB_COLLATION=utf8mb4_unicode_ci

MARIADB_RANDOM_ROOT_PASSWORD=yes
MARIADB_DATABASE=indi_allsky
MARIADB_USER=indi_allsky_own
MARIADB_PASSWORD=randomlygeneratedpassword

Build containers

docker compose build

Run containers

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

Stop containers

docker compose down

Info

The docker compose setup sets up a single container per process.

Containers

  • 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

Exposed Ports

  • webserver
    • 8080:80
    • 8443:443
  • indiserver
    • 17624:7624
  • gunicorn
    • 8000:8000 (commented out)
  • mariadb
    • 13306:3306 (commented out)
  • mosqutto
    • 18883:8883
    • 18081:8081

Volumes

  • images_indi_allsky
  • migrations_indi_allsky (flask)
  • database_indi_allsky (MariaDB)
  • mosquitto_indi_allsky (Mosquitto)

Updating indi-allsky

  1. Navigate to the current git clone

     cd indi-allsky
    
  2. Pull the latest changes via git

     git pull origin main
    
  3. Rebuild containers

    • capture.indi.allsky

    • gunicorn.indi.allsky

    • webserver.indi.allsky

         docker compose build capture.indi.allsky gunicorn.indi.allsky webserver.indi.allsky
      

Special scenarios

Start only web interface

    docker compose up mariadb.indi.allsky gunicorn.indi.allsky webserver.indi.allsky

Docker maintenance

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
    • WARNING: This will delete the intermediate build layers which may trigger a full rebuild if you need to update an image (for a code deploy).

Run commands in container

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

User management

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 setadmin

Generate API key

docker exec -it 012345678901 /home/allsky/venv/bin/python3 /home/allsky/indi-allsky/misc/usertool.py genapikey

Home Assistant Auto-Discovery

docker exec -it 012345678901 /home/allsky/venv/bin/python3 /home/allsky/indi-allsky/misc/home_assistant_auto_discovery.py