Badge caching for rust crates
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ci update ci Aug 20, 2017
src set openssl env variables Sep 11, 2017
static style Jun 6, 2017
templates style Jun 6, 2017
.gitignore update ignored Aug 20, 2017
.travis.yml update ci Aug 20, 2017
Cargo.toml -> 0.2.1 Sep 11, 2017
Cross.toml update ci Aug 20, 2017
LICENSE license May 26, 2017
README.md update readme Aug 20, 2017
badge.service.sample update systemd example Aug 20, 2017
letsencrypt.info add sample configs May 26, 2017
nginx.conf.sample nginx conf Jun 19, 2017
update.py update script Aug 20, 2017

README.md

Badge-Cache Build Status

Simple img.shields.io cache for rust crates and generic badges

badge-cache supports the same url api as img.shields.io while enforcing a Cache-Control: max-age=3600 (1 hr) client-side cache. Badges generated from img.shields.io are cached server-side for 12 hrs unless explicitly reset.

Setup / Usage

  • Download the latest release: ./update.py run
  • Expose a direct instance to the world bin/badge-cache serve --public --port 80 --log
  • Setup behind a proxy
    • setup ssl certs (if you want), see letsencrypt.info
    • copy nginx.conf.sample to /etc/nginx/sites-available/badge and update with your project/site info
      • sudo nginx -t
      • sudo systemctl restart nginx
    • copy badge.service.sample to /lib/systemd/system/badge.service and update with your project info
      • sudo systemctl enable badge
      • sudo systemctl start badge
      • check the logs sudo journalctl -f -u badge
  • Clearing the cache:
    • The server will do a sweep of its cache every hour to clear out expired items.
    • Cached files can be forcefully deleted using the admin helper:
      • target/release/badge-cache admin --clear-cached-badges /<PATH_TO_PROJ>/static/badges
      • Setup a cron job to forcefully delete all cached files every other day:
        • 0 0 2-30/2 * * /<PATH_TO_PROJ>/target/release/badge-cache admin --clear-cached-badges /<PATH_TO_PROJ>/static/badges --no-confirm >> /var/log/badge.log 2>&1

Development

libssl-dev is required on linux for reqwest

  • Run a dev instance cargo run -- serve --log -> localhost:3000