chore: consolidate env templates and remove Docker docs from master
- Merge .env.production.template into .env.example - Remove Docker Deployment section from CLAUDE.md (now on docker branch) - Update README.md to reference .env.example - Update environment variable documentation Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
41
.env.example
41
.env.example
@@ -1,22 +1,47 @@
|
|||||||
# Application Configuration
|
# Application Configuration
|
||||||
# Copy this file to .env and update with your values
|
# Copy this file to .env and update with your values
|
||||||
|
|
||||||
# Hostname for the application (e.g., https://awards.dj7nt.de)
|
# ===================================================================
|
||||||
|
# Environment
|
||||||
|
# ===================================================================
|
||||||
|
# Development: development
|
||||||
|
# Production: production
|
||||||
|
NODE_ENV=development
|
||||||
|
|
||||||
|
# Log Level (debug, info, warn, error)
|
||||||
|
# Development: debug
|
||||||
|
# Production: info
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
# Server Port (default: 3001)
|
||||||
|
PORT=3001
|
||||||
|
|
||||||
|
# ===================================================================
|
||||||
|
# URLs
|
||||||
|
# ===================================================================
|
||||||
|
# Frontend URL (e.g., https://awards.dj7nt.de)
|
||||||
# Leave empty for development (uses localhost)
|
# Leave empty for development (uses localhost)
|
||||||
VITE_APP_URL=
|
VITE_APP_URL=
|
||||||
|
|
||||||
# API Base URL (in production, can be same domain or separate)
|
# API Base URL (leave empty for same-domain deployment)
|
||||||
# Leave empty to use relative paths (recommended for same-domain deployment)
|
# Only set if API is on different domain
|
||||||
VITE_API_BASE_URL=
|
VITE_API_BASE_URL=
|
||||||
|
|
||||||
# Allowed CORS origins for backend (comma-separated)
|
# Allowed CORS origins for backend (comma-separated)
|
||||||
# Only needed for production if not using same domain
|
# Add all domains that should access the API
|
||||||
# Example: https://awards.dj7nt.de,https://www.awards.dj7nt.de
|
# Example: https://awards.dj7nt.de,https://www.awards.dj7nt.de
|
||||||
ALLOWED_ORIGINS=
|
ALLOWED_ORIGINS=
|
||||||
|
|
||||||
# JWT Secret (for production, use a strong random string)
|
# ===================================================================
|
||||||
# Generate with: openssl rand -base64 32
|
# Security
|
||||||
|
# ===================================================================
|
||||||
|
# JWT Secret (REQUIRED for production)
|
||||||
|
# Development: uses default if not set
|
||||||
|
# Production: Generate with: openssl rand -base64 32
|
||||||
JWT_SECRET=change-this-in-production
|
JWT_SECRET=change-this-in-production
|
||||||
|
|
||||||
# Node Environment
|
# ===================================================================
|
||||||
NODE_ENV=development
|
# Database (Optional)
|
||||||
|
# ===================================================================
|
||||||
|
# Leave empty to use default SQLite database
|
||||||
|
# DATABASE_URL=file:/path/to/custom.db
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
# Production Configuration Template
|
|
||||||
# Copy this file to .env.production and update with your production values
|
|
||||||
|
|
||||||
# Application Environment
|
|
||||||
NODE_ENV=production
|
|
||||||
|
|
||||||
# Log Level (debug, info, warn, error)
|
|
||||||
# Recommended: info for production
|
|
||||||
LOG_LEVEL=info
|
|
||||||
|
|
||||||
# Server Port (default: 3001)
|
|
||||||
PORT=3001
|
|
||||||
|
|
||||||
# Frontend URL (e.g., https://awards.dj7nt.de)
|
|
||||||
VITE_APP_URL=https://awards.dj7nt.de
|
|
||||||
|
|
||||||
# API Base URL (leave empty for same-domain deployment)
|
|
||||||
VITE_API_BASE_URL=
|
|
||||||
|
|
||||||
# Allowed CORS origins (comma-separated)
|
|
||||||
# Add all domains that should access the API
|
|
||||||
ALLOWED_ORIGINS=https://awards.dj7nt.de,https://www.awards.dj7nt.de
|
|
||||||
|
|
||||||
# JWT Secret (REQUIRED - generate a strong secret!)
|
|
||||||
# Generate with: openssl rand -base64 32
|
|
||||||
JWT_SECRET=REPLACE_WITH_SECURE_RANDOM_STRING
|
|
||||||
|
|
||||||
# Database (if using external database)
|
|
||||||
# Leave empty to use default SQLite database
|
|
||||||
# DATABASE_URL=file:/path/to/production.db
|
|
||||||
52
CLAUDE.md
52
CLAUDE.md
@@ -77,58 +77,6 @@ test("hello world", () => {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## Docker Deployment
|
|
||||||
|
|
||||||
The application supports Docker deployment with single-port architecture and host-mounted database persistence.
|
|
||||||
|
|
||||||
**Quick Start**:
|
|
||||||
```bash
|
|
||||||
# Create environment file
|
|
||||||
cp .env.docker.example .env
|
|
||||||
|
|
||||||
# Generate JWT secret
|
|
||||||
openssl rand -base64 32 # Add to .env as JWT_SECRET
|
|
||||||
|
|
||||||
# Start application
|
|
||||||
docker-compose up -d --build
|
|
||||||
|
|
||||||
# Access at http://localhost:3001
|
|
||||||
```
|
|
||||||
|
|
||||||
**Architecture**:
|
|
||||||
- **Single Port**: Port 3001 serves both API (`/api/*`) and frontend (all other routes)
|
|
||||||
- **Database Persistence**: SQLite database stored at `./data/award.db` on host
|
|
||||||
- **Auto-initialization**: Database created from template on first startup
|
|
||||||
- **Health Checks**: Built-in health monitoring at `/api/health`
|
|
||||||
|
|
||||||
**Key Docker Files**:
|
|
||||||
- `Dockerfile`: Multi-stage build using official Bun runtime
|
|
||||||
- `docker-compose.yml`: Stack orchestration with volume mounts
|
|
||||||
- `docker-entrypoint.sh`: Database initialization logic
|
|
||||||
- `.env.docker.example`: Environment variable template
|
|
||||||
- `DOCKER.md`: Complete deployment documentation
|
|
||||||
|
|
||||||
**Environment Variables**:
|
|
||||||
- `NODE_ENV`: Environment mode (default: production)
|
|
||||||
- `PORT`: Application port (default: 3001)
|
|
||||||
- `LOG_LEVEL`: Logging level (debug/info/warn/error)
|
|
||||||
- `JWT_SECRET`: JWT signing secret (required, change in production!)
|
|
||||||
- `VITE_APP_URL`: Your application's public URL
|
|
||||||
- `ALLOWED_ORIGINS`: CORS allowed origins (comma-separated)
|
|
||||||
|
|
||||||
**Database Management**:
|
|
||||||
- Database location: `./data/award.db` (host-mounted volume)
|
|
||||||
- Backups: `cp data/award.db data/award.db.backup.$(date +%Y%m%d)`
|
|
||||||
- Reset: `docker-compose down -v && docker-compose up -d`
|
|
||||||
|
|
||||||
**Important Notes**:
|
|
||||||
- Database persists across container restarts/recreations
|
|
||||||
- Frontend dependencies are reinstalled in container to ensure correct platform binaries
|
|
||||||
- Uses custom init script (`src/backend/scripts/init-db.js`) with `bun:sqlite`
|
|
||||||
- Architecture-agnostic (works on x86, ARM64, etc.)
|
|
||||||
|
|
||||||
For detailed documentation, see `DOCKER.md`.
|
|
||||||
|
|
||||||
## Frontend
|
## Frontend
|
||||||
|
|
||||||
Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
|
Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
|
||||||
|
|||||||
56
README.md
56
README.md
@@ -116,7 +116,7 @@ award/
|
|||||||
│ └── package.json
|
│ └── package.json
|
||||||
├── award-definitions/ # Award rule definitions (JSON)
|
├── award-definitions/ # Award rule definitions (JSON)
|
||||||
├── award.db # SQLite database (auto-created)
|
├── award.db # SQLite database (auto-created)
|
||||||
├── .env.production.template # Production configuration template
|
├── .env.example # Environment configuration template
|
||||||
├── bunfig.toml # Bun configuration
|
├── bunfig.toml # Bun configuration
|
||||||
├── drizzle.config.js # Drizzle ORM configuration
|
├── drizzle.config.js # Drizzle ORM configuration
|
||||||
├── package.json
|
├── package.json
|
||||||
@@ -149,20 +149,32 @@ cp .env.example .env
|
|||||||
|
|
||||||
Edit `.env` with your configuration:
|
Edit `.env` with your configuration:
|
||||||
```env
|
```env
|
||||||
# Application URL (for production deployment)
|
# Environment (development/production)
|
||||||
VITE_APP_URL=https://awards.dj7nt.de
|
NODE_ENV=development
|
||||||
|
|
||||||
|
# Log Level (debug/info/warn/error)
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
# Server Port (default: 3001)
|
||||||
|
PORT=3001
|
||||||
|
|
||||||
|
# Frontend URL (e.g., https://awards.dj7nt.de)
|
||||||
|
# Leave empty for development (uses localhost)
|
||||||
|
VITE_APP_URL=
|
||||||
|
|
||||||
# API Base URL (leave empty for same-domain deployment)
|
# API Base URL (leave empty for same-domain deployment)
|
||||||
VITE_API_BASE_URL=
|
VITE_API_BASE_URL=
|
||||||
|
|
||||||
# JWT Secret (generate with: openssl rand -base64 32)
|
# Allowed CORS origins (comma-separated)
|
||||||
JWT_SECRET=your-generated-secret-here
|
# Add all domains that should access the API
|
||||||
|
ALLOWED_ORIGINS=
|
||||||
|
|
||||||
# Environment
|
# JWT Secret (generate with: openssl rand -base64 32)
|
||||||
NODE_ENV=production
|
JWT_SECRET=change-this-in-production
|
||||||
```
|
```
|
||||||
|
|
||||||
**For development**: You can leave `.env` empty or use defaults.
|
**For development**: Use defaults above.
|
||||||
|
**For production**: Set `NODE_ENV=production`, `LOG_LEVEL=info`, and generate a strong `JWT_SECRET`.
|
||||||
|
|
||||||
4. Initialize the database with performance indexes:
|
4. Initialize the database with performance indexes:
|
||||||
```bash
|
```bash
|
||||||
@@ -414,20 +426,26 @@ bun run build
|
|||||||
Create `.env` in the project root:
|
Create `.env` in the project root:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Application URL
|
|
||||||
VITE_APP_URL=https://awards.dj7nt.de
|
|
||||||
|
|
||||||
# API Base URL (empty for same-domain)
|
|
||||||
VITE_API_BASE_URL=
|
|
||||||
|
|
||||||
# JWT Secret (generate with: openssl rand -base64 32)
|
|
||||||
JWT_SECRET=your-generated-secret-here
|
|
||||||
|
|
||||||
# Environment
|
# Environment
|
||||||
NODE_ENV=production
|
NODE_ENV=production
|
||||||
|
|
||||||
# Database path (absolute path recommended)
|
# Log Level (debug/info/warn/error)
|
||||||
DATABASE_PATH=/path/to/award/award.db
|
LOG_LEVEL=info
|
||||||
|
|
||||||
|
# Server Port (default: 3001)
|
||||||
|
PORT=3001
|
||||||
|
|
||||||
|
# Frontend URL
|
||||||
|
VITE_APP_URL=https://awards.dj7nt.de
|
||||||
|
|
||||||
|
# API Base URL (leave empty for same-domain deployment)
|
||||||
|
VITE_API_BASE_URL=
|
||||||
|
|
||||||
|
# Allowed CORS origins (comma-separated)
|
||||||
|
ALLOWED_ORIGINS=https://awards.dj7nt.de,https://www.awards.dj7nt.de
|
||||||
|
|
||||||
|
# JWT Secret (generate with: openssl rand -base64 32)
|
||||||
|
JWT_SECRET=your-generated-secret-here
|
||||||
```
|
```
|
||||||
|
|
||||||
**Security**: Ensure `.env` has restricted permissions:
|
**Security**: Ensure `.env` has restricted permissions:
|
||||||
|
|||||||
Reference in New Issue
Block a user