Deploying an Annotation Server
Pick a host for an annotation study by how long it runs, who pays and what servers you have, then use potato deploy for HTTPS, backups and data retrieval.
An annotation server for a real study needs a public HTTPS address, a sign-in that admits only your annotators, storage that survives a restart, and a way to get the annotations back when the study ends. With Potato, potato deploy up creates the host and the certificate from the config you piloted, sets up a backup on hosts that wipe their disk, and warns you before deploying if anyone with the link could sign in.
An annotation server here is the web application your annotators open in a browser, running somewhere other than your laptop so that they can reach it for the weeks a study lasts. Moving a piloted task onto one changes its address, its sign-in, where its data is stored, and who has to look after the machine.
Four requirements for a study server
Each requirement below protects either the annotators or the data:
- A public HTTPS address. Annotators type passwords and labels into the task, so the connection has to be encrypted with HTTPS. A certificate from Let's Encrypt costs nothing, and the server needs a public address for it.
- A sign-in that admits only your annotators. A public address can be found, and a task with open registration accepts anyone who finds it. Use a roster of named accounts (Password Management), sign-in through Google, GitHub or your institution (SSO and OAuth), or, for a crowdsourced study, the links a platform hands its workers (Crowdsourcing Integration).
- Storage that survives a restart. Some hosts wipe the disk whenever the server restarts. A study on one of them needs a backup that restores automatically, or a returning annotator finds an empty task.
- A way to get the data back. Potato stores each annotator's work in files and keeps project data in SQLite databases. Copying a SQLite file while the server is running can miss recent work, so retrieval has to use SQLite's own backup command.
Hosts for common study situations
Which host fits depends on how long the study runs, who pays, and whether your institution already runs servers. The table matches common situations to a host, with the monthly cost Potato prints for each target's default size:
| Situation | Host | Monthly cost | Guide |
|---|---|---|---|
| A study, with an AWS account | AWS Lightsail, 2 GB | $12 | AWS Lightsail |
| A study at a US institution, with no budget | Jetstream2 | free with an ACCESS allocation | Jetstream2 |
| A study, at the lowest price | Hetzner Cloud, 4 GB | about €6 | Hetzner, Vultr and Linode |
| A public demo, or a lab already on Hugging Face | a Hugging Face Docker Space | a PRO or Team plan | Hugging Face Spaces |
| A pilot with a few people for an afternoon | your laptop, through potato share | free | Running Potato Locally or in the Cloud |
| A server your institution already runs | the Docker image behind a reverse proxy | none from Potato | Production Setup |
The first three are virtual machines with a disk that survives a restart, so they are the default for a study that runs for weeks. A Hugging Face Space loses its disk on every restart, so Potato backs the annotations up to a private Hugging Face dataset every five minutes and restores them when the Space starts. Running Potato Locally or in the Cloud lists all thirteen cloud targets, including Fly, Railway, Render and Heroku.
potato deploy on a new host
potato deploy up takes the config you piloted and does what a person would otherwise do by hand. On a VM it creates the machine, opens only ports 22, 80 and 443, installs Docker and the Caddy web server, gets a Let's Encrypt certificate, uploads the project and starts Potato as a service. Install the pip extra for your host first, the optional dependencies its deploy needs, then check the config the way the host will read it:
pip install 'potato-annotation[deploy-aws]'
potato deploy check myproject/config.yaml --provider aws
potato deploy up myproject/config.yaml --provider aws --dry-runpotato deploy check reports configuration errors and finds paths that resolve only on your machine. --dry-run needs no cloud account and prints every resource the deploy would create, the monthly cost, and who will be able to sign in. It flags open registration on a public address with warning D003. To deploy, run the same command without --dry-run. Potato shows the plan again, creates nothing until you confirm, and then prints the URL to send your annotators.
The deploy changes only the settings that concern hosting. It turns debug mode off, keeps sessions across restarts, and runs one worker process, because Potato holds the item pool and the assignment queue in memory and a second process would hand out the same items twice. It leaves user_config, authentication and require_password as you wrote them. It generates an admin key for the deployment and stores it in .potato/secrets.json beside your config, and the key opens the admin dashboard at /admin.
Potato on a server your institution already runs
If your institution already runs a server, run the published Docker image behind its reverse proxy instead of creating a new host. A reverse proxy such as nginx holds the certificate and forwards requests to Potato. Production Setup has the Docker Compose file, the nginx configuration and the gunicorn settings. Keep gunicorn at one worker and add threads for concurrency, because a second worker process would hand out the same items twice.
Potato's backup block keeps a copy of the data off that server. It copies the annotation output and snapshots of the project databases to a Hugging Face dataset or an S3-compatible bucket every five minutes by default, and restores them when the server starts with an empty disk. Add this block to the config, install the hosting extra, and set HF_TOKEN in the server's environment:
backup:
schedule_minutes: 5
restore_on_boot: true
sinks:
- type: huggingface
repo_id: lab/pilot-annotationsPotato creates the dataset as a private repository if it does not exist. The restore brings back the account list with the annotations, so annotators sign in with the same passwords, and it never overwrites annotations already on the disk.
Status checks and data retrieval
potato deploy status reports whether the server is up and whether its certificate is healthy. On a VM without a domain name, the certificate is issued for the IP address and lasts about six days. It renews automatically, so check the status every few days if the study runs unattended, or pass --domain with a DNS record pointing at the server. potato deploy logs myproject/config.yaml -f follows the server log, and the admin dashboard shows progress, throughput and inter-annotator agreement while annotators work.
When the study ends, pull the data before removing the host:
potato deploy pull myproject/config.yaml
potato deploy destroy myproject/config.yamlpull copies the annotation output and the project databases into a new potato-pull-<name>-<timestamp> directory and checks what arrived. destroy will not remove a deployment that has never been pulled, and a pull that returned no files does not count, so open the pulled directory and check that the last annotations are there before you destroy anything.
Further reading
- Running Potato Locally or in the Cloud, for every cloud target and the backup flags
- Production Setup, for gunicorn, Docker and nginx on your own server
- Running a Crowdsourced Study, for sending crowdworkers to a deployed task
- Exporting Annotations for ML, for turning the pulled data into training files