Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lila-fishnet v3 - new implementation with typelevel stack #247

Merged
merged 72 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
0d34f81
Start lila-fishnet v2
lenguyenthanh Nov 15, 2023
9c923be
Update workflow
lenguyenthanh Nov 15, 2023
146b72b
Clean app config
lenguyenthanh Nov 15, 2023
9b1c0bb
Impelement Executor + 1 test
lenguyenthanh Nov 15, 2023
792bf4c
Add more tests & one test is failed
lenguyenthanh Nov 16, 2023
aba5bba
Move work back to queue it is not outoftries
lenguyenthanh Nov 16, 2023
3fdcaac
Refactor tests and add tests for outOftries logic
lenguyenthanh Nov 16, 2023
b872db4
Better test names
lenguyenthanh Nov 16, 2023
eae6a3f
Clean up Work models
lenguyenthanh Nov 17, 2023
6e538c2
Implement State
lenguyenthanh Nov 18, 2023
3f367da
Start implement test for State
lenguyenthanh Nov 19, 2023
98fc440
Refactor State as Trait
lenguyenthanh Nov 19, 2023
d7a74f1
Port logic from MoveDb
lenguyenthanh Nov 19, 2023
d400a78
Remove joda time, use java.time.Instant
lenguyenthanh Nov 19, 2023
9666b84
Purify Work creation & makeId
lenguyenthanh Nov 19, 2023
714b0d1
Move acquiredAt creation to IO
lenguyenthanh Nov 19, 2023
d28d01b
Remove lastAcquiredKey, reuse key from acquired
lenguyenthanh Nov 19, 2023
615785c
Implement http routes
lenguyenthanh Nov 19, 2023
3e12680
Setup http server with http4s
lenguyenthanh Nov 19, 2023
922eb8a
Implement Client with Redis
lenguyenthanh Nov 19, 2023
17ea153
Try Redis subscribe
lenguyenthanh Nov 20, 2023
aa19772
Redis subscribe works
lenguyenthanh Nov 20, 2023
9d98b42
Add sbtopts to fix sbt-dotenv Illegal reflective access
lenguyenthanh Nov 20, 2023
493b723
Refactor RedisSubscriberJob and App
lenguyenthanh Nov 20, 2023
36a1527
Clean models
lenguyenthanh Nov 20, 2023
5b0d445
Acquire endpoint works
lenguyenthanh Nov 20, 2023
dd63533
Clean up Work's models and add WorkResponse
lenguyenthanh Nov 20, 2023
381ff3b
Rename UserRoutes to FishnetRoutes
lenguyenthanh Nov 20, 2023
1f3964b
Implement FishnetRoutesTest and fix json api
lenguyenthanh Nov 21, 2023
5a524c1
Use primitive data type in Executor
lenguyenthanh Nov 21, 2023
8a1de0a
Add scheduled cleaning job
lenguyenthanh Nov 21, 2023
783342e
Refactor acquire action out
lenguyenthanh Nov 21, 2023
17da26d
Implement Monitor trait (wip)
lenguyenthanh Nov 22, 2023
410f938
Bump rediculous 0.5.1
lenguyenthanh Nov 22, 2023
200f80a
Fix tests
lenguyenthanh Nov 22, 2023
e41645b
Kamon works when running with sbt
lenguyenthanh Nov 23, 2023
9f2814a
Remove State
lenguyenthanh Nov 23, 2023
9697823
Add kamon.enabled config
lenguyenthanh Nov 23, 2023
aa4de34
Add sbt-native-packager plugin
lenguyenthanh Nov 23, 2023
866af67
Bumb version 3.0
lenguyenthanh Nov 23, 2023
0ac713f
Use lila's scalafmt config
lenguyenthanh Nov 23, 2023
cdd5f1a
Add a test to garantee order of acquried works
lenguyenthanh Nov 23, 2023
efcf1f7
Update deploy config and add default config
lenguyenthanh Nov 23, 2023
2405f17
Remove .env and sbt-dotenv plugin
lenguyenthanh Nov 23, 2023
3c465cd
Remove unused dependencies
lenguyenthanh Nov 23, 2023
cc642b2
Bind to http host to `0.0.0.0`
lenguyenthanh Nov 24, 2023
73d2817
Update readme
lenguyenthanh Nov 24, 2023
7368f01
Refactor out FishnetApp, prep for intergration test
lenguyenthanh Nov 24, 2023
4327729
Rename Config => AppConfig
lenguyenthanh Nov 24, 2023
486e31e
Implement first integration test for health routes
lenguyenthanh Nov 24, 2023
9d0e73c
Write integration test for a almost real game
lenguyenthanh Nov 25, 2023
3058e67
Remove Stream from RedisSubscriberJob
lenguyenthanh Nov 25, 2023
f22da97
Make cleaning job run in every 3 seconds
lenguyenthanh Nov 25, 2023
890e3ed
Minor clean up
lenguyenthanh Nov 25, 2023
d033e2a
Add test for cleaning job
lenguyenthanh Nov 25, 2023
6f56fef
Avoid naming things when we can avoid them
lenguyenthanh Nov 25, 2023
0aa928e
Use sbtscala image for github action
fitztrev Nov 25, 2023
a53adf9
Merge pull request #248 from fitztrev/v3-github-action
lenguyenthanh Nov 25, 2023
afc2b24
Add warning log when reaching max on-going moves
lenguyenthanh Nov 30, 2023
ffff58e
Add logging in clean function
lenguyenthanh Nov 30, 2023
c15604a
Add warning log when giving up a move
lenguyenthanh Nov 30, 2023
b296e1c
Add kanela agent when packaging
lenguyenthanh Nov 30, 2023
5a6c69e
Update readme for running tests
lenguyenthanh Nov 30, 2023
7694799
Setup config for max move size
lenguyenthanh Dec 1, 2023
d743d32
Add test to make sure clearIfFull works
lenguyenthanh Dec 1, 2023
43aa0b8
Reverted logback pattern
lenguyenthanh Dec 1, 2023
65ca816
Fix cleantime instant, it == now minus 3 sconds
lenguyenthanh Dec 1, 2023
c3f14de
Make logging less verbose
lenguyenthanh Dec 2, 2023
83c3f00
Refactor Executor.Config to AppConfig.ExecutorConfig
lenguyenthanh Dec 2, 2023
eca6e1f
Add config to toggle request/response logger
lenguyenthanh Dec 2, 2023
ac0f801
Use different config for IntegrationTest
lenguyenthanh Dec 2, 2023
2a1412b
Disable request/response logging by default
lenguyenthanh Dec 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
name: Test
name: Continuous Integration

