Skip to content

Latest commit

 

History

History
78 lines (53 loc) · 2.97 KB

README.md

File metadata and controls

78 lines (53 loc) · 2.97 KB

SYZOJ NG

Build Status Dependencies Commitizen friendly code style: prettier License

The next generation SYZOJ server.

Deploying & Development

Clone this git repo and install dependencies:

$ git clone git@github.com:syzoj/syzoj-ng.git
$ cd syzoj-ng
$ yarn

Create a config.yaml file based on config-example.yaml:

$ cp config-example.yaml config.yaml

Database

Create a database and user in MySQL or MariaDB:

CREATE DATABASE `syzoj-ng` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON `syzoj-ng`.* TO "syzoj-ng"@"localhost" IDENTIFIED BY "syzoj-ng-password";

Then fill the database connection information in the configuration file.

Redis

Install Redis (>= 5) and change the redis url in the config (if your redis isn't listening on the default address and port).

MinIO

Install MinIO file storage server and run with a data directory (if you're not running locally, please specify the environmental variables MINIO_ACCESS_KEY and MINIO_SECRET_KEY for security):

$ wget https://dl.min.io/server/minio/release/linux-amd64/minio
$ chmod +x minio
$ MINIO_ACCESS_KEY=AKAK MINIO_SECRET_KEY=SKSK ./minio server /mnt/data # /mnt/data is the data directory

After starting MinIO server, create a bucket with MinIO's management tool mc:

$ wget https://dl.min.io/client/mc/release/linux-amd64/mc
$ chmod +x mc
$ ./mc alias set minio http://127.0.0.1:9000 "AKAK" "SKSK"
$ ./mc mb -p minio/syzoj-ng-files

Then fill the MinIO server information in the config file. The endpoint property is used by the server. If you want the user or judge to connect to MinIO with other host as the endpoint, set endpointForUser or endpointForJudge to a URL path. Make sure you configure Nginx properly, especially when you use a sub-directory.

Run

By default this app listens on 127.0.0.1:2002. You can change this in the configuration file. You can use nginx as reversed proxy to access the app with a domain name like syzoj-ng.test.

$ SYZOJ_NG_CONFIG_FILE=./config.yaml yarn start

Add SYZOJ_NG_LOG_SQL to enable TypeORM logging:

$ SYZOJ_NG_LOG_SQL=1 SYZOJ_NG_CONFIG_FILE=./config.yaml yarn start

Refer to syzoj-ng-app for the guide of the front-end app server.
Refer to syzoj-ng-judge for the guide of the judge client.