Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,27 @@ You can start the server with `rails server`. This will start the API server on
To be able to analyze datasets, you need to have the latest image of the Dolos docker

```bash
docker pull ghcr.io/dodona-ede/dolos:latest
docker pull ghcr.io/dodona-edu/dolos-cli:latest
```

You can start the job worker with `rails jobs:work`.
This will start the job worker and will spawn docker containers to analyze datasets once they are uploaded.

#### Testing changes to the Dolos CLI in the API

If you want to test and develop with local changes to the Dolos lib or CLI that haven't been published yet, you can use `nix` to create a docker image for you:

```shell
nix build .?submodules=1#dolos-load-docker
./result/bin/dolos-load-docker
# Loaded image: ghcr.io/dodona-edu/dolos-cli:latest
```

Explanation: `nix build` will first build the `dolos-cli` package using the current state of the repository (including submodules), then wrap the CLI in a docker image, and then build the script loading that image in your current docker instance with the correct name.

If `nix` complains about an incorect `npmDepsHash`, you can replace the expected hash in `../package.nix`.


### 4. Running the frontend

To interact with the API server you should run the `dolos-web` front-end in _server mode_.
Expand Down
19 changes: 19 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@
packages = rec {
default = dolos-cli;
dolos-cli = pkgs.callPackage (import ./package.nix) {};
dolos-docker-image = pkgs.dockerTools.buildImage {
name = "ghcr.io/dodona-edu/dolos-cli";
tag = "latest";
copyToRoot = pkgs.buildEnv {
name = "image-root";
paths = [ dolos-cli ];
pathsToLink = [ "/bin" ];
};
runAsRoot = ''
mkdir -p /dolos
'';
config = {
Cmd = [ "/bin/dolos" ];
WorkingDir = "/dolos";
};
};
dolos-load-docker = pkgs.writeShellScriptBin "dolos-load-docker" ''
docker load < ${dolos-docker-image}
'';
};
overlays.default = final: prev: {
dolos-cli = final.callPackage (import ./package.nix) {};
Expand Down
20 changes: 18 additions & 2 deletions package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,25 @@ buildNpmPackage rec {
pname = "dolos";
version = "2.7.1";

src = ./.;
srcs = [
./package.json
./package-lock.json
./tsconfig.global.json
./core
./parsers
./lib
./web
./cli
];

npmDepsHash = "sha256-qgAdXhohaIyQffkiIWxVXeE3c4JRTgbjxrNFI9dlaNs=";
unpackPhase = ''
for src in $srcs; do
cp -r $src ./$(stripHash $src)
chmod -R 700 ./$(stripHash $src)
done
'';

npmDepsHash = "sha256-XMATCZS/j5bcGjfUQnaFC2mPCv47+3tgIfruTYUQhN4=";

npmWorkspace="cli";

Expand Down