From b5bedddf94a3f443cf8f2760b2cb578a54e0fa7f Mon Sep 17 00:00:00 2001 From: Paul Pan Date: Sat, 27 Jan 2024 17:37:27 +0800 Subject: [PATCH] feat: use containerd as backend --- config.docker.yaml | 3 + docker-entrypoint.sh | 133 +++++++---- go.mod | 71 ++++-- go.sum | 221 +++++++++++++++--- internal/api/runner/build.go | 2 +- internal/api/runner/judge.go | 2 +- internal/model/config.go | 5 + internal/service/runner/common.go | 12 +- internal/service/runner/compile.go | 59 +++-- internal/service/runner/config.go | 4 +- internal/service/runner/container.go | 138 +++++++++++ internal/service/runner/deps.go | 74 +++--- internal/service/runner/exec.go | 111 --------- internal/service/runner/new_problem.go | 46 ++-- internal/service/runner/run_judge.go | 184 +++++++++------ internal/service/runner/service.go | 33 ++- resource/runner/scripts/common.sh | 7 +- resource/runner/scripts/ubuntu-run.Dockerfile | 6 +- 18 files changed, 745 insertions(+), 366 deletions(-) create mode 100644 internal/service/runner/container.go delete mode 100644 internal/service/runner/exec.go diff --git a/config.docker.yaml b/config.docker.yaml index 0e1ae51..283918f 100644 --- a/config.docker.yaml +++ b/config.docker.yaml @@ -37,6 +37,9 @@ Storage: SecretKey: ${STORAGE_SECRET_KEY} Bucket: ${STORAGE_BUCKET} +Runner: + Address: ${RUNNER_ADDRESS} + Metrics: Namespace: ${METRICS_NAMESPACE} Subsystem: ${METRICS_SUBSYSTEM} diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index e05bb12..3f07562 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -9,8 +9,6 @@ function log_info() { echo -e "${COLOR_GREEN}$*${COLOR_NONE}" 1>&2; } function log_warn() { echo -e "${COLOR_YELLOW}$*${COLOR_NONE}" 1>&2; } function log_error() { echo -e "${COLOR_RED}$*${COLOR_NONE}" 1>&2; } -log_info "extracting env vars" - function check_env() { # $1 -> var name # $2 -> default value @@ -34,58 +32,105 @@ function check_env() { # echo " <<<<<" } -check_env "WEB_SERVER_ADDRESS" "0.0.0.0" true -check_env "WEB_SERVER_PORT" 8000 false -check_env "WEB_SERVER_PUBLIC_BASE" "http://127.0.0.1:8000" true -check_env "WEB_SERVER_TRUSTED_PLATFORM" "" true -check_env "WEB_SERVER_JWT_SIGNING_KEY" "$(head -n 10 /dev/urandom | md5sum | cut -c 1-32)" true -check_env "WEB_SERVER_JWT_EXPIRE_HOUR" 12 false -check_env "WEB_SERVER_OAUTH_DOMAIN" "" true -check_env "WEB_SERVER_OAUTH_CLIENT_ID" "" true -check_env "WEB_SERVER_OAUTH_CLIENT_SECRET" "" true +function extract_web_server() { + check_env "WEB_SERVER_ADDRESS" "0.0.0.0" true + check_env "WEB_SERVER_PORT" 8000 false + check_env "WEB_SERVER_PUBLIC_BASE" "http://127.0.0.1:8000" true + check_env "WEB_SERVER_TRUSTED_PLATFORM" "" true + check_env "WEB_SERVER_JWT_SIGNING_KEY" "$(head -n 10 /dev/urandom | md5sum | cut -c 1-32)" true + check_env "WEB_SERVER_JWT_EXPIRE_HOUR" 12 false + check_env "WEB_SERVER_OAUTH_DOMAIN" "" true + check_env "WEB_SERVER_OAUTH_CLIENT_ID" "" true + check_env "WEB_SERVER_OAUTH_CLIENT_SECRET" "" true +} -check_env "REDIS_DB" 0 false -check_env "REDIS_QUEUE_DB" 1 false -check_env "REDIS_ADDRESS" "redis" true -check_env "REDIS_PORT" 6379 false -check_env "REDIS_PASSWORD" "" true +function extract_redis() { + check_env "REDIS_DB" 0 false + check_env "REDIS_QUEUE_DB" 1 false + check_env "REDIS_ADDRESS" "redis" true + check_env "REDIS_PORT" 6379 false + check_env "REDIS_PASSWORD" "" true +} -check_env "DATABASE_HOST" "postgres" true -check_env "DATABASE_PORT" 5432 false -check_env "DATABASE_USER" "dev" true -check_env "DATABASE_PASSWORD" "password" true -check_env "DATABASE_NAME" "dev" true -check_env "DATABASE_PREFIX" "oj_" true -check_env "DATABASE_MAX_OPEN_CONNS" 100 false -check_env "DATABASE_MAX_IDLE_CONNS" 60 false -check_env "DATABASE_CONN_MAX_LIFETIME" 60 false -check_env "DATABASE_TIMEZONE" "Asia/Shanghai" true +function extract_database() { + check_env "DATABASE_HOST" "postgres" true + check_env "DATABASE_PORT" 5432 false + check_env "DATABASE_USER" "dev" true + check_env "DATABASE_PASSWORD" "password" true + check_env "DATABASE_NAME" "dev" true + check_env "DATABASE_PREFIX" "oj_" true + check_env "DATABASE_MAX_OPEN_CONNS" 100 false + check_env "DATABASE_MAX_IDLE_CONNS" 60 false + check_env "DATABASE_CONN_MAX_LIFETIME" 60 false + check_env "DATABASE_TIMEZONE" "Asia/Shanghai" true +} -check_env "STORAGE_ENDPOINT" "minio:9000" true -check_env "STORAGE_USE_SSL" "false" false -check_env "STORAGE_ACCESS_KEY" "access_key" true -check_env "STORAGE_SECRET_KEY" "secret_key" true -check_env "STORAGE_BUCKET" "woj" true +function extract_storage() { + check_env "STORAGE_ENDPOINT" "minio:9000" true + check_env "STORAGE_USE_SSL" "false" false + check_env "STORAGE_ACCESS_KEY" "access_key" true + check_env "STORAGE_SECRET_KEY" "secret_key" true + check_env "STORAGE_BUCKET" "woj" true +} -check_env "METRICS_NAMESPACE" "woj" true -check_env "METRICS_SUBSYSTEM" "server" true +function extract_runner() { + check_env "RUNNER_ADDRESS" "/run/containerd/containerd.sock" true +} -check_env "DEVELOPMENT" false false +function extract_metrics() { + check_env "METRICS_NAMESPACE" "woj" true + check_env "METRICS_SUBSYSTEM" "server" true +} -rm -f /tmp/tmp.yaml -( - echo "cat </app/config.yaml" - cat /app/config.docker.yaml - echo "EOF" -) >/tmp/tmp.yaml +function extract_misc() { + check_env "DEVELOPMENT" false false +} -if [ -f '/app/config.yaml' ]; then - log_info "config.yaml already exists, skip" -else +function generate_config() { + if [ -f '/app/config.yaml' ]; then + log_info "config.yaml already exists, skip" + return + fi + + # extract env vars + extract_web_server + extract_redis + extract_database + extract_storage + extract_runner + extract_metrics + extract_misc + + # dump script + rm -f /tmp/tmp.yaml + ( + echo "cat </app/config.yaml" + cat /app/config.docker.yaml + echo "EOF" + ) >/tmp/tmp.yaml + + # dump env vars log_info "creating config.yaml" . /tmp/tmp.yaml || (log_error "failed to create config.yaml" && exit 1) + + # cleanup + rm -f /tmp/tmp.yaml +} + +startup_containerd() { + rc-status + touch /run/openrc/softlevel + rc-update add containerd default + rc-service containerd start + rc-service containerd status + log_info 'containerd started' +} + +if [ -n "$START_CONTAINERD" ]; then + startup_containerd fi +generate_config + log_info "starting woj" -#cat /app/config.yaml exec /app/woj "$@" diff --git a/go.mod b/go.mod index b5becdf..df6ef7a 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,12 @@ module git.0x7f.app/WOJ/woj-server -go 1.21.5 +go 1.21.6 require ( github.com/TheZeroSlave/zapsentry v1.20.2 + github.com/containerd/containerd v1.7.12 github.com/coreos/go-oidc/v3 v3.9.0 - github.com/getsentry/sentry-go v0.25.0 + github.com/getsentry/sentry-go v0.26.0 github.com/gin-contrib/cors v1.5.0 github.com/gin-contrib/pprof v1.4.0 github.com/gin-contrib/zap v0.2.0 @@ -13,72 +14,97 @@ require ( github.com/gin-gonic/gin v1.9.1 github.com/golang-jwt/jwt/v4 v4.5.0 github.com/hibiken/asynq v0.24.1 - github.com/jackc/pgtype v1.14.0 + github.com/jackc/pgtype v1.14.1 github.com/minio/minio-go/v7 v7.0.66 + github.com/opencontainers/runtime-spec v1.1.1-0.20230823135140-4fec88fd00a4 github.com/prometheus/client_golang v1.18.0 - github.com/redis/go-redis/v9 v9.3.1 + github.com/redis/go-redis/v9 v9.4.0 github.com/samber/do v1.6.0 github.com/swaggo/files v1.0.1 github.com/swaggo/gin-swagger v1.6.0 github.com/swaggo/swag v1.16.2 github.com/urfave/cli/v2 v2.27.1 go.uber.org/zap v1.26.0 - golang.org/x/crypto v0.17.0 - golang.org/x/oauth2 v0.15.0 + golang.org/x/crypto v0.18.0 + golang.org/x/oauth2 v0.16.0 golang.org/x/text v0.14.0 gopkg.in/yaml.v3 v3.0.1 gorm.io/driver/postgres v1.5.4 - gorm.io/gorm v1.25.5 + gorm.io/gorm v1.25.6 moul.io/zapgorm2 v1.3.0 ) require ( + github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect + github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20231105174938-2b5cbb29f3e2 // indirect github.com/KyleBanks/depth v1.2.1 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/Microsoft/hcsshim v0.12.0-rc.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bytedance/sonic v1.10.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect github.com/chenzhuoyu/iasm v0.9.1 // indirect + github.com/containerd/cgroups/v3 v3.0.3 // indirect + github.com/containerd/continuity v0.4.3 // indirect + github.com/containerd/fifo v1.1.0 // indirect + github.com/containerd/log v0.1.0 // indirect + github.com/containerd/ttrpc v1.2.2 // indirect + github.com/containerd/typeurl/v2 v2.1.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect github.com/dustin/go-humanize v1.0.1 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-jose/go-jose/v3 v3.0.1 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.20.2 // indirect github.com/go-openapi/jsonreference v0.20.4 // indirect - github.com/go-openapi/spec v0.20.13 // indirect - github.com/go-openapi/swag v0.22.7 // indirect + github.com/go-openapi/spec v0.20.14 // indirect + github.com/go-openapi/swag v0.22.9 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.16.0 // indirect + github.com/go-playground/validator/v10 v10.17.0 // indirect github.com/goccy/go-json v0.10.2 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/uuid v1.5.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect github.com/jackc/pgx/v4 v4.18.1 // indirect - github.com/jackc/pgx/v5 v5.5.1 // indirect + github.com/jackc/pgx/v5 v5.5.2 // indirect github.com/jackc/puddle/v2 v2.2.1 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.17.4 // indirect + github.com/klauspost/compress v1.17.5 // indirect github.com/klauspost/cpuid/v2 v2.2.6 // indirect - github.com/leodido/go-urn v1.2.4 // indirect + github.com/leodido/go-urn v1.3.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/minio/md5-simd v1.1.2 // indirect github.com/minio/sha256-simd v1.0.1 // indirect + github.com/moby/locker v1.0.1 // indirect + github.com/moby/sys/mountinfo v0.7.1 // indirect + github.com/moby/sys/sequential v0.5.0 // indirect + github.com/moby/sys/signal v0.7.0 // indirect + github.com/moby/sys/user v0.1.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0-rc6 // indirect + github.com/opencontainers/selinux v1.11.0 // indirect github.com/pelletier/go-toml/v2 v2.1.1 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/common v0.46.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/rs/xid v1.5.0 // indirect @@ -88,14 +114,23 @@ require ( github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e // indirect + go.opencensus.io v0.24.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect + go.opentelemetry.io/otel v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/arch v0.7.0 // indirect - golang.org/x/net v0.19.0 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.20.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.16.1 // indirect + golang.org/x/tools v0.17.0 // indirect google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto v0.0.0-20240125205218-1f4bbc51befe // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect + google.golang.org/grpc v1.61.0 // indirect google.golang.org/protobuf v1.32.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect ) diff --git a/go.sum b/go.sum index 160e843..8785fee 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,16 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= +github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20231105174938-2b5cbb29f3e2 h1:dIScnXFlF784X79oi7MzVT6GWqr/W1uUt0pB5CsDs9M= +github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20231105174938-2b5cbb29f3e2/go.mod h1:gCLVsLfv1egrcZu+GoJATN5ts75F2s62ih/457eWzOw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/hcsshim v0.12.0-rc.2 h1:gfKebjq3Mq17Ys+4cjE8vc2h6tZVeqCGb9a7vBVqpAk= +github.com/Microsoft/hcsshim v0.12.0-rc.2/go.mod h1:G2TZhBED5frlh/hsuxV5CDh/ylkSFknPAMPpQg9owQw= github.com/TheZeroSlave/zapsentry v1.20.2 h1:llgC91ZJdoU/OzGxYpUlEhKinf65mw9hJ2KkZ7+cGIk= github.com/TheZeroSlave/zapsentry v1.20.2/go.mod h1:D1YMfSuu6xnkhwFXxrronesmsiyDhIqo+86I3Ok+r64= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -17,6 +26,7 @@ github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1 github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE= github.com/bytedance/sonic v1.10.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= @@ -26,7 +36,23 @@ github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpV github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= github.com/chenzhuoyu/iasm v0.9.1 h1:tUHQJXo3NhBqw6s33wkGn9SP3bvrWLdlVIJ3hQBL7P0= github.com/chenzhuoyu/iasm v0.9.1/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/containerd/cgroups/v3 v3.0.3 h1:S5ByHZ/h9PMe5IOQoN7E+nMc2UcLEM/V48DGDJ9kip0= +github.com/containerd/cgroups/v3 v3.0.3/go.mod h1:8HBe7V3aWGLFPd/k03swSIsGjZhHI2WzJmticMgVuz0= +github.com/containerd/containerd v1.7.12 h1:+KQsnv4VnzyxWcfO9mlxxELaoztsDEjOuCMPAuPqgU0= +github.com/containerd/containerd v1.7.12/go.mod h1:/5OMpE1p0ylxtEUGY8kuCYkDRzJm9NO1TFMWjUpdevk= +github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8= +github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= +github.com/containerd/fifo v1.1.0 h1:4I2mbh5stb1u6ycIABlBw9zgtlK8viPI9QkQNRQEEmY= +github.com/containerd/fifo v1.1.0/go.mod h1:bmC4NWMbXlt2EZ0Hc7Fx7QzTFxgPID13eH0Qu+MAb2o= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= +github.com/containerd/ttrpc v1.2.2 h1:9vqZr0pxwOF5koz6N0N3kJ0zDHokrcPxIR/ZR2YFtOs= +github.com/containerd/ttrpc v1.2.2/go.mod h1:sIT6l32Ph/H9cvnJsfXM5drIVzTr5A2flTf1G5tYZak= +github.com/containerd/typeurl/v2 v2.1.1 h1:3Q4Pt7i8nYwy2KmQWIw2+1hTvwTE/6w9FqcttATPO/4= +github.com/containerd/typeurl/v2 v2.1.1/go.mod h1:IDp2JFvbwZ31H8dQbEIY7sDl2L3o3HZj1hsSQlywkQ0= github.com/coreos/go-oidc/v3 v3.9.0 h1:0J/ogVOd4y8P0f0xUh8l9t07xRP/d8tccvjHl2dcsSo= github.com/coreos/go-oidc/v3 v3.9.0/go.mod h1:rTKz2PYwftcrtoCzV5g5kvfJoWcm0Mk8AF8y1iAQro4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= @@ -40,14 +66,22 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c h1:+pKlWGMw7gf6bQ+oDZB4KHQFypsfjYlq/C4rfL7D3g8= +github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= -github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI= -github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/getsentry/sentry-go v0.26.0 h1:IX3++sF6/4B5JcevhdZfdKIHfyvMmAq/UnqcyT2H6mA= +github.com/getsentry/sentry-go v0.26.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/gin-contrib/cors v1.5.0 h1:DgGKV7DDoOn36DFkNtbHrjoRiT5ExCe+PC9/xp7aKvk= github.com/gin-contrib/cors v1.5.0/go.mod h1:TvU7MAZ3EwrPLI2ztzTt3tqgvBCq+wn8WpZmfADjupI= github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4= @@ -69,14 +103,19 @@ github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkc github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= -github.com/go-openapi/spec v0.20.13 h1:XJDIN+dLH6vqXgafnl5SUIMnzaChQ6QTo0/UPMbkIaE= -github.com/go-openapi/spec v0.20.13/go.mod h1:8EOhTpBoFiask8rrgwbLC3zmJfz4zsCUueRuPM6GNkw= -github.com/go-openapi/swag v0.22.7 h1:JWrc1uc/P9cSomxfnsFSVWoE1FW6bNbrVPmpQYpCcR8= -github.com/go-openapi/swag v0.22.7/go.mod h1:Gl91UqO+btAM0plGGxHqJcQZ1ZTy6jbmridBTsDy8A0= +github.com/go-openapi/spec v0.20.14 h1:7CBlRnw+mtjFGlPDRZmAMnq35cRzI91xj03HVyUi/Do= +github.com/go-openapi/spec v0.20.14/go.mod h1:8EOhTpBoFiask8rrgwbLC3zmJfz4zsCUueRuPM6GNkw= +github.com/go-openapi/swag v0.22.9 h1:XX2DssF+mQKM2DHsbgZK74y/zj4mo9I99+89xUmuZCE= +github.com/go-openapi/swag v0.22.9/go.mod h1:3/OXnFfnMAwBD099SwYRk7GD3xOrr1iL7d/XNLXVVwE= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= @@ -87,29 +126,53 @@ github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= -github.com/go-playground/validator/v10 v10.16.0 h1:x+plE831WK4vaKHO/jpgUGsvLKIqRRkz6M78GuJAfGE= -github.com/go-playground/validator/v10 v10.16.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-playground/validator/v10 v10.17.0 h1:SmVVlfAOtlZncTxRuinDPomC2DkXJ4E5T9gDA0AIH74= +github.com/go-playground/validator/v10 v10.17.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= -github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hibiken/asynq v0.24.1 h1:+5iIEAyA9K/lcSPvx3qoPtsKJeKI5u9aOIvUmSsazEw= github.com/hibiken/asynq v0.24.1/go.mod h1:u5qVeSbrnfT+vtG5Mq8ZPzQu/BmCKMHvTGb91uy9Tts= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= @@ -150,16 +213,17 @@ github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01C github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= -github.com/jackc/pgtype v1.14.0 h1:y+xUdabmyMkJLyApYuPj38mW+aAIqCe5uuBB51rH3Vw= github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgtype v1.14.1 h1:LyDar7M2K0tShCWqzJ/ctzF1QC3Wzc9c8a6cHE0PFdc= +github.com/jackc/pgtype v1.14.1/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= github.com/jackc/pgx/v4 v4.18.1 h1:YP7G1KABtKpB5IHrO9vYwSrCOhs7p3uqhvhhQBptya0= github.com/jackc/pgx/v4 v4.18.1/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE= -github.com/jackc/pgx/v5 v5.5.1 h1:5I9etrGkLrN+2XPCsi6XLlV5DITbSL/xBZdmAxFcXPI= -github.com/jackc/pgx/v5 v5.5.1/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= +github.com/jackc/pgx/v5 v5.5.2 h1:iLlpgp4Cp/gC9Xuscl7lFL1PhhW+ZLtXZcrfCt4C3tA= +github.com/jackc/pgx/v5 v5.5.2/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= @@ -175,9 +239,10 @@ github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8Hm github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= -github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= +github.com/klauspost/compress v1.17.5 h1:d4vBd+7CHydUqpFBgUEKkSdtSugf9YFmSkvUYPquI5E= +github.com/klauspost/compress v1.17.5/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= @@ -196,8 +261,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= -github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= +github.com/leodido/go-urn v1.3.0 h1:jX8FDLfW4ThVXctBNZ+3cIWnCSnrACDV73r76dy0aQQ= +github.com/leodido/go-urn v1.3.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -213,19 +278,35 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/minio-go/v7 v7.0.66 h1:bnTOXOHjOqv/gcMuiVbN9o2ngRItvqE774dG9nq0Dzw= github.com/minio/minio-go/v7 v7.0.66/go.mod h1:DHAgmyQEGdW3Cif0UooKOyrT3Vxs82zNdV6tkKhRtbs= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= +github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= +github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= +github.com/moby/sys/mountinfo v0.7.1 h1:/tTvQaSJRr2FshkhXiIpux6fQ2Zvc4j7tAhMTStAG2g= +github.com/moby/sys/mountinfo v0.7.1/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= +github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= +github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= +github.com/moby/sys/signal v0.7.0 h1:25RW3d5TnQEoKvRbEKUGay6DCQ46IxAVTT9CUMgmsSI= +github.com/moby/sys/signal v0.7.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn88Kg8Tg= +github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg= +github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.0-rc6 h1:XDqvyKsJEbRtATzkgItUqBA7QHk58yxX1Ov9HERHNqU= +github.com/opencontainers/image-spec v1.1.0-rc6/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= +github.com/opencontainers/runtime-spec v1.1.1-0.20230823135140-4fec88fd00a4 h1:EctkgBjZ1y4q+sibyuuIgiKpa0QSd2elFtSSdNvBVow= +github.com/opencontainers/runtime-spec v1.1.1-0.20230823135140-4fec88fd00a4/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU= +github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec= github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= @@ -239,15 +320,17 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= -github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= +github.com/prometheus/common v0.46.0 h1:doXzt5ybi1HBKpsZOL0sSkaNHJJqkyfEWZGGqqScV0Y= +github.com/prometheus/common v0.46.0/go.mod h1:Tp0qkxpb9Jsg54QMe+EAmqXkSV7Evdy1BTn+g2pa/hQ= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/redis/go-redis/v9 v9.0.3/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= -github.com/redis/go-redis/v9 v9.3.1 h1:KqdY8U+3X6z+iACvumCNxnoluToB+9Me+TvyFa21Mds= -github.com/redis/go-redis/v9 v9.3.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= +github.com/redis/go-redis/v9 v9.4.0 h1:Yzoz33UZw9I/mFhx4MNrB6Fk+XHO1VukNcCa1+lwyKk= +github.com/redis/go-redis/v9 v9.4.0/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -269,6 +352,7 @@ github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9Nz github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -288,7 +372,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= @@ -307,9 +390,21 @@ github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho= github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e h1:+SOyEddqYF09QP7vr7CgJ1eti3pY9Fn3LHO1M1r/0sI= github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= +go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= +go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= +go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= +go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= +go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -348,33 +443,52 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= -golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= +golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -385,16 +499,20 @@ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= @@ -417,28 +535,61 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= -golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20240125205218-1f4bbc51befe h1:USL2DhxfgRchafRvt/wYyyQNzwgL7ZiURcozOE/Pkvo= +google.golang.org/genproto v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:cc8bqMqtv9gMOr0zHg2Vzff5ULhhL2IXP4sbcn32Dro= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe h1:bQnxqljG/wqi4NTXu2+DJ3n7APcEA882QZ1JvhQAq9o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= +google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= @@ -461,8 +612,10 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/postgres v1.5.4 h1:Iyrp9Meh3GmbSuyIAGyjkN+n9K+GHX9b9MqsTL4EJCo= gorm.io/driver/postgres v1.5.4/go.mod h1:Bgo89+h0CRcdA33Y6frlaHHVuTdOf87pmyzwW9C/BH0= gorm.io/gorm v1.23.6/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= -gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= -gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/gorm v1.25.6 h1:V92+vVda1wEISSOMtodHVRcUIOPYa2tgQtyF+DfFx+A= +gorm.io/gorm v1.25.6/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= moul.io/zapgorm2 v1.3.0 h1:+CzUTMIcnafd0d/BvBce8T4uPn6DQnpIrz64cyixlkk= moul.io/zapgorm2 v1.3.0/go.mod h1:nPVy6U9goFKHR4s+zfSo1xVFaoU7Qgd5DoCdOfzoCqs= diff --git a/internal/api/runner/build.go b/internal/api/runner/build.go index aaf76f3..5d4348b 100644 --- a/internal/api/runner/build.go +++ b/internal/api/runner/build.go @@ -17,7 +17,7 @@ func (h *handler) Build(_ context.Context, t *asynq.Task) error { return fmt.Errorf("json.Unmarshal failed: %v: %w", err, asynq.SkipRetry) } - h.log.Info("build", zap.Any("payload", p)) + h.log.Debug("build", zap.Any("payload", p)) status, ctx := func() (e.Status, string) { url, status := h.storageService.Get(p.StorageKey, time.Second*60*5) diff --git a/internal/api/runner/judge.go b/internal/api/runner/judge.go index 3716e9e..83a2268 100644 --- a/internal/api/runner/judge.go +++ b/internal/api/runner/judge.go @@ -22,7 +22,7 @@ func (h *handler) Judge(_ context.Context, t *asynq.Task) error { } user := utils.RandomString(16) - h.log.Info("judge", zap.Any("payload", p), zap.String("user", user)) + h.log.Debug("judge", zap.Any("payload", p), zap.String("user", user)) status, point, ctx := func() (e.Status, int32, runner.JudgeStatus) { systemError := runner.JudgeStatus{ diff --git a/internal/model/config.go b/internal/model/config.go index b136ed6..d77fbe5 100644 --- a/internal/model/config.go +++ b/internal/model/config.go @@ -49,6 +49,10 @@ type ConfigStorage struct { Bucket string `yaml:"Bucket"` } +type ConfigRunner struct { + Address string `yaml:"Address"` +} + type ConfigMetrics struct { Namespace string `yaml:"Namespace"` Subsystem string `yaml:"Subsystem"` @@ -59,6 +63,7 @@ type Config struct { Redis ConfigRedis `yaml:"Redis"` Database ConfigDatabase `yaml:"Database"` Storage ConfigStorage `yaml:"Storage"` + Runner ConfigRunner `yaml:"Runner"` Metrics ConfigMetrics `yaml:"Metrics"` Development bool `yaml:"Development"` } diff --git a/internal/service/runner/common.go b/internal/service/runner/common.go index 9993d28..0f523ad 100644 --- a/internal/service/runner/common.go +++ b/internal/service/runner/common.go @@ -13,11 +13,15 @@ import ( var ( Prefix = "./resource/runner" ProblemDir = "./problem/" - ScriptsDir = "./scripts/" UserDir = "./user/" TmpDir = "./tmp/" ) +const ( + ContainerImageFull = "git.0x7f.app/woj/ubuntu-full:latest" + ContainerImageRun = "git.0x7f.app/woj/ubuntu-run:latest" +) + func init() { wd, err := os.Getwd() if err != nil { @@ -35,7 +39,7 @@ func (s *service) ProblemExists(version uint) bool { return file.Exist(problemPath) } -func (s *service) check(version uint, user string, lang string) e.Status { +func (s *service) ValidatePath(version uint, user string, lang string) e.Status { if !s.ProblemExists(version) { s.log.Info("problem not exists", zap.Uint("version", version)) return e.RunnerProblemNotExist @@ -50,7 +54,7 @@ func (s *service) check(version uint, user string, lang string) e.Status { return e.Success } -func (s *service) getLangInfo(config *Config, lang string) (configLanguage, bool) { +func (s *service) GetLangInfo(config *Config, lang string) (configLanguage, bool) { for _, l := range config.Languages { if l.Lang == lang { return l, true @@ -59,7 +63,7 @@ func (s *service) getLangInfo(config *Config, lang string) (configLanguage, bool return configLanguage{}, false } -func (s *service) getLangScript(l *configLanguage, lang string) string { +func (s *service) GetLangScript(l *configLanguage, lang string) string { if l.Type == "default" { return "/woj/framework/template/default/" + lang + ".Makefile" } else { diff --git a/internal/service/runner/compile.go b/internal/service/runner/compile.go index e4fca39..919c4ff 100644 --- a/internal/service/runner/compile.go +++ b/internal/service/runner/compile.go @@ -5,6 +5,7 @@ import ( "git.0x7f.app/WOJ/woj-server/internal/e" "git.0x7f.app/WOJ/woj-server/pkg/file" "git.0x7f.app/WOJ/woj-server/pkg/utils" + "github.com/opencontainers/runtime-spec/specs-go" "go.uber.org/zap" "io" "os" @@ -14,7 +15,7 @@ import ( func (s *service) Compile(version uint, user string, lang string) (JudgeStatus, e.Status) { // 1. ensure problem/user exists - status := s.check(version, user, lang) + status := s.ValidatePath(version, user, lang) if status != e.Success { return JudgeStatus{Message: "check failed"}, status } @@ -53,32 +54,50 @@ func (s *service) Compile(version uint, user string, lang string) (JudgeStatus, DoAny(func() error { return os.Remove(targetFile) }). Do(func() error { return file.TouchErr(targetFile) }). Do(func() error { - l, ok := s.getLangInfo(&config, lang) - script := s.getLangScript(&l, lang) + l, ok := s.GetLangInfo(&config, lang) + script := s.GetLangScript(&l, lang) if !ok { return e.RunnerProblemParseFailed.AsError() } - args := []string{ - "-v", fmt.Sprintf("%s:/woj/problem/judge:ro", judgeDir), - "-v", fmt.Sprintf("%s:/woj/user/%s.%s:ro", sourceFile, user, lang), - "-v", fmt.Sprintf("%s:/woj/user/%s.out", targetFile, user), - "-e", fmt.Sprintf("USER_PROG=%s", user), - "-e", fmt.Sprintf("LANG=%s", lang), - "git.0x7f.app/woj/ubuntu-full:latest", - "sh", "-c", fmt.Sprintf("cd /woj/user && make -f %s compile", script), - } - - runArgs := &podmanArgs{ - executeArgs: executeArgs{ - args: args, - timeout: 60 * time.Second, - output: log, + args := &RunArgs{ + Program: ProgramArgs{ + Args: []string{"sh", "-c", fmt.Sprintf("cd /woj/user && make -f %s compile", script)}, + Env: []string{fmt.Sprintf("USER_PROG=%s", user), fmt.Sprintf("LANG=%s", lang)}, + }, + Runtime: RuntimeArgs{ + Image: ContainerImageFull, + Memory: 256 * 1024 * 1024, // 256 MB + Timeout: time.Minute, + }, + IO: IOArgs{ + Output: log, + Limit: 4 * 1024, // 4 KB }, - memory: "256m", } - return s.podmanRun(runArgs) + args.Runtime.Mount = []specs.Mount{ + { + Source: judgeDir, + Destination: "/woj/problem/judge", + Type: "bind", + Options: []string{"rbind", "ro"}, + }, + { + Source: sourceFile, + Destination: fmt.Sprintf("/woj/user/%s.%s", user, lang), + Type: "bind", + Options: []string{"rbind", "ro"}, + }, + { + Source: targetFile, + Destination: fmt.Sprintf("/woj/user/%s.out", user), + Type: "bind", + Options: []string{"rbind"}, + }, + } + + return s.ContainerRun(args) }). Done() diff --git a/internal/service/runner/config.go b/internal/service/runner/config.go index 51fc1fa..d51ac3a 100644 --- a/internal/service/runner/config.go +++ b/internal/service/runner/config.go @@ -47,7 +47,7 @@ func (s *service) ParseConfig(version uint, skipCheck bool) (Config, error) { return config, nil } - err = s.checkConfig(&config, base) + err = s.ValidateConfig(&config, base) if err != nil { return Config{}, err } @@ -55,7 +55,7 @@ func (s *service) ParseConfig(version uint, skipCheck bool) (Config, error) { return config, nil } -func (s *service) checkConfig(config *Config, base string) error { +func (s *service) ValidateConfig(config *Config, base string) error { if config.Runtime.TimeLimit < 0 { return errors.New("time limit is negative") } diff --git a/internal/service/runner/container.go b/internal/service/runner/container.go new file mode 100644 index 0000000..3be2367 --- /dev/null +++ b/internal/service/runner/container.go @@ -0,0 +1,138 @@ +package runner + +import ( + "context" + "fmt" + "git.0x7f.app/WOJ/woj-server/pkg/file" + "git.0x7f.app/WOJ/woj-server/pkg/utils" + "github.com/containerd/containerd" + "github.com/containerd/containerd/cio" + "github.com/containerd/containerd/oci" + "github.com/opencontainers/runtime-spec/specs-go" + "go.uber.org/zap" + "io" + "os" + "syscall" + "time" +) + +type ProgramArgs struct { + Args []string + Env []string +} + +type RuntimeArgs struct { + Image string + Pid int64 + Memory uint64 + Timeout time.Duration + Mount []specs.Mount +} + +func (r *RuntimeArgs) Normalize() { + r.Pid = utils.If(r.Pid <= 0, 64, r.Pid) + r.Memory = utils.If(r.Memory <= 0, 128*1024*1024, r.Memory) + r.Timeout = utils.If(r.Timeout <= 0, time.Minute, r.Timeout) +} + +type IOArgs struct { + Output *os.File + // Limit is the max size of output in chars. + // if Limit = 0, output to stderr if verbose, discard output if not. + // if Limit < 0, discard output. + Limit int64 +} + +type RunArgs struct { + Program ProgramArgs + Runtime RuntimeArgs + IO IOArgs +} + +func (s *service) ContainerRun(arg *RunArgs) error { + identifier := fmt.Sprintf("%d", s.container.count.Add(1)) + + // prepare args + arg.Runtime.Normalize() + + // prepare output + var writer io.Writer = nil + if arg.IO.Limit == 0 && s.verbose { + writer = os.Stderr + } else if arg.IO.Limit > 0 && arg.IO.Output != nil { + writer = &file.LimitedWriter{ + File: arg.IO.Output, + Limit: arg.IO.Limit, + } + } + + // debug log + s.log.Debug("container started", zap.String("identifier", identifier), zap.Any("args", arg)) + defer func(identifier string) { + s.log.Debug("container finished", zap.String("identifier", identifier)) + }(identifier) + + // get image + image, err := s.container.client.GetImage(s.container.ctx, arg.Runtime.Image) + // TODO: we could cache the image struct + if err != nil { + return err + } + + // create container + container, err := s.container.client.NewContainer(s.container.ctx, "task-"+identifier, + containerd.WithNewSnapshot("snapshot-"+identifier, image), + containerd.WithNewSpec( + oci.WithImageConfig(image), + oci.WithMemoryLimit(arg.Runtime.Memory), + oci.WithPidsLimit(arg.Runtime.Pid), + oci.WithMounts(arg.Runtime.Mount), + oci.WithProcessArgs(arg.Program.Args...), + oci.WithEnv(arg.Program.Env), + ), + ) + if err != nil { + return err + } + defer func(container containerd.Container, ctx context.Context, opts ...containerd.DeleteOpts) { + _ = container.Delete(ctx, opts...) + }(container, s.container.ctx, containerd.WithSnapshotCleanup) + + // create task + task, err := container.NewTask(s.container.ctx, cio.NewCreator(cio.WithStreams(nil, writer, writer))) + if err != nil { + return err + } + defer func(task containerd.Task, ctx context.Context, opts ...containerd.ProcessDeleteOpts) { + _, _ = task.Delete(ctx, opts...) + }(task, s.container.ctx, containerd.WithProcessKill) + + // wait + ctx2, cancel := context.WithTimeout(s.container.ctx, arg.Runtime.Timeout) + defer cancel() + exitStatusC, err := task.Wait(ctx2) + if err != nil { + return err + } + + // start + err = task.Start(s.container.ctx) + if err != nil { + return err + } + + // kill on timeout + status := <-exitStatusC + code, _, _ := status.Result() + if code == containerd.UnknownExitStatus { + // containerd is C/S architecture, timeout means grpc timeout, resulting in unknown exit status + // manually kill the task + s.log.Debug("container timeout", zap.String("identifier", identifier)) + err := task.Kill(s.container.ctx, syscall.SIGKILL) + if err != nil { + return err + } + } + + return nil +} diff --git a/internal/service/runner/deps.go b/internal/service/runner/deps.go index 941b413..e8a913c 100644 --- a/internal/service/runner/deps.go +++ b/internal/service/runner/deps.go @@ -1,42 +1,56 @@ package runner import ( + "compress/gzip" "errors" - "fmt" "git.0x7f.app/WOJ/woj-server/internal/e" "git.0x7f.app/WOJ/woj-server/pkg/file" "git.0x7f.app/WOJ/woj-server/pkg/utils" + "github.com/containerd/containerd" "go.uber.org/zap" "os" "path/filepath" ) type depConfig struct { - tarball string - image string - dockerfile string + tarball string + image string } -func (s *service) loadImage(cfg *depConfig) e.Status { +func (s *service) LoadImageFromTarball(path string) error { + if !file.Exist(path) { + return errors.New("tarball not exists") + } + + f, err := os.Open(path) + if err != nil { + return err + } + defer func(f *os.File) { + _ = f.Close() + }(f) + + g, err := gzip.NewReader(f) + if err != nil { + return err + } + defer func(g *gzip.Reader) { + _ = g.Close() + }(g) + + _, err = s.container.client.Import(s.container.ctx, g) + return err +} + +func (s *service) LoadImageFromRegistry(image string) error { + _, err := s.container.client.Pull(s.container.ctx, image, containerd.WithPullUnpack) + return err +} + +func (s *service) LoadImage(cfg *depConfig) e.Status { err := utils.NewTryErr(). - Try(func() error { - // import from tarball - if !file.Exist(cfg.tarball) { - return errors.New("tarball not exists") - } - return s.execute("bash", "-c", fmt.Sprintf("gzip -d -c %s | podman load", cfg.tarball)) - }). - Or(func() error { - // pull from docker hub - return s.execute("podman", "pull", cfg.image) - }). - Or(func() error { - // build from dockerfile - if !file.Exist(cfg.dockerfile) { - return errors.New("dockerfile not exists") - } - return s.execute("podman", "build", "-f", cfg.dockerfile, "-t", cfg.image, ".") - }). + Try(func() error { return s.LoadImageFromTarball(cfg.tarball) }). + Or(func() error { return s.LoadImageFromRegistry(cfg.image) }). Done() if err != nil { @@ -59,21 +73,19 @@ func (s *service) EnsureDeps(force bool) e.Status { // full fullImage := &depConfig{ - tarball: filepath.Join(TmpDir, "ubuntu-full.tar.gz"), - image: "git.0x7f.app/woj/ubuntu-full:latest", - dockerfile: filepath.Join(ScriptsDir, "ubuntu-full.Dockerfile"), + tarball: filepath.Join(TmpDir, "ubuntu-full.tar.gz"), + image: ContainerImageFull, } - if s.loadImage(fullImage) != e.Success { + if s.LoadImage(fullImage) != e.Success { return e.RunnerDepsBuildFailed } // tiny tinyImage := &depConfig{ - tarball: filepath.Join(TmpDir, "ubuntu-tiny.tar.gz"), - image: "git.0x7f.app/woj/ubuntu-run:latest", - dockerfile: filepath.Join(ScriptsDir, "ubuntu-run.Dockerfile"), + tarball: filepath.Join(TmpDir, "ubuntu-tiny.tar.gz"), + image: ContainerImageRun, } - if s.loadImage(tinyImage) != e.Success { + if s.LoadImage(tinyImage) != e.Success { return e.RunnerDepsBuildFailed } diff --git a/internal/service/runner/exec.go b/internal/service/runner/exec.go deleted file mode 100644 index 79dd522..0000000 --- a/internal/service/runner/exec.go +++ /dev/null @@ -1,111 +0,0 @@ -package runner - -import ( - "context" - "errors" - "fmt" - "git.0x7f.app/WOJ/woj-server/pkg/file" - "git.0x7f.app/WOJ/woj-server/pkg/utils" - "go.uber.org/zap" - "os" - "os/exec" - "time" -) - -func (s *service) execute(exe string, args ...string) error { - cmd := exec.Command(exe, args...) - cmd.Dir = Prefix - if s.verbose { - cmd.Stdout = os.Stderr - cmd.Stderr = os.Stderr - } - return cmd.Run() -} - -type executeArgs struct { - exe string - args []string - - timeout time.Duration - kill func() error - - output *os.File - limit int64 -} - -func (s *service) executeTimeout(arg *executeArgs) error { - ctx, cancel := context.WithTimeout(context.Background(), arg.timeout) - defer cancel() - - cmd := exec.CommandContext(ctx, arg.exe, arg.args...) - cmd.Dir = Prefix - if arg.kill != nil { - cmd.Cancel = arg.kill - } - if s.verbose && arg.output == nil { - cmd.Stdout = os.Stderr - cmd.Stderr = os.Stderr - } else if arg.output != nil { - if arg.limit == 0 { - cmd.Stdout = arg.output - cmd.Stderr = arg.output - } else { - lw := &file.LimitedWriter{ - File: arg.output, - Limit: arg.limit, - } - cmd.Stdout = lw - cmd.Stderr = lw - } - } - - err := cmd.Start() - if err != nil { - return err - } - - err = cmd.Wait() - - // make sure the process is killed - _ = cmd.Process.Kill() - - if errors.Is(ctx.Err(), context.DeadlineExceeded) { - return fmt.Errorf("command timed out") - } - - return err -} - -type podmanArgs struct { - executeArgs - memory string -} - -func (s *service) podmanRun(arg *podmanArgs) error { - name := fmt.Sprintf("woj-%d-%s", time.Now().UnixNano(), utils.RandomString(8)) - execArgs := &executeArgs{ - exe: "podman", - output: utils.If(arg.output == nil, os.Stderr, arg.output), - limit: utils.If(arg.limit == 0, 4*1024, arg.limit), - timeout: utils.If(arg.timeout == 0, 10*time.Second, arg.timeout), - kill: func() error { - s.log.Warn("[podman] timeout killer", zap.String("name", name)) - if arg.kill != nil { - _ = arg.kill() - } - return s.execute("podman", "kill", name) - }, - } - - args := []string{ - "run", - "--rm", - "--name", name, - "--memory", utils.If(arg.memory == "", "256m", arg.memory), - } - args = append(args, arg.args...) - - execArgs.args = args - - return s.executeTimeout(execArgs) -} diff --git a/internal/service/runner/new_problem.go b/internal/service/runner/new_problem.go index 2d89b77..687002e 100644 --- a/internal/service/runner/new_problem.go +++ b/internal/service/runner/new_problem.go @@ -6,13 +6,14 @@ import ( "git.0x7f.app/WOJ/woj-server/pkg/down" "git.0x7f.app/WOJ/woj-server/pkg/file" "git.0x7f.app/WOJ/woj-server/pkg/unzip" + "github.com/opencontainers/runtime-spec/specs-go" "go.uber.org/zap" "os" "path/filepath" "time" ) -func (s *service) download(version uint, url string) e.Status { +func (s *service) DownloadProblem(version uint, url string) e.Status { zipPath := filepath.Join(TmpDir, fmt.Sprintf("%d.zip", version)) problemPath := filepath.Join(ProblemDir, fmt.Sprintf("%d", version)) @@ -31,7 +32,7 @@ func (s *service) download(version uint, url string) e.Status { return e.Success } -func (s *service) prebuild(version uint, force bool) e.Status { +func (s *service) PrebuildProblem(version uint, force bool) e.Status { if !s.ProblemExists(version) { return e.RunnerProblemNotExist } @@ -52,21 +53,32 @@ func (s *service) prebuild(version uint, force bool) e.Status { dataDir := filepath.Join(ProblemDir, fmt.Sprintf("%d", version), "data") judgeDir := filepath.Join(ProblemDir, fmt.Sprintf("%d", version), "judge") - args := []string{ - "-v", fmt.Sprintf("%s:/woj/problem/data", dataDir), - "-v", fmt.Sprintf("%s:/woj/problem/judge", judgeDir), - "-e", "PREFIX=/woj/problem", - "git.0x7f.app/woj/ubuntu-full:latest", - "sh", "-c", "cd /woj/problem/judge && make -f prebuild.Makefile prebuild && touch .mark.prebuild", - } - runArgs := &podmanArgs{ - executeArgs: executeArgs{ - args: args, - timeout: 300 * time.Second, + args := &RunArgs{ + Program: ProgramArgs{ + Args: []string{"sh", "-c", "cd /woj/problem/judge && make -f prebuild.Makefile prebuild && touch .mark.prebuild"}, + }, + Runtime: RuntimeArgs{ + Image: ContainerImageFull, + Memory: 256 * 1024 * 1024, // 256MB + Timeout: 5 * time.Minute, }, - memory: "1g", } - err := s.podmanRun(runArgs) + args.Runtime.Mount = []specs.Mount{ + { + Source: dataDir, + Destination: "/woj/problem/data", + Type: "bind", + Options: []string{"rbind"}, + }, + { + Source: judgeDir, + Destination: "/woj/problem/judge", + Type: "bind", + Options: []string{"rbind"}, + }, + } + + err := s.ContainerRun(args) if err != nil { s.log.Warn("[new] prebuild problem failed", zap.Error(err), zap.Uint("version", version)) @@ -83,7 +95,7 @@ func (s *service) NewProblem(version uint, url string, force bool) (Config, e.St } if !s.ProblemExists(version) { - status := s.download(version, url) + status := s.DownloadProblem(version, url) if status != e.Success { return Config{}, status } @@ -95,7 +107,7 @@ func (s *service) NewProblem(version uint, url string, force bool) (Config, e.St return Config{}, e.RunnerProblemParseFailed } - status := s.prebuild(version, true) + status := s.PrebuildProblem(version, true) if status != e.Success { return Config{}, status } diff --git a/internal/service/runner/run_judge.go b/internal/service/runner/run_judge.go index efbf9ea..c1cbf36 100644 --- a/internal/service/runner/run_judge.go +++ b/internal/service/runner/run_judge.go @@ -5,18 +5,38 @@ import ( "git.0x7f.app/WOJ/woj-server/internal/e" "git.0x7f.app/WOJ/woj-server/pkg/file" "git.0x7f.app/WOJ/woj-server/pkg/utils" + "github.com/opencontainers/runtime-spec/specs-go" "go.uber.org/zap" "os" "path/filepath" + "strings" "time" ) -func (s *service) problemRun(version uint, user string, lang string, config *Config) { +func (s *service) SandboxArgsBuilder(config *Config, user string, lang string, id int) string { + var args []string + + args = append(args, fmt.Sprintf("--memory_limit=%d", config.Runtime.MemoryLimit)) + args = append(args, fmt.Sprintf("--nproc_limit=%d", config.Runtime.NProcLimit)) + args = append(args, fmt.Sprintf("--time_limit=%d", config.Runtime.TimeLimit)) + args = append(args, fmt.Sprintf("--sandbox_template=%s", lang)) + args = append(args, fmt.Sprintf("--sandbox_action=ret")) + args = append(args, fmt.Sprintf("--uid=1000")) + args = append(args, fmt.Sprintf("--gid=1000")) + args = append(args, fmt.Sprintf("--file_input=/woj/problem/data/input/%d.input", id)) + args = append(args, fmt.Sprintf("--file_output=/woj/user/%d.out.usr", id)) + args = append(args, fmt.Sprintf("--file_info=/woj/user/%d.info", id)) + args = append(args, fmt.Sprintf("--program=/woj/user/%s.out", user)) + + return strings.Join(args, " ") +} + +func (s *service) ProblemRun(version uint, user string, lang string, config *Config) { workDir := filepath.Join(UserDir, user) dataDir := filepath.Join(ProblemDir, fmt.Sprintf("%d", version), "data", "input") - // woj-sandbox killer will add 2 more seconds, here we add 2 more seconds - timeout := time.Duration((config.Runtime.TimeLimit+1000)/1000+2+2) * time.Second + // woj-sandbox killer will add 1 more second, here we add 1 also + timeout := time.Duration((config.Runtime.TimeLimit+1000)/1000+1+1) * time.Second ids := make([]int, 0) for _, task := range config.Tasks { @@ -27,51 +47,55 @@ func (s *service) problemRun(version uint, user string, lang string, config *Con ansFile := filepath.Join(workDir, fmt.Sprintf("%d.out.usr", id)) ifoFile := filepath.Join(workDir, fmt.Sprintf("%d.info", id)) + args := &RunArgs{ + Program: ProgramArgs{ + Args: []string{ + "sh", "-c", + "cd /woj/user && /woj/framework/scripts/woj_launcher " + + s.SandboxArgsBuilder(config, user, lang, id), + }, + }, + Runtime: RuntimeArgs{ + Image: ContainerImageRun, + // sh, woj_launcher:program, woj_launcher:killer, woj_launcher:stat + Pid: int64(config.Runtime.NProcLimit + 4), + Memory: uint64(config.Runtime.MemoryLimit * 1024 * 1024), + Timeout: timeout, + }, + } + args.Runtime.Mount = []specs.Mount{ + { + Source: testCase, + Destination: fmt.Sprintf("/woj/problem/data/input/%d.input", id), + Type: "bind", + Options: []string{"rbind", "ro"}, + }, + { + Source: targetFile, + Destination: fmt.Sprintf("/woj/user/%s.out", user), + Type: "bind", + Options: []string{"rbind", "ro"}, + }, + { + Source: ansFile, + Destination: fmt.Sprintf("/woj/user/%d.out.usr", id), + Type: "bind", + Options: []string{"rbind"}, + }, + { + Source: ifoFile, + Destination: fmt.Sprintf("/woj/user/%d.info", id), + Type: "bind", + Options: []string{"rbind"}, + }, + } + err := utils.NewMust(). DoAny(func() error { return os.Remove(ansFile) }). DoAny(func() error { return os.Remove(ifoFile) }). Do(func() error { return file.TouchErr(ansFile) }). Do(func() error { return file.TouchErr(ifoFile) }). - Do(func() error { - args := []string{ - "--cpus", "1", - "--network", "none", - "-v", fmt.Sprintf("%s:/woj/problem/data/input/%d.input:ro", testCase, id), - "-v", fmt.Sprintf("%s:/woj/user/%s.out:ro", targetFile, user), - "-v", fmt.Sprintf("%s:/woj/user/%d.out.usr", ansFile, id), - "-v", fmt.Sprintf("%s:/woj/user/%d.info", ifoFile, id), - "git.0x7f.app/woj/ubuntu-run:latest", - "sh", "-c", - fmt.Sprintf("cd /woj/user && /woj/framework/scripts/woj_launcher "+ - "--memory_limit=%d "+ - "--nproc_limit=%d "+ - "--time_limit=%d "+ - "--sandbox_template=%s "+ - "--sandbox_action=ret "+ - "--uid=1000 "+ - "--gid=1000 "+ - "--file_input=/woj/problem/data/input/%d.input "+ - "--file_output=/woj/user/%d.out.usr "+ - "--file_info=/woj/user/%d.info "+ - "-program=/woj/user/%s.out", - config.Runtime.MemoryLimit, - config.Runtime.NProcLimit, - config.Runtime.TimeLimit, - lang, - id, id, id, - user, - ), - } - - runArgs := &podmanArgs{ - executeArgs: executeArgs{ - args: args, - timeout: timeout, - }, - } - - return s.podmanRun(runArgs) - }). + Do(func() error { return s.ContainerRun(args) }). Done() if err != nil { @@ -94,7 +118,7 @@ func (s *service) problemRun(version uint, user string, lang string, config *Con } } -func (s *service) problemJudge(version uint, user string, lang string, config *Config) { +func (s *service) ProblemJudge(version uint, user string, lang string, config *Config) { workDir := filepath.Join(UserDir, user) dataDir := filepath.Join(ProblemDir, fmt.Sprintf("%d", version), "data") judgeDir := filepath.Join(ProblemDir, fmt.Sprintf("%d", version), "judge") @@ -106,35 +130,57 @@ func (s *service) problemJudge(version uint, user string, lang string, config *C ansFile := filepath.Join(workDir, fmt.Sprintf("%d.out.usr", id)) jdgFile := filepath.Join(workDir, fmt.Sprintf("%d.judge", id)) - c, ok := s.getLangInfo(config, lang) + c, ok := s.GetLangInfo(config, lang) if !ok { return } + args := &RunArgs{ + Program: ProgramArgs{ + Args: []string{ + "sh", "-c", + fmt.Sprintf("cd /woj/user && make -f %s judge", s.GetLangScript(&c, lang)), + }, + Env: []string{ + fmt.Sprintf("TEST_NUM=%d", id), + fmt.Sprintf("CMP=%s", c.Cmp), + }, + }, + Runtime: RuntimeArgs{ + Image: ContainerImageFull, + }, + } + args.Runtime.Mount = []specs.Mount{ + { + Source: judgeDir, + Destination: "/woj/problem/judge", + Type: "bind", + Options: []string{"rbind", "ro"}, + }, + { + Source: dataDir, + Destination: "/woj/problem/data", + Type: "bind", + Options: []string{"rbind", "ro"}, + }, + { + Source: ansFile, + Destination: fmt.Sprintf("/woj/user/%d.out.usr", id), + Type: "bind", + Options: []string{"rbind"}, + }, + { + Source: jdgFile, + Destination: fmt.Sprintf("/woj/user/%d.judge", id), + Type: "bind", + Options: []string{"rbind"}, + }, + } + err := utils.NewMust(). DoAny(func() error { return os.Remove(jdgFile) }). Do(func() error { return file.TouchErr(jdgFile) }). - Do(func() error { - args := []string{ - "-v", fmt.Sprintf("%s:/woj/problem/judge:ro", judgeDir), - "-v", fmt.Sprintf("%s:/woj/problem/data:ro", dataDir), - "-v", fmt.Sprintf("%s:/woj/user/%d.out.usr", ansFile, id), - "-v", fmt.Sprintf("%s:/woj/user/%d.judge", jdgFile, id), - "-e", fmt.Sprintf("TEST_NUM=%d", id), - "-e", fmt.Sprintf("CMP=%s", c.Cmp), - "git.0x7f.app/woj/ubuntu-full:latest", - "sh", "-c", - fmt.Sprintf("cd /woj/user && make -f %s judge", s.getLangScript(&c, lang)), - } - - runArgs := &podmanArgs{ - executeArgs: executeArgs{ - args: args, - }, - } - - return s.podmanRun(runArgs) - }). + Do(func() error { return s.ContainerRun(args) }). Done() if err != nil { @@ -159,7 +205,7 @@ func (s *service) problemJudge(version uint, user string, lang string, config *C func (s *service) RunAndJudge(version uint, user string, lang string) (JudgeStatus, int32, e.Status) { // 1. ensure problem/user exists - status := s.check(version, user, lang) + status := s.ValidatePath(version, user, lang) if status != e.Success { return JudgeStatus{Message: "check failed"}, 0, status } @@ -171,10 +217,10 @@ func (s *service) RunAndJudge(version uint, user string, lang string) (JudgeStat } // 3. run user program - s.problemRun(version, user, lang, &config) + s.ProblemRun(version, user, lang, &config) // 4. run judger - s.problemJudge(version, user, lang, &config) + s.ProblemJudge(version, user, lang, &config) // 5. check result result, pts := s.checkResults(user, &config) diff --git a/internal/service/runner/service.go b/internal/service/runner/service.go index 6c3c97b..ab5c826 100644 --- a/internal/service/runner/service.go +++ b/internal/service/runner/service.go @@ -1,14 +1,18 @@ package runner import ( + "context" "git.0x7f.app/WOJ/woj-server/internal/e" "git.0x7f.app/WOJ/woj-server/internal/misc/config" "git.0x7f.app/WOJ/woj-server/internal/misc/log" "git.0x7f.app/WOJ/woj-server/pkg/pool" "git.0x7f.app/WOJ/woj-server/pkg/utils" + "github.com/containerd/containerd" + "github.com/containerd/containerd/namespaces" "github.com/samber/do" "go.uber.org/zap" "runtime" + "sync/atomic" ) var _ Service = (*service)(nil) @@ -35,20 +39,36 @@ type Service interface { func NewService(i *do.Injector) (Service, error) { concurrency := utils.If(runtime.NumCPU() > 1, runtime.NumCPU()-1, 1) + cfg := do.MustInvoke[config.Service](i).GetConfig() srv := &service{ log: do.MustInvoke[log.Service](i).GetLogger("runner"), pool: pool.NewTaskPool(concurrency, concurrency), - verbose: do.MustInvoke[config.Service](i).GetConfig().Development, + verbose: cfg.Development, } - srv.pool.Start() + var err error + srv.container.client, err = containerd.New(cfg.Runner.Address) + if err != nil { + srv.log.Error("failed to connect to containerd", zap.Error(err)) + return nil, err + } + + srv.container.ctx = namespaces.WithNamespace(context.Background(), "woj") + srv.container.count.Store(0) + + srv.pool.Start() return srv, nil } type service struct { - log *zap.Logger - pool *pool.TaskPool + log *zap.Logger + pool *pool.TaskPool + container struct { + client *containerd.Client + ctx context.Context + count atomic.Uint64 + } verbose bool } @@ -58,5 +78,10 @@ func (s *service) HealthCheck() error { func (s *service) Shutdown() error { s.pool.Stop() + if s.container.client != nil { + // TODO: wait and kill all containers + _ = s.container.client.Close() + } + return nil } diff --git a/resource/runner/scripts/common.sh b/resource/runner/scripts/common.sh index 408ed96..76a2ef5 100755 --- a/resource/runner/scripts/common.sh +++ b/resource/runner/scripts/common.sh @@ -9,9 +9,6 @@ function log_info() { echo -e "${COLOR_GREEN}$*${COLOR_NONE}" 1>&2; } function log_warn() { echo -e "${COLOR_YELLOW}$*${COLOR_NONE}" 1>&2; } function log_error() { echo -e "${COLOR_RED}$*${COLOR_NONE}" 1>&2; } -# Docker or Podman -DOCKER="podman" -if [ "$USE_DOCKER" ]; then - log_error "docker is deprecated" - log_info "Use podman instead" +if [ -z "$DOCKER" ]; then + DOCKER="nerdctl" fi diff --git a/resource/runner/scripts/ubuntu-run.Dockerfile b/resource/runner/scripts/ubuntu-run.Dockerfile index 9221fec..aefef83 100644 --- a/resource/runner/scripts/ubuntu-run.Dockerfile +++ b/resource/runner/scripts/ubuntu-run.Dockerfile @@ -1,11 +1,7 @@ -FROM woj/ubuntu-full:latest AS builder +FROM git.0x7f.app/woj/ubuntu-full:latest AS builder FROM docker.io/library/ubuntu:22.04 WORKDIR /woj RUN mkdir -p /woj/framework/scripts COPY --from=builder /woj/framework/scripts/woj_launcher /woj/framework/scripts/ - -# Add User -RUN groupadd -g 1000 woj && useradd -M -u 1000 -g 1000 woj -