Skip to content

Commit

Permalink
use alpine:latest, build go 1.16 from source (#699)
Browse files Browse the repository at this point in the history
* use alpine:latest, build go 1.16 from source

Signed-off-by: jnichols <[email protected]>

* codespell

Signed-off-by: jnichols <[email protected]>

---------

Signed-off-by: jnichols <[email protected]>
  • Loading branch information
jnichols-git authored Jan 21, 2024
1 parent ec87a9a commit 4c8c8de
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 25 deletions.
4 changes: 2 additions & 2 deletions cmd/trickster/conf/example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ listen_port = 8480
#

### Supported by Redis Cluster and Redis Sentinel #####################
### These conigurations are ignored by Redis (standard)
### These configurations are ignored by Redis (standard)
###

## endpoints is used for Redis Cluster and Redis Sentinel to define a list of endpoints
Expand All @@ -123,7 +123,7 @@ listen_port = 8480
#

### Supported by Redis Sentinel #######################################
### These conigurations are ignored by Redis (standard) and Redis Cluster
### These configurations are ignored by Redis (standard) and Redis Cluster
###
## sentinel_master should be set when using Redis Sentinel to indicate the Master Node
## sentinel_master = ''
Expand Down
17 changes: 15 additions & 2 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
ARG IMAGE_ARCH=amd64

FROM golang:1.14.3 as builder
FROM alpine:latest as builder
RUN apk add --no-cache bash gcc musl-dev openssl go make;
RUN export \
GOROOT_BOOTSTRAP="$(go env GOROOT)" \
GOOS="$(go env GOOS)" \
GOARCH="$(go env GOARCH)" \
GOHOSTOS="$(go env GOHOSTOS)" \
GOHOSTARCH="$(go env GOHOSTARCH)";
RUN wget -O go.src.tar.gz https://go.dev/dl/go1.16.15.src.tar.gz; \
echo '90a08c689279e35f3865ba510998c33a63255c36089b3ec206c912fc0568c3d3 *go.src.tar.gz' | sha256sum -c -; \
tar -C /usr/local -xzf go.src.tar.gz; \
rm go.src.tar.gz; \
cd /usr/local/go/src; \
./make.bash;
COPY . /go/src/github.com/trickstercache/trickster
WORKDIR /go/src/github.com/trickstercache/trickster

ARG GOARCH=amd64
RUN GOOS=linux GOARCH=${GOARCH} CGO_ENABLED=0 make build

FROM ${IMAGE_ARCH}/alpine:3.12
FROM ${IMAGE_ARCH}/alpine:latest
LABEL maintainer "The Trickster Authors <[email protected]>"

COPY --from=builder /go/src/github.com/trickstercache/trickster/OPATH/trickster /usr/local/bin/trickster
Expand Down
4 changes: 2 additions & 2 deletions deploy/kube/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ data:
#
### Supported by Redis Cluster and Redis Sentinel #####################
### These conigurations are ignored by Redis (standard)
### These configurations are ignored by Redis (standard)
###
## endpoints is used for Redis Cluster and Redis Sentinel to define a list of endpoints
Expand All @@ -132,7 +132,7 @@ data:
#
### Supported by Redis Sentinel #######################################
### These conigurations are ignored by Redis (standard) and Redis Cluster
### These configurations are ignored by Redis (standard) and Redis Cluster
###
## sentinel_master should be set when using Redis Sentinel to indicate the Master Node
## sentinel_master = ''
Expand Down
2 changes: 1 addition & 1 deletion deploy/trickster-demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The `sim-*` datasources generate on-the-fly simulation data for any possible tim

The non-sim Prometheus container that backs the `prom-*` datasources polls the newly-running environment to generate metrics that will then populate the dashboard. Since the Prometheus container only collects and stores metrics while the environment is running, you'll need to wait a minute or two for those datasources to show any data on the dashoard in real-time.

## Getting Real Dashboad Data
## Getting Real Dashboard Data

Using datasources backed by the real Prometheus and Trickster (the `prom-trickster-*` datasources), rather than the simulator, to explore the dashboard is more desirable for the demo. It better conveys the shape and nature of the Trickster-specific metrics that might be unfamiliar. However, since there is no historical data in the demo composition, that creates an upfront barrier.

Expand Down
2 changes: 1 addition & 1 deletion deploy/trickster-demo/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ services:
restart: always

trickster:
image: trickstercache/trickster:1.1
image: trickster:1.1.5
depends_on:
- prometheus
- mockster
Expand Down
2 changes: 1 addition & 1 deletion docs/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Trickster provides an HTTP Endpoint for viewing the running Configuration, as we

The reload endpoint is configured by default to listen on address `127.0.0.1` and port `8484`, at `/trickster/config/reload`. These values can be customized, as demonstrated in the example.conf. The examples in this section will assume the defaults. Set the port to `-1` to disable the reload HTTP interface altogether.

To reload the config, simply make a `GET` request to the reload endpoint. If the underlying configuration file has changed, the configuration will be reloaded, and the caller will receive a success response. If the underlying file has not chnaged, the caller will receive an unsuccessful response, and reloading will be disabled for the duration of the Reload Rate Limiter. By default, this is 3 seconds, but can be customized as demonstrated in the example config file. The Reload Rate Limiter applies to the HTTP interface only, and not SIGHUP.
To reload the config, simply make a `GET` request to the reload endpoint. If the underlying configuration file has changed, the configuration will be reloaded, and the caller will receive a success response. If the underlying file has not changed, the caller will receive an unsuccessful response, and reloading will be disabled for the duration of the Reload Rate Limiter. By default, this is 3 seconds, but can be customized as demonstrated in the example config file. The Reload Rate Limiter applies to the HTTP interface only, and not SIGHUP.

If an HTTP listener must spin down (e.g., the listen port is changed in the refreshed config), the old listener will remain alive for a period of time to allow existing connections to organically finish. This period is called the Drain Timeout and is configurable. Trickster uses 30 seconds by default. The Drain Timeout also applies to old log files, in the event that a new log filename has been provided.

Expand Down
6 changes: 3 additions & 3 deletions docs/developer/adding-new-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Each new configuration value must be defined in the `config` package under an ex

Make sure the TOML annotation uses a `lowercase_no_spaces` naming convention, while the configuration member name itself should be `CamelCase`. Follow the existing configs for guidance.

Once you have defined the configuration member, if it is part of a `CacheConfig`, `OriginConfig` or `PathConfig`, it must also be added to the configuration parser for the specific type of configuration. These methods iterate through known TOML annoations to survey which configs have been set. This allows Trickster to know if a value is set because it is the initialized default value or because the operator has explicitly set it.
Once you have defined the configuration member, if it is part of a `CacheConfig`, `OriginConfig` or `PathConfig`, it must also be added to the configuration parser for the specific type of configuration. These methods iterate through known TOML annotations to survey which configs have been set. This allows Trickster to know if a value is set because it is the initialized default value or because the operator has explicitly set it.

## Feature Code

Once you have defined your configuration value(s), you must put them to work by referencing them elsewhere in the Trickster code, and used to determine or customize the application functionality. Exactly where this happens in the code depends upon the context and reach or your new configuration, and what features its state affects. Consult with a project maintainer if you have any questions.

## Tests

All new values that you add should have accompanying unit tests to ensure the modifications the value makes to the application in the feature code work as designed. Unit Tests should include verification of: proper parsing of configuration value from test config files (in ./testdata), correct feature functionality enable/disable based on the configuration value, correct feature implementation, coverage of all executable lines of code. Unit Test will span the `config` package, and any package(s) wherein the configuration value is used by the applciation.
All new values that you add should have accompanying unit tests to ensure the modifications the value makes to the application in the feature code work as designed. Unit Tests should include verification of: proper parsing of configuration value from test config files (in ./testdata), correct feature functionality enable/disable based on the configuration value, correct feature implementation, coverage of all executable lines of code. Unit Test will span the `config` package, and any package(s) wherein the configuration value is used by the application.

## Documentation

Expand All @@ -28,7 +28,7 @@ The example config file (./cmd/trickster/conf/example.conf) should be updated to

## Deployment

The `./deply/kube/configmap.yaml` must be updated to include the new configuration option(s). Generally this file contains a copy/paste of `./cmd/trickster/conf/example.conf`.
The `./deploy/kube/configmap.yaml` must be updated to include the new configuration option(s). Generally this file contains a copy/paste of `./cmd/trickster/conf/example.conf`.

The `./deploy/helm/trickster/values.yaml` file must be updated to mirror the configuration option(s) in the example.conf, and `./deploy/helm/trickster/templates/configmap.yaml` must be updated to map any new `yamlCaseValues` to their respective `toml_style_values` for config file generation via the template.

2 changes: 1 addition & 1 deletion docs/developer/origin-extensibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The Proxy Client Interface Methods you will need to implement are broken into se

- `UnmarshalTimeseries` deserializes an HTTP Response time series payload into a Go struct

- `MarshalTimeseries` seralizes a time-series struct into a serialized byte slice.
- `MarshalTimeseries` serializes a time-series struct into a serialized byte slice.

- `UnmarshalInstantaneous` deserializes an HTTP Response instantaneous payload into a Go struct. This may not be applicable to every potential Origin Type.

Expand Down
2 changes: 1 addition & 1 deletion docs/placement.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Single "Everything" is the most common placement model. In this configuration, y

In a Multi-Origin placement, you have one dashboard endpoint, one Trickster endpoint, and multiple TSDB and/or HTTP endpoints. Trickster is aware of each upstream endpoint and treats each as a unique origin to which it proxies and caches data independently from the others. Trickster selects the origin based on Host Header or URL Path from the client request.

This setup may benefit situations where you have one ore more a static file server origins serving HTML, CSS and JavaScript assets and/or one or more API endpoints, all supporting a common platform.
This setup may benefit situations where you have one or more static file server origins serving HTML, CSS and JavaScript assets and/or one or more API endpoints, all supporting a common platform.

For Time Series Dasbhoard acceleration, this is a good configuration to use when you have a single dashboard that displays data about multiple redundant clusters (each with its own TSDB), or when you have a single dashboard representing information about many different kinds of systems. For example, if you operate a "Dashboard as a Service" solution under which many teams use your Dashboard system by designing their own dashboard screens and bringing their own databases, a single Trickster endpoint can be used to accelerate dashboards for all of your customers.

Expand Down
2 changes: 1 addition & 1 deletion docs/range_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This is important because a partial hit could result in multiple ranges being ne

Rule of thumb: If the origin does not support Multipart requests, enable Upstream Range Dearticulation in Trickster to compensate. Conversely, if the origin does support Multipart requests, do not enable Upstream Range Dearticulation.

### Disabling Multpart Ranges to Clients
### Disabling Multipart Ranges to Clients

One of the great benefits of using Upstream Range Dearticulation is that it transparently enables Multipart Range support for clients, when fronting any origin that already supports serving just a single Range.

Expand Down
2 changes: 1 addition & 1 deletion docs/retention.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Trickster provides two eviction methodologies (`timeseries_eviction_method`) for

When `timeseries_eviction_method` is set to `oldest`, Trickster maintains time series data by calculating the "oldest cacheable timestamp" value upon each request, using `time.Now().Add(step * timeseries_retention_factor * -1)`. Any queries for data older than the oldest cacheable timestamp are intelligently offloaded to the proxy since they will never be cached, and no data that is older than the oldest cacheable timestamp will be stored in the query's cache record.

When `timeseries_eviction_method` is set to `lru`, Trickster will not calculate an oldest cacheable timestamp, but rather maintain a last-accessed time for _each timestamp_ in the cache object, and evict the Least-Recently-Used items in order to maintian the cache size.
When `timeseries_eviction_method` is set to `lru`, Trickster will not calculate an oldest cacheable timestamp, but rather maintain a last-accessed time for _each timestamp_ in the cache object, and evict the Least-Recently-Used items in order to maintain the cache size.

The advantage of the `oldest` methodology better cache performance, at the cost of not caching very old data. Thus, Trickster will be more performant computationally while providing a slightly lower cache hit rate. The `lru` methodology, since it requires accessing the cache on _every request_ and maintaining access times for every timestamp, is computationally more expensive, but can achieve a higher cache hit rate since it permits caching data of any age, so long as it is accessed frequently enough to avoid eviction.

Expand Down
2 changes: 1 addition & 1 deletion docs/supported-origin-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Trickster currently supports the following Origin Types:

### <img src="./images/logos/trickster-logo.svg" width=16 /> Generic HTTP Reverse Proxy Cache

Trickster operates as a fully-featured and highly-customizable reverse proxy cache, designed to accellerate and scale upstream endpoints like API services and other simple http services. Specify `'reverseproxycache'` or just `'rpc'` as the Origin Type when configuring Trickster.
Trickster operates as a fully-featured and highly-customizable reverse proxy cache, designed to accelerate and scale upstream endpoints like API services and other simple http services. Specify `'reverseproxycache'` or just `'rpc'` as the Origin Type when configuring Trickster.

---

Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/index/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (o *Object) ToBytes() []byte {
return bytes
}

// ObjectFromBytes returns a deserialized Cache Object from a seralized byte slice
// ObjectFromBytes returns a deserialized Cache Object from a serialized byte slice
func ObjectFromBytes(data []byte) (*Object, error) {
o := &Object{}
_, err := o.UnmarshalMsg(data)
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ func TestLoadConfigurationWarning1(t *testing.T) {
l := len(conf.LoaderWarnings)

if l != expected {
t.Errorf("exepcted %d got %d", expected, l)
t.Errorf("expected %d got %d", expected, l)
}

}
Expand All @@ -689,7 +689,7 @@ func TestLoadConfigurationWarning2(t *testing.T) {
l := len(conf.LoaderWarnings)

if l != expected {
t.Errorf("exepcted %d got %d", expected, l)
t.Errorf("expected %d got %d", expected, l)
}

}
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/reload/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type Options struct {
DrainTimeoutSecs int `toml:"drain_timeout_secs"`
// RateLimitSecs limits the # of handled config reload HTTP requests to 1 per CheckRateSecs
// if multiple HTTP requests are received in the rate limit window, only the first is handled
// This prevents a bad actor from stating the config file with millions of concurrent requets
// This prevents a bad actor from stating the config file with millions of concurrent requests
// The rate limit does not apply to SIGHUP-based reload requests
RateLimitSecs int `toml:"rate_limit_secs"`
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/locks/locks.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* limitations under the License.
*/

// Package locks provides Named Locks functionality for manging
// Package locks provides Named Locks functionality for managing
// mutexes by string name (e.g., cache keys).
package locks

Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/engines/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func WriteCache(ctx context.Context, c cache.Cache, key string, d *HTTPDocument,
return mc.StoreReference(key, d, ttl)
}

// for non-memory, we have to seralize the document to a byte slice to store
// for non-memory, we have to serialize the document to a byte slice to store
bytes, err = d.MarshalMsg(nil)
if err != nil {
rsc.Logger.Error("error marshaling cache document", tl.Pairs{
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/headers/forwarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type Hop struct {
Host string
// Scheme is the protocol scheme requested of the proxy
Scheme string
// Server is an identier for the server running the Trickster process
// Server is an identifier for the server running the Trickster process
Server string
// protocol indicates the HTTP protocol Version in proper format (.eg., "HTTP/1.1")
// requested by the client
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/urls/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func Clone(u *url.URL) *url.URL {
return u2
}

// FromParts returns a *url.URL consructed from the provided parts
// FromParts returns a *url.URL constructed from the provided parts
func FromParts(scheme, host, path, query, fragment string) *url.URL {
return &url.URL{
Scheme: scheme,
Expand Down

0 comments on commit 4c8c8de

Please sign in to comment.