Skip to content

Commit 07128d0

Browse files
author
Robert Quander
committed
final tiny changes to resource use of checker and of service itself
1 parent ee089e1 commit 07128d0

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

checker/docker-compose.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
version: '2.1'
22
services:
33
facepalm-checker:
4+
container_name: facepalm-checker
5+
restart: unless-stopped
46
build: .
57
# The checker runs a HTTP interfaces, so we need to map port 3031 to the outside (port 8000).
68
ports:
@@ -13,7 +15,7 @@ services:
1315
- MONGO_PASSWORD=facepalm
1416
- FACEPALM_HOST=${FACEPALM_HOST}
1517
- FACEPALM_PORT=${FACEPALM_PORT}
16-
mem_limit: 1G
18+
mem_limit: 2G
1719
memswap_limit: 2G
1820
ulimits:
1921
core:
@@ -22,9 +24,16 @@ services:
2224
nproc:
2325
soft: 4000
2426
hard: 4000
27+
deploy:
28+
resources:
29+
limits:
30+
cpus: '2.0'
31+
memory: 2G
2532
# The python checkerlib requires a mongo db!
2633
facepalm-mongo:
2734
image: mongo
35+
container_name: facepalm-mongo
36+
restart: unless-stopped
2837
#ports:
2938
# - 27017:27017
3039
volumes:
@@ -40,4 +49,9 @@ services:
4049
hard: 0
4150
nproc:
4251
soft: 4000
43-
hard: 4000
52+
hard: 4000
53+
deploy:
54+
resources:
55+
limits:
56+
cpus: '2.0'
57+
memory: 2G

service/README_Before_playing.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Very important info for repairing
22

3+
## Most important thing
34
Hey, service author here.
45
If you fix the service, don't try to build on the VMs - swift loves to compile stuff, and it could take upwards of **5000 seconds** that the service is down and you lose flags.
56

@@ -31,4 +32,16 @@ docker load -i /path/to/whereever/facepalm.tar
3132
And then restart the container:
3233
```
3334
docker compose up -d
34-
```
35+
```
36+
37+
38+
## Second most important thing
39+
40+
If the container runs slow for some reason, it could be that swift has some internal cache that slows things down.
41+
42+
```
43+
docker compose down -v
44+
docker compse up -d
45+
```
46+
47+
does the trick in like 10 sec max, at the cost of one flag max.

service/Sources/App/routes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1894,7 +1894,7 @@ private func pageFooter() -> String {
18941894

18951895
let events = try await Event.query(on: req.db)
18961896
.with(\.$creator)
1897-
.sort(\.$date, .descending)
1897+
.sort(\.$createdAt, .descending)
18981898
.range(offset..<(offset + pageSize))
18991899
.all()
19001900

service/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ services:
4747
- DATABASE_NAME=facepalm
4848
ports:
4949
- "4269:4269"
50-
mem_limit: 4096m
50+
mem_limit: 1G
5151
cpus: 2.0
5252
healthcheck:
5353
test: ["CMD-SHELL", "curl -f http://localhost:4269/ || exit 1"]

0 commit comments

Comments
 (0)