Sign inSign up

mckdev/aka

By mckdev

Updated over 5 years ago

Image
0

93

mckdev/aka repository overview

AKA

Naive HTTP service for URL aliasing/redirecting.

TinyURL-like services are generally annoying to use by requiring registration, consumption of ads, or over-complexity. This is a comparable service you can run yourself. It provides a bare-bones feature set, basic authentication, and optional, external storage in Redis.

:warning: Warning :warning:

You should always run this service over TLS because of the use of HTTP basic authentication.

Pre-requisites
  • JDK 15
  • Maven
  • Docker

Build
scripts/build.sh

Run

Modify configuration.yaml as necessary, then:

scripts/run.sh

With Docker:

docker run \
  -p 8080:8080 \
  -v $PWD/configuration.yaml:/app/configuration/configuration.yaml \
  mckdev/aka

Usage

Create an alias:

curl \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"url":"https://google.com", "alias":"google"}' \
  -u admin:password \
  http://localhost:8080/api/set

See the management HTTP API implementation for more.

Use an alias:

curl -L http://localhost:8080/google

See the "redirect" HTTP API implementation for more.


Storage

By default, all data is kept in-memory. This means a "highly available" deployment of the service is not possible. You can enable storage in Redis, if you want to be able to restart the service without losing your data, or if you want to deploy multiple instances of the service for redundancy.

See configuration.yaml for an example of a Redis storage configuration block.


Kubernetes

An example set of Kubernetes resources is provided in k8s. A single-node Redis service is included.

To use the included LetsEncrypt-based automatic TLS, your cluster needs to have cert-manager installed. You probably want to use the LetsEncrypt staging environment while you're getting things going, to avoid hitting any rate-limits. See the comment in letsencrypt-issuer.yaml.

  1. Modify configmap.yaml to set a proper username and password.

  2. Set your host in ingress.yaml. Note that these manifests assume that your cluster's ingress controller is Traefik. Traefik is the ingress controller used by k3s, my Kubernetes distribution of choice for projects like these. If you're using a different ingress controller, modify the annotations in ingress.yaml and ingress.class in letsencrypt-issuer.yaml as necessary.

  3. Set your email address in letsencrypt-issuer.yaml.

  4. Deploy the resources: kubectl create -f k8s/

Tag summary

Content type

Image

Digest

Size

114.8 MB

Last updated

over 5 years ago

docker pull mckdev/aka:latest-snapshot