dodona-edu / dolos

:detective: Source code plagiarism detection
https://dolos.ugent.be
MIT License
257 stars 32 forks source link

Problems with docker-compose #1386

Closed mikaelGusse closed 8 months ago

mikaelGusse commented 8 months ago

Describe the bug Hello! I am trying to host the Dolos api server locally on my machine for testing but I am having some issues with docker-compose and I am not quite sure if these issues are due to a configuration fault with my machine or with Dolos itself so I am making this issue to try to resolve this.

I am unable to run the api using docker-compose due to an error. Additionally the build fails using docker-compose unless i specify for it only to build the api.

To Reproduce Steps to reproduce the behavior:

Attaching to api-1 api-1 | /usr/local/bundle/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb:14: [BUG] Segmentation fault at 0x0065ffffa87b06c0 api-1 | ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [aarch64-linux] api-1 | api-1 | -- Control frame information ----------------------------------------------- .... And this error message continues for a while with lots of additional information ....

Your environment (please complete the following information):

Please run dolos --version and paste the result:

[user@system:~]$ dolos --version
Dolos v2.5.0
Node v20.11.1
Tree-sitter ^0.20.6

[user@system:~]$ docker-compose --version
Docker Compose version v2.24.5-desktop.1
rien commented 8 months ago

Hello @mikaelGusse , it seems there is an issue with Ruby 3.3 on aarch64 (https://bugs.ruby-lang.org/issues/20085).

Can you try changing the image in api/Dockerfile to ruby:3.2 to see if it works? You might also need to change the ruby version in the Gemfile.

mikaelGusse commented 8 months ago

I changed the Ruby version in the Gemfile and Dockerfile and now it gets a bit further but fails at a different step:

[+] Running 4/4 ✔ Network dolos_dolos Created 0.0s ✔ Container dolos-db-1 Created 0.1s ✔ Container dolos-worker-1 Created 0.1s ✔ Container dolos-api-1 Created 0.0s Attaching to api-1 api-1 | bin/rails aborted! api-1 | ActiveRecord::StatementInvalid: Mysql2::Error: Unknown collation: 'utf8mb4_0900_ai_ci' (ActiveRecord::StatementInvalid) api-1 | /dolos/db/schema.rb:14:in block in <main>' api-1 | /dolos/db/schema.rb:13:in

' api-1 | api-1 | Caused by: api-1 | Mysql2::Error: Unknown collation: 'utf8mb4_0900_ai_ci' (Mysql2::Error) api-1 | /dolos/db/schema.rb:14:in block in <main>' api-1 | /dolos/db/schema.rb:13:in
' api-1 | Tasks: TOP => db:prepare api-1 | (See full trace by running task with --trace) api-1 | D, [2024-02-26T11:20:57.656912 #8] DEBUG -- : (0.5ms) CREATE DATABASE dolos DEFAULT CHARACTER SET utf8mb4 api-1 | Created database 'dolos' api-1 | D, [2024-02-26T11:20:57.695774 #8] DEBUG -- : (31.8ms) DROP TABLE IF EXISTS active_storage_attachments CASCADE api-1 | D, [2024-02-26T11:20:57.696509 #8] DEBUG -- : (0.3ms) CREATE TABLE active_storage_attachments (id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY, name varchar(255) NOT NULL, record_type varchar(255) NOT NULL, record_id bigint NOT NULL, blob_id bigint NOT NULL, created_at datetime(6) NOT NULL, INDEX index_active_storage_attachments_on_blob_id (blob_id), UNIQUE INDEX index_active_storage_attachments_uniqueness (record_type, record_id, name, blob_id)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci api-1 exited with code 1

So it fails when trying to create the database.

rien commented 8 months ago

Can you try updating the database image by running docker pull mariadb:latest?

Apologies for the errors, it seems you are the first MacOS ARM user who is trying out or web server.

mikaelGusse commented 8 months ago

image

It appears that it is already the newest version

rien commented 8 months ago

I don't know why it is trying to use the utf8mb4_0900_ai_ci collation, as we use the utf8mb4_general_ci our schema.

I also noticed the Dockerfile for dolos-web is missing, so that will cause an issue as well.

I can dig deeper into this issue later this week and keep you updated. Thanks for reporting the issue!

If you want to use Dolos in the mean time, you can use our public and free to use instance over at https://dolos.ugent.be/server or install the Dolos CLI (see dolos.ugent.be/docs).

mikaelGusse commented 8 months ago

Alright, sounds good. Thanks for the help!