Skip to content

Commit

Permalink
release(v1.6.2): Prepare the release (#190)
Browse files Browse the repository at this point in the history
* release(v1.6.2): Prepare the release
  • Loading branch information
darkweak authored Mar 12, 2022
1 parent f59dc58 commit 5c8b76b
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 32 deletions.
76 changes: 67 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ surrogate_keys:
| `default_cache.badger.configuration` | Configure Badger directly in the Caddyfile or your JSON caddy configuration | [See the Badger configuration for the options](https://dgraph.io/docs/badger/get-started/) |
| `default_cache.headers` | List of headers to include to the cache | `- Authorization`<br/><br/>`- Content-Type`<br/><br/>`- X-Additional-Header` |
| `default_cache.olric` | Configure the Olric cache storage | |
| `default_cache.olric.path` | Configure Olric with a file | `/anywhere/badger_configuration.json` |
| `default_cache.olric.configuration` | Configure Olric directly in the Caddyfile or your JSON caddy configuration | [See the Badger configuration for the options](https://github.com/buraksezer/olric/blob/master/cmd/olricd/olricd.yaml/) |
| `default_cache.olric.path` | Configure Olric with a file | `/anywhere/olric_configuration.json` |
| `default_cache.olric.configuration` | Configure Olric directly in the Caddyfile or your JSON caddy configuration | [See the Olric configuration for the options](https://github.com/buraksezer/olric/blob/master/cmd/olricd/olricd.yaml/) |
| `default_cache.port.{web,tls}` | The device's local HTTP/TLS port that Souin should be listening on | Respectively `80` and `443` |
| `default_cache.regex.exclude` | The regex used to prevent paths being cached | `^[A-z]+.*$` |
| `default_cache.stale` | The stale duration | `25m` |
Expand Down Expand Up @@ -225,7 +225,7 @@ Supported providers
- [Olric](https://github.com/buraksezer/olric)

The cache system sits on top of three providers at the moment. It provides an in-memory, redis and Olric cache systems because setting, getting, updating and deleting keys in these providers is as easy as it gets.
In order to do that, Redis and Olric providers need to be either on the same network as the Souin instance when using docker-compose or over the internet, then it will use by default in-memory to avoid network latency as much as possible.
In order to do that, the Olric provider need to be either on the same network as the Souin instance when using docker-compose or over the internet, then it will use by default in-memory to avoid network latency as much as possible.
Souin will return at first the in-memory response when it gives a non-empty response, then the olric one followed by the redis one with same condition, or fallback to the reverse proxy otherwise.
Since v1.4.2, Souin supports [Olric](https://github.com/buraksezer/olric) to handle distributed cache.

Expand Down Expand Up @@ -332,9 +332,6 @@ There is the fully configuration below
}
badger {
path the_path_to_a_file.json
configuration {
# Your badger configuration here
}
}
cdn {
api_key XXXX
Expand Down Expand Up @@ -375,16 +372,79 @@ respond "Hello World!"
cache @match {
ttl 5s
badger {
path /tmp/badger/first-match
configuration {
# Required value
ValueDir <string>
# Optional
SyncWrites <bool>
NumVersionsToKeep <int>
ReadOnly <bool>
Compression <int>
InMemory <bool>
MetricsEnabled <bool>
MemTableSize <int>
BaseTableSize <int>
BaseLevelSize <int>
LevelSizeMultiplier <int>
TableSizeMultiplier <int>
MaxLevels <int>
VLogPercentile <float>
ValueThreshold <int>
NumMemtables <int>
BlockSize <int>
BloomFalsePositive <float>
BlockCacheSize <int>
IndexCacheSize <int>
NumLevelZeroTables <int>
NumLevelZeroTablesStall <int>
ValueLogFileSize <int>
ValueLogMaxEntries <int>
NumCompactors <int>
CompactL0OnClose <bool>
LmaxCompaction <bool>
ZSTDCompressionLevel <int>
VerifyValueChecksum <bool>
EncryptionKey <string>
EncryptionKey <Duration>
BypassLockGuard <bool>
ChecksumVerificationMode <int>
DetectConflicts <bool>
NamespaceOffset <int>
}
}
}
cache @match2 {
ttl 50s
badger {
path /tmp/badger/second-match
configuration {
ValueDir match2
ValueLogFileSize 16777216
MemTableSize 4194304
ValueThreshold 524288
BypassLockGuard true
}
}
headers Authorization
default_cache_control "public, max-age=86400"
}
cache @matchdefault {
ttl 5s
badger {
path /tmp/badger/default-match
configuration {
ValueDir default
ValueLogFileSize 16777216
MemTableSize 4194304
ValueThreshold 524288
BypassLockGuard true
}
}
}
cache @souin-api {}
Expand Down Expand Up @@ -455,7 +515,6 @@ func main() {
}
```


After that you will be able to declare the httpcache filter in your eskip file.
```
hello: Path("/hello")
Expand All @@ -472,7 +531,7 @@ experimental:
plugins:
souin:
moduleName: github.com/darkweak/souin
version: v1.6.1
version: v1.6.2
```
After that you can declare either the whole configuration at once in the middleware block or by service. See the examples below.
```yaml
Expand Down Expand Up @@ -615,7 +674,6 @@ A repository called [prestashop-souin](https://github.com/lucmichalski/prestasho
### Wordpress plugin
A repository called [wordpress-souin](https://github.com/Darkweak/wordpress-souin) to be able to manage your Souin instance through the admin panel UI.


## Credits

Thanks to these users for contributing or helping this project in any way
Expand Down
72 changes: 65 additions & 7 deletions plugins/caddy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ This is a distributed HTTP cache module for Caddy based on [Souin](https://githu
* REST API to purge the cache and list stored resources.
* Builtin support for distributed cache.


## Example Configurations
There is the fully configuration below
```caddy
Expand All @@ -30,9 +29,6 @@ There is the fully configuration below
}
badger {
path the_path_to_a_file.json
configuration {
# Your badger configuration here
}
}
cdn {
api_key XXXX
Expand Down Expand Up @@ -73,16 +69,79 @@ respond "Hello World!"
cache @match {
ttl 5s
badger {
path /tmp/badger/first-match
configuration {
# Required value
ValueDir <string>
# Optional
SyncWrites <bool>
NumVersionsToKeep <int>
ReadOnly <bool>
Compression <int>
InMemory <bool>
MetricsEnabled <bool>
MemTableSize <int>
BaseTableSize <int>
BaseLevelSize <int>
LevelSizeMultiplier <int>
TableSizeMultiplier <int>
MaxLevels <int>
VLogPercentile <float>
ValueThreshold <int>
NumMemtables <int>
BlockSize <int>
BloomFalsePositive <float>
BlockCacheSize <int>
IndexCacheSize <int>
NumLevelZeroTables <int>
NumLevelZeroTablesStall <int>
ValueLogFileSize <int>
ValueLogMaxEntries <int>
NumCompactors <int>
CompactL0OnClose <bool>
LmaxCompaction <bool>
ZSTDCompressionLevel <int>
VerifyValueChecksum <bool>
EncryptionKey <string>
EncryptionKey <Duration>
BypassLockGuard <bool>
ChecksumVerificationMode <int>
DetectConflicts <bool>
NamespaceOffset <int>
}
}
}
cache @match2 {
ttl 50s
badger {
path /tmp/badger/second-match
configuration {
ValueDir match2
ValueLogFileSize 16777216
MemTableSize 4194304
ValueThreshold 524288
BypassLockGuard true
}
}
headers Authorization
default_cache_control "public, max-age=86400"
}
cache @matchdefault {
ttl 5s
badger {
path /tmp/badger/default-match
configuration {
ValueDir default
ValueLogFileSize 16777216
MemTableSize 4194304
ValueThreshold 524288
BypassLockGuard true
}
}
}
cache @souin-api {}
Expand Down Expand Up @@ -111,8 +170,8 @@ What does these directives mean?
| `default_cache_control` | Set the default value of `Cache-Control` response header if not set by upstream (Souin treats empty `Cache-Control` as `public` if omitted) | `no-store` |
| `headers` | List of headers to include to the cache | `Authorization Content-Type X-Additional-Header` |
| `olric` | Configure the Olric cache storage | |
| `olric.path` | Configure Olric with a file | `/anywhere/badger_configuration.json` |
| `olric.configuration` | Configure Olric directly in the Caddyfile or your JSON caddy configuration | [See the Badger configuration for the options](https://github.com/buraksezer/olric/blob/master/cmd/olricd/olricd.yaml/) |
| `olric.path` | Configure Olric with a file | `/anywhere/olric_configuration.json` |
| `olric.configuration` | Configure Olric directly in the Caddyfile or your JSON caddy configuration | [See the Olric configuration for the options](https://github.com/buraksezer/olric/blob/master/cmd/olricd/olricd.yaml/) |
| `regex.exclude` | The regex used to prevent paths being cached | `^[A-z]+.*$` |
| `stale` | The stale duration | `25m` |
| `ttl` | The TTL duration | `120s` |
Expand All @@ -123,7 +182,6 @@ Other resources
You can find an example for the [Caddyfile](Caddyfile) or the [JSON file](configuration.json).
See the [Souin](https://github.com/darkweak/souin) configuration for the full configuration, and its associated [Caddyfile](https://github.com/darkweak/souin/blob/master/plugins/caddy/Caddyfile)


## TODO

* [ ] Improve the API and add relevant endpoints
4 changes: 2 additions & 2 deletions plugins/caddy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.16

require (
github.com/caddyserver/caddy/v2 v2.4.5
github.com/darkweak/souin v1.6.1
github.com/darkweak/souin v1.6.2
go.uber.org/zap v1.19.1
)

replace github.com/darkweak/souin v1.6.1 => ../..
replace github.com/darkweak/souin v1.6.2 => ../..
5 changes: 2 additions & 3 deletions plugins/caddy/httpcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type key string

const getterContextCtxKey key = "getter_context"
const moduleName = "cache"
const moduleID caddy.ModuleID = "http.handlers." + moduleName

func init() {
caddy.RegisterModule(SouinCaddyPlugin{})
Expand All @@ -52,7 +51,7 @@ type SouinCaddyPlugin struct {
// CaddyModule returns the Caddy module information.
func (SouinCaddyPlugin) CaddyModule() caddy.ModuleInfo {
return caddy.ModuleInfo{
ID: moduleID,
ID: "http.handlers.cache",
New: func() caddy.Module { return new(SouinCaddyPlugin) },
}
}
Expand Down Expand Up @@ -244,7 +243,7 @@ func parseBadgerConfiguration(c map[string]interface{}) map[string]interface{} {
case "Dir", "ValueDir":
c[k] = v
case "SyncWrites", "ReadOnly", "InMemory", "MetricsEnabled", "CompactL0OnClose", "LmaxCompaction", "VerifyValueChecksum", "BypassLockGuard", "DetectConflicts":
c[k], _ = strconv.ParseBool(v.(string))
c[k] = true
case "NumVersionsToKeep", "NumGoroutines", "MemTableSize", "BaseTableSize", "BaseLevelSize", "LevelSizeMultiplier", "TableSizeMultiplier", "MaxLevels", "ValueThreshold", "NumMemtables", "BlockSize", "BlockCacheSize", "IndexCacheSize", "NumLevelZeroTables", "NumLevelZeroTablesStall", "ValueLogFileSize", "NumCompactors", "ZSTDCompressionLevel", "ChecksumVerificationMode", "NamespaceOffset":
c[k], _ = strconv.Atoi(v.(string))
case "Compression", "ValueLogMaxEntries":
Expand Down
4 changes: 2 additions & 2 deletions plugins/echo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module github.com/darkweak/souin/plugins/echo
go 1.16

require (
github.com/darkweak/souin v1.6.1
github.com/darkweak/souin v1.6.2
github.com/labstack/echo/v4 v4.6.1
go.uber.org/zap v1.19.1
)

replace github.com/darkweak/souin v1.6.1 => ../..
replace github.com/darkweak/souin v1.6.2 => ../..
4 changes: 2 additions & 2 deletions plugins/gin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/gin
go 1.16

require (
github.com/darkweak/souin v1.6.1
github.com/darkweak/souin v1.6.2
github.com/gin-gonic/gin v1.7.7
github.com/go-playground/validator/v10 v10.10.0 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
Expand All @@ -14,4 +14,4 @@ require (
google.golang.org/protobuf v1.27.1 // indirect
)

replace github.com/darkweak/souin v1.6.1 => ../..
replace github.com/darkweak/souin v1.6.2 => ../..
4 changes: 2 additions & 2 deletions plugins/skipper/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module github.com/darkweak/souin/plugins/skipper
go 1.16

require (
github.com/darkweak/souin v1.6.1
github.com/darkweak/souin v1.6.2
github.com/zalando/skipper v0.13.174
go.uber.org/zap v1.19.1
)

replace github.com/darkweak/souin v1.6.1 => ../..
replace github.com/darkweak/souin v1.6.2 => ../..
4 changes: 2 additions & 2 deletions plugins/traefik/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/darkweak/souin/plugins/traefik
go 1.16

require (
github.com/darkweak/souin v1.6.1
github.com/darkweak/souin v1.6.2
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pquerna/cachecontrol v0.1.0
go.uber.org/zap v1.19.1
)

replace github.com/darkweak/souin v1.6.1 => ../..
replace github.com/darkweak/souin v1.6.2 => ../..
2 changes: 1 addition & 1 deletion plugins/traefik/vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ github.com/buraksezer/olric/stats
github.com/cespare/xxhash
# github.com/cespare/xxhash/v2 v2.1.2
github.com/cespare/xxhash/v2
# github.com/darkweak/souin v1.6.1 => ../..
# github.com/darkweak/souin v1.6.2 => ../..
## explicit
github.com/darkweak/souin/api
github.com/darkweak/souin/api/auth
Expand Down
4 changes: 2 additions & 2 deletions plugins/tyk/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/TykTechnologies/gojsonschema v0.0.0-20170222154038-dcb3e4bb7990 // indirect
github.com/TykTechnologies/tyk v2.9.5+incompatible
github.com/clbanning/mxj v1.8.4 // indirect
github.com/darkweak/souin v1.6.1
github.com/darkweak/souin v1.6.2
github.com/franela/goblin v0.0.0-20211003143422-0a4f594942bf // indirect
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8 // indirect
github.com/hashicorp/terraform v1.0.1 // indirect
Expand All @@ -22,6 +22,6 @@ require (
)

replace (
github.com/darkweak/souin v1.6.1 => ../..
github.com/darkweak/souin v1.6.2 => ../..
github.com/hashicorp/terraform v1.0.1 => github.com/hashicorp/terraform v0.14.11
)

0 comments on commit 5c8b76b

Please sign in to comment.