Skip to content
Snippets Groups Projects
README.md 1.16 KiB
Newer Older
Dean's avatar
Dean committed
# cdn-origin
Dean's avatar
Dean committed

Simple but quick Golang webserver that serves requests to get files and
Dean's avatar
Dean committed
redirects from [PostgreSQL](https://www.postgresql.org).
Dean's avatar
Dean committed

### Requirements

- PostgreSQL server with `objects` table
Dean's avatar
Dean committed
- Access to the folder where the files are stored
Dean's avatar
Dean committed

### Usage

```
Dean's avatar
Dean committed
$ git clone https://owo.codes/whats-this/cdn-origin.git
$ cd cdn-origin
$ cp config.sample.toml config.toml
$ vim config.toml
$ go build main.go
$ ./main --config-file ./config.toml
If `metrics.enable` is `true`, request metadata will be indexed in the provided
Elaticsearch server in the following format:
Dean's avatar
Dean committed
  "country_code": keyword,
  "hostname":     keyword,
  "object_type":  keyword,
  "status_code":  short,
  "@timestamp":   date // generated from `@timestamp` pipeline
Dean's avatar
Dean committed
The index and `@timestamp` pipeline are created automatically if `cdn-origin`
has permission. Alternatively, the mapping and pipeline can be created by other
Dean's avatar
Dean committed
means using the `.json` files in [lib/metrics/](lib/metrics).
Dean's avatar
Dean committed

### TODO

- [ ] Write tests
Dean's avatar
Dean committed
- [ ] Add thumbnail functionality
Dean's avatar
Dean committed

### License

`cdn-origin` is licensed under the MIT license. A copy of the MIT license can be
found in [LICENSE](LICENSE).