# Astrometry.net From front page: *If you have astronomical imaging of the sky with celestial coordinates you do not know—or do not trust—then Astrometry.net is for you. Input an image and we'll give you back astrometric calibration meta-data, plus lists of known objects falling inside the field of view. We have built this astrometric calibration service to create correct, standards-compliant astrometric meta-data for every useful astronomical image ever taken, past and future, in any state of archival disarray. We hope this will help organize, annotate and make searchable all the world's astronomical information.* * https://astrometry.net/ # Servers The package `astrometry.net` is available in Debian for local plate solving. The main remote server, https://astrometry.net , requires login, which requires an openID account with a non-libre service. # Local Server HOWTO set up a local `astrometry.net` server. ``` sudo apt install git build-essential libccfits-dev libcfitsio-dev \ python3-setuptools python3-distutils pkg-config ccache swig \ zlib1g-dev libbz2-dev libcairo2-dev wcslib-dev \ libjpeg62-turbo-dev python3-numpy libnetpbm11-dev netpbm \ python3-openid uwsgi uwsgi-plugin-python3 \ apache2 libapache2-mod-wsgi-py3 python3-matplotlib sudo adduser nova sudo adduser nova sudo sudo su - nova # Add to ~/.bashrc : ############################################################################## PATH=/usr/lib/ccache:/usr/local/netpbm/bin:$PATH PYP= PYP=${PYP}:/usr/local/django-1.3/lib/python PYP=${PYP}:/usr/local/django-openid-auth-0.3/lib/python PYP=${PYP}:/usr/local/south-0.7.3/lib/python PYP=${PYP}:. export PYTHONPATH=${PYP} PKG_CONFIG_PATH=/usr/local/wcslib-4.6.3/lib/pkgconfig:$PKG_CONFIG_PATH LD_LIBRARY_PATH=/usr/local/wcslib-4.6.3/lib:$LD_LIBRARY_PATH export NETPBM_INC="-I/usr/local/netpbm/include" export NETPBM_LIB="-L/usr/local/netpbm/lib -lnetpbm" ############################################################################## # Log out, log back in pip3 install --no-cache-dir \ social-auth-core django-social-auth3 social-auth-app-django # Log out, log back in git clone https://github.com/dstndstn/astrometry.net cd astrometry.net/ make make extra make py #sudo make install cd net/ # test cp settings_test.py settings.py # Where '192.168.1.100' is IP of server and/or add more echo "ALLOWED_HOSTS += ['127.0.0.1', '192.168.1.100']" >> settings.py #cd ../.. #wget https://launchpadlibrarian.net/303558616/django-openid-auth-0.13.tar.gz #tar xf django-openid-auth-0.13.tar.gz # meh ln -s /home/nova/astrometry.net/ /home/nova/astrometry sudo ln -s /usr/bin/uwsgi /usr/local/bin/uwsgi sudo mkdir -p /data/nova/ sudo chown -R nova:nova /data mkdir -p appsecrets touch appsecrets/__init__.py touch appsecrets/auth.py cp -p ../docker/webservice/django_db.py appsecrets/ echo "DJANGO_SECRET_KEY='password'" > appsecrets/django.py mv migrations/* /tmp python manage.py makemigrations && \ python manage.py migrate && \ python manage.py makemigrations net && \ python manage.py migrate net && \ python manage.py loaddata fixtures/initial_data.json && \ python manage.py loaddata fixtures/flags.json ``` # Run thing: ``` python manage.py runserver ``` Patch: ``` diff --git a/net/uwsgi.sh b/net/uwsgi.sh index 224f2dbc..f7e3e40d 100755 --- a/net/uwsgi.sh +++ b/net/uwsgi.sh @@ -13,7 +13,7 @@ export PATH=${PATH}:$BASE/util:$BASE/solver:$BASE/plot # echo $PATH # export PYTHONPATH=${PYTHONPATH}:${CONDA_PREFIX} -uwsgi -s :3030 --wsgi-file wsgi.py --touch-reload wsgi.py --processes 16 --reload-on-rss 768 -d /data/nova/uwsgi.log --limit-post 500000000 --stats 127.0.0.1:1717 \ +uwsgi -s :3030 --plugin /usr/lib/uwsgi/plugins/python310_plugin.so --wsgi-file wsgi.py --touch-reload wsgi.py --processes 16 --reload-on-rss 768 -d /data/nova/uwsgi.log --limit-post 500000000 --stats 127.0.0.1:1717 \ --log-format "[pid: %(pid)|worker: %(wid)|req: -/-] %(addr) [%(ctime)] %(method) %(uri) => generated %(rsize) bytes in %(msecs) msecs (%(proto) %(status)) %(headers) headers in %(hsize) bytes (%(switches) switches on core %(core))" \ --show-config \ --harakiri 600 \ ``` Startup patch ``` diff --git a/net/nova-uwsgi.service b/net/nova-uwsgi.service index 2168531b..ac605d0c 100644 --- a/net/nova-uwsgi.service +++ b/net/nova-uwsgi.service @@ -18,7 +18,7 @@ NotifyAccess=all WorkingDirectory=/home/nova/astrometry/net User=nova Environment="PYTHONPATH=/home/nova" "PATH=/usr/local/bin:/usr/bin:/bin:/home/nova/astrometry/util:/home/nova/astrometry/solver:/home/nova/astrometry/plot" -ExecStart=/usr/local/bin/uwsgi -s :3030 --wsgi-file wsgi.py --touch-reload wsgi.py --processes 8 --reload-on-rss 768 -d /data/nova/uwsgi.log --limit-post 500000000 +ExecStart=/usr/local/bin/uwsgi -s :3030 --plugin /usr/lib/uwsgi/plugins/python310_plugin.so --wsgi-file wsgi.py --touch-reload wsgi.py --processes 8 --reload-on-rss 768 -d /data/nova/uwsgi.log --limit-post 500000000 [Install] WantedBy=multi-user.target ``` Apache ``` a2enmod rewrite a2enmod proxy_uwsgi a2enmod proxy_http. ``` Apache `/etc/apache2/sites-enabled/000-default.conf` ``` LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so ServerAdmin webmaster@localhost DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined RewriteEngine on RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC] RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC] RewriteRule /(.*) ws://127.0.0.1:3030/$1 [P] ProxyPass uwsgi://127.0.0.1:3030/ ProxyVia On ProxyPreserveHost On ``` ``` systemctl restart apache2 ``` Startup ``` sudo cp nova-jobs.service /etc/systemd/system/ sudo cp nova-uwsgi.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl start nova-jobs.service sudo systemctl start nova-uwsgi.service ``` If everything works, start on boot: ``` systemctl enable nova-jobs.service systemctl enable nova-uwsgi.service # reboot ``` The API key by default: `XXXXXXXX` Add some indexes: ``` mkdir -p /data/INDEXES/index-4100 /data/INDEXES/index-4200 wget -r -l1 -c -N --no-parent --no-host-directories --cut-dirs=2 -A ".fits" -P /data/INDEXES/index-4100 http://broiler.astrometry.net/~dstn/4100/ wget -r -l1 -c -N --no-parent --no-host-directories --cut-dirs=2 -A ".fits" -P /data/INDEXES/index-4200 http://broiler.astrometry.net/~dstn/4200/ wget http://data.astrometry.net/hip.fits -O /data/hip.fits wget http://data.astrometry.net/hd.fits -O /data/hd.fits wget http://data.astrometry.net/tycho2.kd -O /data/tycho2.kd ```