-
Notifications
You must be signed in to change notification settings - Fork 41
SyncAPI Setup
indi-allsky provides a new web service API to synchronize images and videos to a remote indi-allsky [web] server. indi-allsky is now capable of being its own remote web server instance.
-
local
- The server connected to the camera -
remote
- The server receiving the uploaded files
- Debian 12
- Raspberry Pi OS 12
- Debian 11
- Raspberry Pi OS 11
- Ubuntu 24.04
- Ubuntu 22.04
- Ubuntu 20.04
Install the indi-allsky web application on the remote server. The server needs the ability to run a gunicorn service via systemd and a reverse proxy using Apache. It is also possible to use Nginx as a reverse proxy (manual setup).
./misc/web_only_setup.sh
On the remote indi-allsky server, after the web server is deployed, generate an API key for the remote user. You may create a dedicated user account for the sync activity.
-
Create user
source virtualenv/indi-allsky/bin/activate $ ./misc/usertool.py adduser -u foobar123 Password (not echoed): Password (again): Name: SyncAPI user Email: foo@example.com
-
Set admin
$ ./misc/usertool.py setadmin -u foobar123
-
Generate API key
$ ./misc/usertool.py genapikey -u foobar123 API key: 00000000000000000000000000000000000000000000000000
Navigate to the config URL in the local server and enable the SyncAPI and add the following details.
- Remote base URL
- Username
- API key
Save and restart
You may also enable multiple upload workers so that a single transfer does not halt all upload activities. More workers requires more memory to support the additional processes. 2GB of memory is recommended for additional workers.
Dates in the indi-allsky database are set to the local time of the local server running capture and are NOT UTC and NOT timezone aware.
As of March 2023, for SyncAPI, the timestamps of assets are remapped to the local time of the remote server. Meaning if a video has a createDate timestamp of 3:05am Pacific Standard Time [PST] and the remote server is set to Eastern Standard Time [EST], the file on the remote server will be 3:05am.
All time calculations for the web interface are offset based on the camera timezone. If it is currently 6:00am EST, "now" for a camera in located in PST will be 3:00am.
The SyncAPI is roughly idiomatic with a standard REST API, however there are some deviations.
Images and videos have two components that are required for uploads:
- Metadata (create date, exposure, gain, etc)
- The file itself
Normally, in a REST service, data is added using a JSON request, however in order to minimize the number of calls required to upload a file, the POST, PUT, and DELETE methods are implemented as a multipart/form-data
form upload. The metadata and media file are uploaded as two separate file objects and processed in the same request.
Type | Endpoint | Note |
---|---|---|
CAMERA | sync/v1/camera | |
IMAGE | sync/v1/image | |
VIDEO | sync/v1/video | |
MINI_VIDEO | sync/v1/minivideo | |
KEOGRAM | sync/v1/keogram | |
STARTRAIL | sync/v1/startrail | |
STARTRAIL_VIDEO | sync/v1/startrailvideo | |
PANORAMA_IMAGE | sync/v1/panoramaimage | |
PANORAMA_VIDEO | sync/v1/panoramavideo | |
THUMBNAIL | sync/v1/thumbnail | |
RAW_IMAGE | sync/v1/rawimage | not currently used |
FITS_IMAGE | sync/v1/fitsimage | not currently used |
- GET - returns file ID and URI
- POST - upload and add file (will not overwrite existing file)
- PUT - upload and add/overwrite file
- DELETE - delete file