6.2.6 Using raco congame
The raco congame command provides tools for uploading and testing studies from the command line. DrRacket’s Upload Study button uses the same upload mechanism under the hood, and the login credentials are shared between the CLI and DrRacket.
raco congame ‹command› ‹option› ... ‹arg› ...
6.2.6.1 raco congame login
raco congame login
Logs in to a Congame server. The command prompts for a server URL, defaulting to
http://127.0.0.1:5100 (i.e., the local Docker container). It then opens a browser window
where you authenticate with the server. Once authentication is complete, your credentials are saved
and used for future uploads —
6.2.6.2 raco congame logout
raco congame logout
Clears stored login credentials. This is useful when you need to switch to a different server —
6.2.6.3 raco congame upload
raco congame upload ‹study-id› ‹path›
Uploads the study at ‹path› to the server you are currently logged in to. The ‹study-id› must match the identifier supplied to defstudy and must be exported with provide from the study file. On success, the command opens a browser to the study’s admin page. If you are not logged in, it will prompt you to log in first.
The ‹path› argument may be either a Racket source file or a zip archive that contains one. In both cases the CLI ultimately works from a single study file:
When ‹path› is a ".rkt" file, it is used directly. Any filename is accepted —
the file is renamed to "study.rkt" inside the uploaded bundle. When ‹path› is a ".zip" file, the CLI extracts the archive to a temporary location and walks the resulting directory tree for a file literally named "study.rkt", stopping at the first directory that contains one. So "study.rkt" may live at the root of the archive or inside a single nested folder, but the name must match exactly (e.g., "Study.rkt" won’t be found). Once found, the rest of the archive is otherwise discarded: the bundle that is actually uploaded is rebuilt from scratch from "study.rkt" and its detected dependencies, by the same rules described below.
From the resolved "study.rkt", the CLI builds the bundle to upload by collecting:
"study.rkt" itself.
Its transitive same-directory relative imports —
that is, modules whose resolved location is the same directory as the module that imports them. A module imported from a subdirectory or a parent directory is not included by this mechanism, even if the import statement resolves successfully on your machine. (In practice, plain #lang conscript’s require form does not accept path-based imports at all, so this restriction mostly affects studies written in #lang conscript/with-require.) Every file or directory declared with define-static-resource, resolved relative to "study.rkt". Subdirectory paths are supported, and the relative structure is preserved inside the bundle.
The bundle that arrives at the server must:
Contain a file named exactly "study.rkt" that provides ‹study-id›.
Begin with #lang conscript (or #lang conscript/with-require for accounts with the admin or researcher role —
see conscript/with-require).
Tip: If your study uses images or other static files, the simplest workflow is to keep "study.rkt" together with its assets in a single folder, declare the assets with define-static-resource, and run raco congame upload ‹study-id› study.rkt. See How to add images for a worked example.
6.2.6.4 raco congame simulate
raco congame simulate ‹slug›
Opens multiple browser sessions enrolled in the study instance identified by ‹slug›, for testing studies that involve coordination between participants.
The raco congame simulate command accepts the following flags:
--host ‹host› —
the Congame server URL. Defaults to http://127.0.0.1:5100. -n ‹num› —
the number of simultaneous browser sessions to open. Must be a positive integer. Defaults to 2.