-
Notifications
You must be signed in to change notification settings - Fork 16
Language Setup
Most languages supported by cafe-grader require some additional setup. Mostly, this is just the installation of necessary compilers, interpreters and some virtual machine. However, some language requires more elaborated setup such as postgres which need additional database layer or Digital which requires additional simulator.
Languages in this group only requires some package installation. Use sudo apt install xxx
to installed the required package.
-
c
requiresgcc
-
c++
requiresg++
-
pas
requiresfpc
-
php
requiresphp-cli php-readline
-
go
requiresgolang-go
-
rust
requirescargo
-
haskell
requiresghc
-
java
requiresopenjdk-18-jdk
- for
python
andruby
, the required package is already installed in the setup of the grader.
For convenience, use the following command to install all required package.
cafe@grader:~$ sudo apt install ghc g++ openjdk-18-jdk fpc php-cli php-readline golang-go cargo
Currently, cafe-grader support read-only problem in PostgreSQL where contestant's submission must be a SELECT statement.
We need to install the database and setup the database, schema and user. We need two users: one for database initialization which requires all privileges and evaluation user which runs contestant's SQL. The evaluation user should be created as read-only.
- Install PostgreSQL package
cafe@grader$ sudo apt install postgresql postgresql-contrib libpq-dev
- Login to PSQL using admin user
cafe@grader$ sudo -u postgres psql
and create a database and users.
We need two users, one to initialize the database and one for grading the submission. The first one, init_grader_pg
, is for initialize. The second one, run_grader_pg
, is for grading. The second one shall be granted reading privileges to all databases and table. The username / password of both users must be given in the initialization script of the dataset of the PostgreSQL.
CREATE DATABASE grader_pg;
-- this create a user for initialization of data
CREATE USER init_grader_pg PASSWORD 'init_grader_password';
GRANT ALL PRIVILEGES ON DATABASE grader_pg TO init_grader_pg;
-- this create a user for running contestant query
CREATE USER run_grader_pg PASSWORD 'run_grader_password';
GRANT CONNECT ON DATABASE grader_pq TO run_grader_pg;
GRANT USAGE ON SCHEMA public TO run_grader_pg;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO run_grader_pg;
-- change owner of the database to our init_grader_pg
ALTER DATABASE grader_pg OWNER TO init_grader_pg;
GRANT pg_read_all_data TO run_grader_pg;