A collaboration with platform workers.
Go to file
mt ce649d30b1 Clean up scanimation, add pen test script, update pipfile, level the scanned images 2020-01-08 17:55:45 +01:00
scanimation Clean up scanimation, add pen test script, update pipfile, level the scanned images 2020-01-08 17:55:45 +01:00
sorteerhoed Clean up scanimation, add pen test script, update pipfile, level the scanned images 2020-01-08 17:55:45 +01:00
www Clean up scanimation, add pen test script, update pipfile, level the scanned images 2020-01-08 17:55:45 +01:00
.gitattributes Add scanimation 2019-12-18 10:48:23 +01:00
.gitignore HIT now on https://guest.rubenvandeven.com:8888 and integrates in Mturk interface, TODO: sync timer 2019-12-18 18:49:07 +01:00
Pipfile Clean up scanimation, add pen test script, update pipfile, level the scanned images 2020-01-08 17:55:45 +01:00
Pipfile.lock Clean up scanimation, add pen test script, update pipfile, level the scanned images 2020-01-08 17:55:45 +01:00
README.md Update reamdme 2019-11-04 09:31:16 +01:00
config.yml Clean up scanimation, add pen test script, update pipfile, level the scanned images 2020-01-08 17:55:45 +01:00
disable_motors.py HIT now on https://guest.rubenvandeven.com:8888 and integrates in Mturk interface, TODO: sync timer 2019-12-18 18:49:07 +01:00
mt_task.xml Explain task more 2019-12-18 10:36:21 +01:00
requirements.txt Send drawing to server - WIP 2019-09-11 18:16:33 +02:00
server_test.py server 2019-10-23 10:56:28 +02:00
sorteerhoed.py Add option for live MT-ing 2019-11-02 21:23:38 +01:00
test_drawing.svg Clean up scanimation, add pen test script, update pipfile, level the scanned images 2020-01-08 17:55:45 +01:00
test_pen.py Clean up scanimation, add pen test script, update pipfile, level the scanned images 2020-01-08 17:55:45 +01:00

README.md

Webserver

Webserver is published to the web trough ssh remote forward. In /etc/ssh/sshd_config set GatewayPorts yes.

Then start autossh to maintain the connection:

autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -R 8127:localhost:8888 sorteerhoed@here.rubenvandeven.com

To resolve the country the (imprecise) GeoLite2 Free Country dataset is used. Download it from MaxMind and store it in the project root folder.

Start server

cd mechanical_turk
screen
pipenv shell
python disable_motors.py
python sorteerhoed.py --config config.local.yml --for-real

Scanning

For scanning run visudo and add to the sudoers file:

mt	ALL=(ALL) NOPASSWD: /usr/bin/scanimage

Installation

Software dependencies:

  • python3
  • pipenv
  • usbrelay
  • autossh

Python deps:

pipenv install

Usbrelay

When installing usbrelay

apt install usbrelay

And set udev rules to access the device by anyone, according to usbrelay docs:

SUBSYSTEM=="usb", ATTR{idVendor}=="16c0",ATTR{idProduct}=="05df", MODE="0666"
KERNEL=="hidraw*", ATTRS{busnum}=="1", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", MODE="0666"

into /etc/udev/rules.d/50-dct-tech-usb-relay-2.rules and then reload rules:

sudo udevadm control --reload-rules && sudo udevadm trigger

Apache on here.rubenvandeven.com

Unfortunately an SSH remote port-forward does change the ip of the requester into ::1/127.0.0.1. One solution would be to run a proxy on the server itself, which forwards a port to our server port, while adding a X-Forwarded-For header.

Example of apache host setup to forward remote port 8888 to local port 8127, to which we connect our (auto)ssh remote tunnel (see above).

Listen 8888

<VirtualHost *:8888>
        Servername here.rubenvandeven.com

		RewriteEngins On
		RewriteCond %{HTTP:Upgrade} =websocket [NC]
		RewriteRule /(.*)           ws://localhost:8127/$1 [P,L]
		RewriteCond %{HTTP:Upgrade} !=websocket [NC]
		RewriteRule /(.*)         http://localhost:8127/$1 [P,L]

        ProxyPass / http://localhost:8127/
        ProxyPassReverse / http://localhost:8127/
        ProxyPreserveHost On
</VirtualHost>

requires a2enmod rewrite proxy proxy_http proxy_wstunnel

s