diff --git a/CHANGELOG.md b/CHANGELOG.md index 6867097..51e18fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - xxxx-xx-xx ### Added -- Added remote mode for Mojang's textures queue. +- Remote mode for Mojang's textures queue with a new configuration params: `MOJANG_TEXTURES_UUIDS_PROVIDER_DRIVER` and + `MOJANG_TEXTURES_UUIDS_PROVIDER_URL`. + + For example, to send requests directly to [Mojang's APIs](https://wiki.vg/Mojang_API#Username_-.3E_UUID_at_time), + set the next configuration: + - `MOJANG_TEXTURES_UUIDS_PROVIDER_DRIVER=remote` + - `MOJANG_TEXTURES_UUIDS_PROVIDER_URL=https://api.mojang.com/users/profiles/minecraft/` +- Implemented worker mode. The app starts with the only one API endpoint: `/api/worker/mojang-uuid/{username}`, + which is compatible with [Mojang's endpoint](https://wiki.vg/Mojang_API#Username_-.3E_UUID_at_time) to exchange + username to its UUID. It can be used with some load balancing software to increase throughput of Mojang's textures + proxy by splitting the load across multiple servers with its own IPs. + - New StatsD metrics: - Counters: - `ely.skinsystem.{hostname}.app.mojang_textures.usernames.textures_hit` @@ -14,10 +25,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - `ely.skinsystem.{hostname}.app.mojang_textures.usernames.iteration_size` and - `ely.skinsystem.{hostname}.app.mojang_textures.usernames.queue_size` are now updated even if the queue is empty. + `ely.skinsystem.{hostname}.app.mojang_textures.usernames.queue_size` are now updates even if the queue is empty. ### Changed -- Event `ely.skinsystem.{hostname}.app.mojang_textures.already_in_queue` has been renamed into `ely.skinsystem.{hostname}.app.mojang_textures.already_scheduled`. +- **BREAKING**: `QUEUE_LOOP_DELAY` param is now sets as a Go duration, not milliseconds. + For example, default value is now `2s500ms`. +- **BREAKING**: Event `ely.skinsystem.{hostname}.app.mojang_textures.already_in_queue` has been renamed into + `ely.skinsystem.{hostname}.app.mojang_textures.already_scheduled`. ## [4.3.0] - 2019-11-08 ### Added diff --git a/README.md b/README.md index 60b2b88..98a14a2 100644 --- a/README.md +++ b/README.md @@ -57,12 +57,80 @@ docker-compose up -d app **Variables to adjust:** -| ENV | Description | Example | -|--------------------|-------------------------------------------------------------------------------------------------|-------------------------------------------| -| STORAGE_REDIS_POOL | By default, Chrly creates pool with 10 connection, but you may want to increase it | `20` | -| STATSD_ADDR | StatsD can be used to collect metrics | `localhost:8125` | -| SENTRY_DSN | Sentry can be used to collect app errors | `https://public:private@your.sentry.io/1` | -| QUEUE_LOOP_DELAY | Parameter is sets the delay before each iteration of the Mojang's textures queue (milliseconds) | `3200` | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ENVDescriptionExample
STORAGE_REDIS_HOST + By default, Chrly tries to connect to the redis host + (by service name in docker-compose configuration). + localhost
STORAGE_REDIS_PORT + Specifies the Redis connection port. + 6379
STORAGE_REDIS_POOLBy default, Chrly creates pool with 10 connection, but you may want to increase it20
STATSD_ADDRStatsD can be used to collect metricslocalhost:8125
SENTRY_DSNSentry can be used to collect app errorshttps://public:private@your.sentry.io/1
QUEUE_LOOP_DELAY + Parameter is sets the delay before each iteration of the Mojang's textures queue + (Go's duration) + 3s200ms
QUEUE_BATCH_SIZE + Sets the count of usernames, which will be sent to the + Mojang's API to exchange them to their UUIDs. + The current limit is 10, but it may change in the future, so you may want to adjust it. + 10
MOJANG_TEXTURES_UUIDS_PROVIDER_DRIVER + Specifies the preferred provider of the Mojang's UUIDs. Takes remote value. + In any other case, the local queue will be used. + remote
MOJANG_TEXTURES_UUIDS_PROVIDER_URL + When the UUIDs driver set to remote, sets the remote URL. + The trailing slash won't cause any problems. + http://remote-provider.com/api/worker/mojang-uuid
If something goes wrong, you can always access logs by executing `docker-compose logs -f app`. diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index ca4e940..fa306ac 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -20,6 +20,15 @@ services: environment: CHRLY_SECRET: replace_this_value_in_production + # Use this configuration in case when you need a remote Mojang UUIDs provider + # worker: + # image: elyby/chrly + # hostname: chrly0 + # restart: always + # ports: + # - "8080:80" + # command: ["worker"] + redis: image: redis:4.0-32bit # 32-bit version is recommended to spare some memory restart: always diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index de3fa34..cefed94 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -5,7 +5,7 @@ if [ ! -d /data/capes ]; then mkdir -p /data/capes fi -if [ "$1" = "serve" ] || [ "$1" = "token" ] || [ "$1" = "version" ]; then +if [ "$1" = "serve" ] || [ "$1" = "worker" ] || [ "$1" = "token" ] || [ "$1" = "version" ]; then set -- /usr/local/bin/chrly "$@" fi diff --git a/http/skinsystem.go b/http/skinsystem.go index c7fc2a9..2e2d80f 100644 --- a/http/skinsystem.go +++ b/http/skinsystem.go @@ -97,7 +97,7 @@ type Skinsystem struct { } func (ctx *Skinsystem) Run() error { - ctx.Logger.Info(fmt.Sprintf("Starting, HTTP on: %s\n", ctx.ListenSpec)) + ctx.Logger.Info(fmt.Sprintf("Starting the app, HTTP on: %s\n", ctx.ListenSpec)) listener, err := net.Listen("tcp", ctx.ListenSpec) if err != nil { diff --git a/http/uuids_worker.go b/http/uuids_worker.go index 5d08df5..4765343 100644 --- a/http/uuids_worker.go +++ b/http/uuids_worker.go @@ -26,7 +26,7 @@ type UUIDsWorker struct { } func (ctx *UUIDsWorker) Run() error { - ctx.Logger.Info(fmt.Sprintf("Starting, HTTP on: %s\n", ctx.ListenSpec)) + ctx.Logger.Info(fmt.Sprintf("Starting the worker, HTTP on: %s\n", ctx.ListenSpec)) listener, err := net.Listen("tcp", ctx.ListenSpec) if err != nil {