Skip to content

Commit

Permalink
services/sicp-staging: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
linyinfeng committed Sep 22, 2024
1 parent 758e7bd commit 43d2cb3
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
diff --git a/packages/app/src/main/java/cn/edu/nju/sicp/contests/hog/HogCompare.java b/packages/app/src/main/java/cn/edu/nju/sicp/contests/hog/HogCompare.java
index 1225612..f51018a 100644
--- a/packages/app/src/main/java/cn/edu/nju/sicp/contests/hog/HogCompare.java
+++ b/packages/app/src/main/java/cn/edu/nju/sicp/contests/hog/HogCompare.java
@@ -132,8 +132,7 @@ public class HogCompare implements Consumer<HogEntry> {
new HostConfig()
.withCpuPeriod(100000L)
.withCpuQuota(100000L)
- .withMemory(1024L * 1024 * 1024) // load scenarios require huge memory
- .withMemorySwappiness(0L))
+ .withMemory(1024L * 1024 * 1024)) // load scenarios require huge memory
.exec()
.getId();

diff --git a/packages/app/src/main/java/cn/edu/nju/sicp/contests/hog/HogTrigger.java b/packages/app/src/main/java/cn/edu/nju/sicp/contests/hog/HogTrigger.java
index e3457e2..f68d5bf 100644
--- a/packages/app/src/main/java/cn/edu/nju/sicp/contests/hog/HogTrigger.java
+++ b/packages/app/src/main/java/cn/edu/nju/sicp/contests/hog/HogTrigger.java
@@ -125,8 +125,7 @@ public class HogTrigger implements Consumer<Submission> {
new HostConfig()
.withCpuPeriod(100000L)
.withCpuQuota(100000L)
- .withMemory(1024L * 1024 * 1024) // 1G RAM
- .withMemorySwappiness(0L))
+ .withMemory(1024L * 1024 * 1024)) // 1G RAM
.exec()
.getId();

diff --git a/packages/app/src/main/java/cn/edu/nju/sicp/listeners/GradeSubmissionListener.java b/packages/app/src/main/java/cn/edu/nju/sicp/listeners/GradeSubmissionListener.java
index 192327a..85696d6 100644
--- a/packages/app/src/main/java/cn/edu/nju/sicp/listeners/GradeSubmissionListener.java
+++ b/packages/app/src/main/java/cn/edu/nju/sicp/listeners/GradeSubmissionListener.java
@@ -166,8 +166,7 @@ public class GradeSubmissionListener implements ChannelAwareMessageListener {
.withHostConfig(new HostConfig()
.withCpuPeriod(100000L)
.withCpuQuota(100000L)
- .withMemory(256L * 1024 * 1024)
- .withMemorySwappiness(0L))
+ .withMemory(256L * 1024 * 1024))
.exec()
.getId();
logStopWatch.accept(String.format("Created Docker container.\n ID: %s\n RF: %s\n",
9 changes: 5 additions & 4 deletions nixos/profiles/services/sicp-staging/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ in
git fetch --all
git reset --hard origin/staging-yinfeng
sed -i 's^https://sicp.pascal-lab.net/2024/oj/api^https://sicp-staging.li7g.com/${ojBase}/api^g' packages/web/src/config.ts
git apply "${./_patches/app-docker-disable-swappiness.patch}"
# build app
pushd packages/app
Expand Down Expand Up @@ -102,9 +103,6 @@ in
serviceConfig = {
User = config.users.users.sicp-staging.name;
Group = config.users.groups.sicp-staging.name;
SupplementaryGroups = [
config.users.groups.podman.name # root access
];
StateDirectory = "sicp-staging";
WorkingDirectory = "/var/lib/sicp-staging";
LoadCredential = [
Expand All @@ -130,6 +128,9 @@ in
users.users.sicp-staging = {
isSystemUser = true;
group = config.users.groups.sicp-staging.name;
extraGroups = [
config.users.groups.podman.name
];
};
users.groups.sicp-staging = { };
users.users.nginx.extraGroups = [ config.users.groups.sicp-staging.name ];
Expand Down Expand Up @@ -216,7 +217,7 @@ in
secret = config.sops.placeholder."sicp_staging_jwt_secret";
};
docker = {
host = "unix:///run/docker.sock";
host = "unix:///run/podman/podman.sock";
tls-verify = false;
};
s3 = {
Expand Down

0 comments on commit 43d2cb3

Please sign in to comment.