Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tcdowney/web-monetization-proxy

Simple Go proxy for injecting Web Monetization meta tags. Done as part of the Dev "Grant For The Web" Hackathon
https://github.com/tcdowney/web-monetization-proxy

gftwhackathon go golang proxy web-monetization

Last synced: 11 days ago
JSON representation

Simple Go proxy for injecting Web Monetization meta tags. Done as part of the Dev "Grant For The Web" Hackathon

Awesome Lists containing this project

README

        

[![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/downey/web-monetization-proxy)](https://hub.docker.com/repository/docker/downey/web-monetization-proxy) [![Docker Image Version (latest by date)](https://img.shields.io/docker/v/downey/web-monetization-proxy)](https://hub.docker.com/repository/docker/downey/web-monetization-proxy)

# web-monetization-proxy
Docker repo: https://hub.docker.com/repository/docker/downey/web-monetization-proxy

Simple proxy for injecting [Web Monetization](https://webmonetization.org/) `meta` tags. Intended to be deployed as a sidecar process alongside Web Monetization unaware webapps.

![Architecture diagram of the Web Monetization Proxy](doc/web-monetization-proxy.png)

## disclaimer
This **proof-of-concept** project was created for fun as part of the [DEV "Grant For The Web" Hackathon](https://dev.to/devteam/announcing-the-grant-for-the-web-hackathon-on-dev-3kd1). It should **not be relied on** for production use cases and merely exists to demonstrate what is possible. In the future it might be worth exploring doing something similar using Envoy proxies and a [WASM](https://github.com/envoyproxy/envoy-wasm) plugin that implements this functionality.

## configuration
The proxy relies on the following environment variables:
* `PROXY_PORT` -- the port the proxy listens on
* `BACKEND_PORT` -- the port of the backend application that requests are forwarded to
* `PAYMENT_POINTER` -- an [Interledger Payment Pointer](https://paymentpointers.org/) string

Reference the [example Deployment](hack/example-deployment.yaml) to see how you might configure these in Kubernetes.

## development
This project uses [Go modules](https://blog.golang.org/using-go-modules) which work best with Golang 1.13+. To run the project's tests, run `go test ./...` from the root directory.

## build and deployment
![Architecture diagram of the Web Monetization Proxy](doc/example-deployment-screenshot.png)

This project uses [Cloud Native Buildpacks](https://buildpacks.io/) and the [`pack` cli](https://buildpacks.io/docs/install-pack/) in lieu of a `Dockerfile`. New images can be built by running the following:

```console
pack build -B cloudfoundry/cnb:bionic
```

To ease development and deployment to Kubernetes, it also includes some [`kbld`](https://get-kbld.io/) configuration in the `build` directory and a sample Kubernetes `Deployment` in the `hack` directory.

To quickly build, push, and deploy to Kubernetes run1:

```console
kbld -f hack -f build | kubectl apply -f -
```

_1 - You will need to update `build/destinations.yaml` to refer to an OCI image registry you have permission to push to and replace `hack/example-ingress.yaml` with `Ingress` configuration that is valid for your cluster._