Deploy a jspsych experiment to a webserver

run_webserver(
  path,
  experiment_folder = "experiment",
  ssh,
  keyfile = NULL,
  webserver_configured = FALSE
)

Arguments

path

Path where the experiment is deployed

experiment_folder

Experiment subfolder

ssh

ssh connection string to a webserver

keyfile

(optional) path to a ssh private key to log in to your webserver

webserver_configured

set this to true when you've configured your webserver

Details

The purpose of the run_webserver() function is to make it somewhat easier to deploy a jsPsych experiment to a webserver that you control, so that the experiment can run in the cloud rather than on the local machine.

For this to work, you need to configure your webserver first. On a recent ubuntu image (available from most cloud providers), you can install apache and php with "sudo apt install apache2 php". You should probably also secure the connection between the webserver and the participants with https. If you have configured a domain name for your server, it is pretty simple to enable https via let's encrypt: "sudo add-apt-repository ppa:certbot/certbot", "sudo apt install certbot python-certbot-apache", and "sudo certbot --apache"

Used together with save_webserver, this will set up a folder on the server that apache can write to, and a little php script to receive said data (as recommended on the jspsych website).

See also

Examples

if (FALSE) { build_experiment(..., on_finish = save_webserver()) run_webserver(ssh = "user@server.com", keyfile = "~/.ssh/id_rsa") download_webserver(ssh = "user@server.com", keyfile = "~/.ssh/id_rsa") }