|
1 | 1 | # Lemur |
2 | 2 |
|
3 | 3 | Lemur manages TLS certificate creation. While not able to issue certificates itself, Lemur acts as a broker between CAs |
4 | | -and environments providing a central portal for developers to issue TLS certificates with 'sane' defaults. |
| 4 | +and environments, providing a central portal for developers to issue TLS certificates with 'sane' defaults. |
5 | 5 |
|
6 | | -Lemur aims to support the 3 most recent python releases which have been released for at least a year. For example, if python3.13 released last month, we'd aim to support versions 3.10, 3.11, and 3.12. |
| 6 | +Lemur aims to support three of the most recent python releases which have been released for at least a year. For |
| 7 | +example, if python 3.13 released last month, we'd aim to support versions 3.10, 3.11, and 3.12. |
| 8 | + |
| 9 | +# Build & run |
| 10 | + |
| 11 | +## Local |
| 12 | + |
| 13 | +### Frontend |
| 14 | + |
| 15 | +Build |
| 16 | + |
| 17 | +```bash |
| 18 | +npm install # Install dependencies |
| 19 | +gulp build # Compiles frontend |
| 20 | +gulp package --urlContextPath="" # Sets correct base path to API endpoints |
| 21 | +``` |
| 22 | + |
| 23 | +Run |
| 24 | + |
| 25 | +``` |
| 26 | +gulp serve |
| 27 | +``` |
| 28 | + |
| 29 | +### Backend |
| 30 | + |
| 31 | +1. Supposed you have uv installed |
| 32 | +2. Activate virtual environment: `source .venv/bin/activate` |
| 33 | +3. Install python dependencies: `uv sync` |
| 34 | +4. Review initial config in `lemur.conf.py` and adjust it to your needs |
| 35 | +5. Make sure you are inside lemur package (with the migrations folder): `cd lemur/` |
| 36 | +6. Create admin user with login `lemur` and password `password`: |
| 37 | + `uv run lemur -c /path/to/lemur.conf.py init -p password` |
| 38 | +7. Run app: `uv run lemur -c /path/to/lemur.conf.py start` |
| 39 | +8. Access via browser: http://localhost:8000 |
| 40 | + |
| 41 | +### Tests |
| 42 | + |
| 43 | +```bash |
| 44 | +# Install test dependencies |
| 45 | +uv sync --group tests |
| 46 | + |
| 47 | +# Run tests |
| 48 | +pytest |
| 49 | + |
| 50 | +# With coverage |
| 51 | +pytest --cov=lemur |
| 52 | +``` |
| 53 | + |
| 54 | +### Docs |
| 55 | + |
| 56 | + |
| 57 | +## Docker |
| 58 | + |
| 59 | +### Build |
| 60 | + |
| 61 | +### Docker-compose |
| 62 | + |
| 63 | +```bash |
| 64 | +docker compose up -d postgres # run postgres in background |
| 65 | +docker compose run --rm lemur init # initialize database (one time) |
| 66 | +docker compose up -d lemur # start the app |
| 67 | +``` |
| 68 | + |
| 69 | +### Running tests |
| 70 | + |
| 71 | +### Docker Development |
| 72 | + |
| 73 | +```bash |
| 74 | +# Start services |
| 75 | +docker-compose -f docker-compose.dev.yml up |
| 76 | + |
| 77 | +# Start in background |
| 78 | +docker-compose -f docker-compose.dev.yml up -d |
| 79 | + |
| 80 | +# View logs |
| 81 | +docker-compose -f docker-compose.dev.yml logs -f lemur |
| 82 | + |
| 83 | +# Stop services |
| 84 | +docker-compose -f docker-compose.dev.yml down |
| 85 | + |
| 86 | +# Rebuild after code changes |
| 87 | +docker-compose -f docker-compose.dev.yml up --build |
| 88 | + |
| 89 | +# Run database migrations |
| 90 | +docker-compose -f docker-compose.dev.yml exec lemur lemur db upgrade |
| 91 | + |
| 92 | +# Access Python shell |
| 93 | +docker-compose -f docker-compose.dev.yml exec lemur lemur shell |
| 94 | +``` |
| 95 | + |
| 96 | +### Hot Reload |
| 97 | + |
| 98 | +The development docker-compose includes `--reload` flag for gunicorn, so Python changes are automatically detected. |
| 99 | + |
| 100 | + |
| 101 | +## Production environment overview |
| 102 | + |
| 103 | +``` |
| 104 | +┌─────────────────────────────────────────────────────┐ |
| 105 | +│ Browser/Client │ |
| 106 | +└─────────────────────┬───────────────────────────────┘ |
| 107 | + │ |
| 108 | + ↓ |
| 109 | +┌─────────────────────────────────────────────────────┐ |
| 110 | +│ Caddy/your favorite web server (port 80/433) │ |
| 111 | +│ • Serves static files (CSS, JS, images) │ |
| 112 | +│ • Proxies /api/* to Flask backend │ |
| 113 | +│ • SPA routing (all routes → index.html) │ |
| 114 | +└─────────────────────┬───────────────────────────────┘ |
| 115 | + │ |
| 116 | + ↓ |
| 117 | +┌─────────────────────────────────────────────────────┐ |
| 118 | +│ Flask + Gunicorn (port 8000) │ |
| 119 | +│ • REST API endpoints (/api/1/*) │ |
| 120 | +│ • Serves index.html for root route │ |
| 121 | +│ • SQLAlchemy ORM │ |
| 122 | +└─────────┬───────────────────────────┬───────────────┘ |
| 123 | + │ │ |
| 124 | + ↓ ↓ |
| 125 | +┌──────────────────┐ ┌──────────────────┐ |
| 126 | +│ PostgreSQL │ │ Redis │ |
| 127 | +│ (port 5432) │ │ (port 6379) │ |
| 128 | +│ • Main database │ │ • Cache/Queue │ |
| 129 | +│ • pg_trgm ext │ │ • Celery broker │ |
| 130 | +└──────────────────┘ └──────────────────┘ |
| 131 | + │ |
| 132 | + ↓ |
| 133 | + ┌──────────────────┐ |
| 134 | + │ Celery Worker │ |
| 135 | + │ • Background │ |
| 136 | + │ tasks │ |
| 137 | + └──────────────────┘ |
| 138 | +``` |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | +**Happy certificate management! 🎉** |
0 commit comments