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.
You should always run this service over TLS because of the use of HTTP basic authentication.
scripts/build.sh
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
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.
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.
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.
Modify configmap.yaml to set a proper username and password.
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.
Set your email address in letsencrypt-issuer.yaml.
Deploy the resources: kubectl create -f k8s/
Content type
Image
Digest
Size
114.8 MB
Last updated
over 5 years ago
docker pull mckdev/aka:latest-snapshot