on: [push, pull_request]
on:
pull_request:
branches: ['**']
push:
branches: ['**']

jobs:
openjdk13:
openjdk21:
runs-on: ubuntu-latest
container: sbtscala/scala-sbt:eclipse-temurin-jammy-21.0.1_12_1.9.7_3.3.1
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 13
- run: sbt compile

- name: Checkout current branch
uses: actions/checkout@v4

- name: Compile
run: sbt compile

- name: Test
run: sbt test

- name: Check Formatting
run: sbt scalafmtCheckAll
19 changes: 17 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
version = "2.6.3"
version = "3.7.17"
runner.dialect = scala3

align.preset = more
maxColumn = 110
spaces.inImportCurlyBraces = true
rewrite.rules = [SortImports, RedundantParens, SortModifiers]
rewrite.rules = [SortModifiers]
rewrite.redundantBraces.stringInterpolation = true

rewrite.scala3.convertToNewSyntax = yes
rewrite.scala3.removeOptionalBraces = yes

fileOverride {
"glob:**/build.sbt" {
runner.dialect = scala213
}
"glob:**/project/**" {
runner.dialect = scala213
}
}

36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
# Lila Fishnet

Proxy between lila and fishnet move clients

```
lila <-> redis <-> lila-fishnet <- http <- fishnet-clients
```

## Developement

Start:
```
```sh
sbt
```

Start with custom port:
```
sbt -Dhttp.port=9665
Start with default config:
```sh
sbt app/run
```

Start with custom config file:
Start with custom config (`redis.host` for example):
```
sbt -Dconfig.file=/path/to/my.conf
sbt -Dredis.host=redis
```

Custom config file example:
For other `config` check [Config.scala](https://github.com/lichess-org/lila-fishnet/blob/master/app/src/main/scala/Config.scala)

Test:
```
include "application"
redis.uri = "redis://127.0.0.1"
sbt app/test
```

Code formatting
###

This repository uses [scalafmt](https://scalameta.org/scalafmt/).

Please [install it for your code editor](https://scalameta.org/scalafmt/docs/installation.html)
if you're going to contribute to this project.

If you don't install it, please run `scalafmtAll` in the sbt console before committing.
Format:
```
sbt scalafmtAll
```
46 changes: 0 additions & 46 deletions app/AppLoader.scala

This file was deleted.

87 changes: 0 additions & 87 deletions app/JsonApi.scala

This file was deleted.

82 changes: 0 additions & 82 deletions app/Lila.scala

This file was deleted.

Loading