rgarrigue / garconne

Just a test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

garconne

This is just a basic URL shortener app, mostly wrote to test CI/CD stuff around the app itself.

Requirements

You've to install by yourself docker, docker-compose, make.

Usage

# Setup the requirements, build and start the containers, run the tests, then cleanup
make

# Setup the requirements, build and start the containers, then display the live logs
make dev
# Same, only displaying the app logs
LOGS=app make dev

# Remove the containers
make clean
# Remove the containers, certificates, caches, binaries...
make wipe

Browse to

When required, the default login is admin, password garconne

Development

For a quicker development, install Python 3.9 & Poetry, then

docker run -d -p 6379:6379 --name redis redis
docker run -d -p 8001:8001 --name redisinsight redislabs/redisinsight
poetry install
poetry run uvicorn garconne.main:app --reload

Then you can test stuff in another terminal

curl -I http://localhost:8000/health
export ID=$(curl -X POST "http://localhost:8000/api/v1/shorten/https://user:password@example.com/bli/bla/bli/index.html?hello=world&world=hello")
curl http://localhost:8000/api/v1/lookup/$ID

TODO

About the code itself

  • Add gunicorn
  • Organize the code
  • Improve the workflow
    • Execute pytest in the docker-compose context ?
    • Add a docker-compose.development.yml override to live reload the code ?
  • Hide /status and /metrics in the app's logs
  • Replace vegeta by locust

About the contrib

  • Add alerts in prometheus from https://awesome-prometheus-alerts.grep.to
  • Fix Grafana's datasources and dashboards
  • Add an app dashboard in Grafana
  • Setup Grafana notifiers (alerts)
  • Setup AlertManager & MailHog
  • Vue.js based WebUI to CRUD shortened URLs
  • Add Keycloak over it example

Next: same same, but Golang

About

Just a test


Languages

Language:Python 53.8%Language:Shell 18.8%Language:Makefile 15.7%Language:Dockerfile 11.8%