In here we can put instructions on how to run this / any general info


ubuntu packages:
	sudo apt-get install -y mediainfo cmake python3-flask

pip packages:
    * pymediainfo
    * PIL (should be there by default)
        - on ubuntu, need to do: pip3 install --upgrade pillow --user
    * ExifRead
    * opencv-python
    * datetime
    * pytz
    * face_recognition
    #### dlib (might need to install this before face_recognitioin, but it might not be needed, cmake clearly was)


To run debug version of web server:
    FLASK_APP=main FLASK_ENV=development flask run --host=192.168.0.2

to run prod version of web server:
    gunicorn --bind="192.168.0.2:5000" --threads=2 --workers=2 main:app

Also have to run the job manager for jobs to work:
    python3 pa_job_manager.py

To rebuild DB from scratch/empty data:

    ###BE CAREFUL this completely destroys the database contents and starts from
    #scratch, when we get real data, we will instead cp a backup file not the
    #tables.sql

    ( cd /srv/docker/config/ ; sudo docker-compose  stop padb ;  yes | sudo docker-compose rm padb ; sudo rm -rf /srv/docker/container/padb/data/ ; sudo cp /home/ddp/src/photoassistant/tables.sql /srv/docker/container/padb/docker-entrypoint-initdb.d/tables.sql ; sudo docker-compose up padb )

To get back a 'working' but scanned set of data:

# make a backup and store it in DB_BACKUP:

    sudo docker exec -it padb bash
        root@2881f871e1c2:/# pg_dump --user=pa --password pa > /docker-entrypoint-initdb.d/tables.sql
    cp /srv/docker/container/padb/docker-entrypoint-initdb.d/tables.sql /home/ddp/src/photoassistant/DB_BACKUP/
    mv /home/ddp/src/photoassistant/DB_BACKUP/tables.sql /home/ddp/src/photoassistant/DB_BACKUP/`date +%Y%m%d-tables.sql`
    gzip -9 /home/ddp/src/photoassistant/DB_BACKUP/`date +%Y%m%d-tables.sql`
    # mv /home/ddp/src/photoassistant/DB_BACKUP/`date +%Y%m%d-tables.sql`.gz /home/ddp/src/photoassistant/DB_BACKUP/<meaningfulname>......


# start db, using new tables.sql
    ### decide what tables.sql you want, e.g.

    sudo bash
    # gunzip -c /home/ddp/src/photoassistant/DB_BACKUP/20200126-all-imported-no-duplicates.sql.gz > /srv/docker/container/padb/docker-entrypoint-initdb.d/tables.sql

    ( cd /srv/docker/config/ ; sudo docker-compose  stop padb ;  yes | sudo docker-compose rm padb ; sudo rm -rf /srv/docker/container/padb/data/ ; sudo docker-compose up padb )
