Changed README
This commit is contained in:
parent
6e7541b5cc
commit
0935d03ef9
96
README.md
96
README.md
@ -1,22 +1,11 @@
|
|||||||
JupyterHub Notebook Viewer
|
# JupyterHub Notebook Viewer
|
||||||
|
|
||||||
A Flask-based web application for viewing and browsing Jupyter notebooks from a JupyterHub shared directory. Features a responsive web interface with directory navigation, notebook preview, and download capabilities.
|
A Flask-based web application for viewing and browsing Jupyter notebooks from a JupyterHub shared directory. Features a responsive web interface with directory navigation, notebook preview, and download capabilities.
|
||||||
Features
|
|
||||||
|
|
||||||
📁 Directory Navigation - Browse through nested directories with breadcrumb navigation
|
## Quick Start
|
||||||
📄 Notebook Viewing - Convert and display Jupyter notebooks as HTML in the browser
|
|
||||||
⬇️ Download Support - Direct download of notebook files
|
|
||||||
🎨 Responsive Design - Bootstrap-based UI that works on desktop and mobile
|
|
||||||
🔒 Security - Path traversal protection and configurable access controls
|
|
||||||
🛠️ Configurable - All settings configurable via environment variables
|
|
||||||
🐳 Docker Support - Ready-to-use Docker containers and compose files
|
|
||||||
❄️ Nix Development - Complete Nix flake for reproducible development
|
|
||||||
|
|
||||||
Quick Start
|
|
||||||
Using Nix (Recommended)
|
Using Nix (Recommended)
|
||||||
|
|
||||||
bash
|
```bash
|
||||||
|
|
||||||
# Enter development environment
|
# Enter development environment
|
||||||
nix develop
|
nix develop
|
||||||
|
|
||||||
@ -26,20 +15,22 @@ setup-dev
|
|||||||
# Start development server
|
# Start development server
|
||||||
dev-server
|
dev-server
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
Using Docker
|
Using Docker
|
||||||
|
|
||||||
bash
|
```bash
|
||||||
|
|
||||||
# Copy and configure environment
|
# Copy and configure environment
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
# Edit .env with your settings
|
# Edit .env with your settings
|
||||||
|
|
||||||
# Start with Docker Compose
|
# Start with Docker Compose
|
||||||
docker-compose up
|
docker-compose up
|
||||||
|
```
|
||||||
|
|
||||||
Manual Installation
|
Manual Installation
|
||||||
|
|
||||||
bash
|
```bash
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
@ -50,8 +41,9 @@ cp .env.example .env
|
|||||||
|
|
||||||
# Start the application
|
# Start the application
|
||||||
python app.py
|
python app.py
|
||||||
|
```
|
||||||
|
|
||||||
Configuration
|
## Configuration
|
||||||
|
|
||||||
All configuration is done via environment variables, typically in a .env file:
|
All configuration is done via environment variables, typically in a .env file:
|
||||||
Core Settings
|
Core Settings
|
||||||
@ -81,12 +73,12 @@ UI Settings
|
|||||||
|
|
||||||
THEME - UI theme, dark or light (default: dark)
|
THEME - UI theme, dark or light (default: dark)
|
||||||
|
|
||||||
Development
|
## Development
|
||||||
With Nix
|
With Nix
|
||||||
|
|
||||||
The project includes a complete Nix flake for reproducible development:
|
The project includes a complete Nix flake for reproducible development:
|
||||||
|
|
||||||
bash
|
```bash
|
||||||
|
|
||||||
# Enter development shell
|
# Enter development shell
|
||||||
nix develop
|
nix develop
|
||||||
@ -95,12 +87,13 @@ nix develop
|
|||||||
setup-dev # Set up development environment
|
setup-dev # Set up development environment
|
||||||
dev-server # Start development server with auto-reload
|
dev-server # Start development server with auto-reload
|
||||||
run-tests # Run basic tests
|
run-tests # Run basic tests
|
||||||
|
```
|
||||||
|
|
||||||
With Just
|
With Just
|
||||||
|
|
||||||
If you have just installed:
|
If you have just installed:
|
||||||
|
|
||||||
bash
|
```bash
|
||||||
|
|
||||||
# See all available commands
|
# See all available commands
|
||||||
just
|
just
|
||||||
@ -111,10 +104,11 @@ just dev # Start development server
|
|||||||
just docker-up # Start with Docker
|
just docker-up # Start with Docker
|
||||||
just test # Run tests
|
just test # Run tests
|
||||||
just clean # Clean temporary files
|
just clean # Clean temporary files
|
||||||
|
```
|
||||||
|
|
||||||
Manual Development
|
Manual Development
|
||||||
|
|
||||||
bash
|
```bash
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
@ -128,12 +122,12 @@ mkdir -p shared
|
|||||||
|
|
||||||
# Start development server
|
# Start development server
|
||||||
python app.py
|
python app.py
|
||||||
|
```
|
||||||
|
|
||||||
Docker Deployment
|
Docker Deployment
|
||||||
Basic Deployment
|
Basic Deployment
|
||||||
|
|
||||||
bash
|
```bash
|
||||||
|
|
||||||
# Build and start
|
# Build and start
|
||||||
docker-compose up --build
|
docker-compose up --build
|
||||||
|
|
||||||
@ -142,17 +136,20 @@ docker-compose up -d
|
|||||||
|
|
||||||
# View logs
|
# View logs
|
||||||
docker-compose logs -f
|
docker-compose logs -f
|
||||||
|
```
|
||||||
|
|
||||||
With Reverse Proxy
|
With Reverse Proxy
|
||||||
|
|
||||||
The compose file includes an optional nginx reverse proxy:
|
The compose file includes an optional nginx reverse proxy:
|
||||||
|
|
||||||
bash
|
|
||||||
|
```bash
|
||||||
|
|
||||||
# Start with proxy
|
# Start with proxy
|
||||||
docker-compose --profile with-proxy up
|
docker-compose --profile with-proxy up
|
||||||
|
```
|
||||||
|
|
||||||
Production Considerations
|
## Production Considerations
|
||||||
|
|
||||||
For production deployment:
|
For production deployment:
|
||||||
|
|
||||||
@ -162,7 +159,7 @@ For production deployment:
|
|||||||
Set up SSL: Configure HTTPS in your reverse proxy
|
Set up SSL: Configure HTTPS in your reverse proxy
|
||||||
Resource limits: Set appropriate CPU and memory limits in Docker
|
Resource limits: Set appropriate CPU and memory limits in Docker
|
||||||
|
|
||||||
API Endpoints
|
## API Endpoints
|
||||||
|
|
||||||
When ENABLE_API=True, the following JSON API endpoints are available:
|
When ENABLE_API=True, the following JSON API endpoints are available:
|
||||||
|
|
||||||
@ -171,14 +168,8 @@ When ENABLE_API=True, the following JSON API endpoints are available:
|
|||||||
GET /view/<path> - View notebook as HTML
|
GET /view/<path> - View notebook as HTML
|
||||||
GET /download/<path> - Download notebook file (if enabled)
|
GET /download/<path> - Download notebook file (if enabled)
|
||||||
|
|
||||||
Security Features
|
|
||||||
|
|
||||||
Path Traversal Protection - Prevents access outside the configured directory
|
## Troubleshooting
|
||||||
File Type Validation - Only allows configured file extensions
|
|
||||||
Configurable Downloads - Downloads can be disabled entirely
|
|
||||||
Non-root Docker User - Container runs as non-privileged user
|
|
||||||
|
|
||||||
Troubleshooting
|
|
||||||
Common Issues
|
Common Issues
|
||||||
|
|
||||||
"No notebooks found"
|
"No notebooks found"
|
||||||
@ -193,44 +184,15 @@ Common Issues
|
|||||||
Ensure the application has read access to the shared directory
|
Ensure the application has read access to the shared directory
|
||||||
Check Docker volume mounts
|
Check Docker volume mounts
|
||||||
|
|
||||||
Logs
|
## Logs
|
||||||
|
|
||||||
Application logs are printed to stdout. In Docker:
|
Application logs are printed to stdout. In Docker:
|
||||||
|
|
||||||
bash
|
```bash
|
||||||
|
|
||||||
docker-compose logs -f notebook-viewer
|
docker-compose logs -f notebook-viewer
|
||||||
|
```
|
||||||
|
|
||||||
Contributing
|
## License
|
||||||
|
|
||||||
Fork the repository
|
|
||||||
Enter the development environment: nix develop
|
|
||||||
Make your changes
|
|
||||||
Run tests: run-tests
|
|
||||||
Submit a pull request
|
|
||||||
|
|
||||||
License
|
|
||||||
|
|
||||||
MIT License - see LICENSE file for details.
|
MIT License - see LICENSE file for details.
|
||||||
Architecture
|
Architecture
|
||||||
|
|
||||||
┌─────────────────────────────────────────────────────────────┐
|
|
||||||
│ Web Browser │
|
|
||||||
└─────────────────────┬───────────────────────────────────────┘
|
|
||||||
│ HTTP
|
|
||||||
┌─────────────────────▼───────────────────────────────────────┐
|
|
||||||
│ Flask App │
|
|
||||||
│ ┌─────────────┐ ┌──────────────┐ ┌─────────────────────┐ │
|
|
||||||
│ │ Routes │ │ Templates │ │ Static Assets │ │
|
|
||||||
│ └─────────────┘ └──────────────┘ └─────────────────────┘ │
|
|
||||||
└─────────────────────┬───────────────────────────────────────┘
|
|
||||||
│ File System
|
|
||||||
┌─────────────────────▼───────────────────────────────────────┐
|
|
||||||
│ JupyterHub Shared Directory │
|
|
||||||
│ ┌─────────────┐ ┌──────────────┐ ┌─────────────────────┐ │
|
|
||||||
│ │ Notebooks │ │ Directories │ │ Other Files │ │
|
|
||||||
│ │ (.ipynb) │ │ │ │ (.py, .md) │ │
|
|
||||||
│ └─────────────┘ └──────────────┘ └─────────────────────┘ │
|
|
||||||
└─────────────────────────────────────────────────────────────┘
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user