Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
.env.*.local
*.key
*.pem
*.crt
*.csr

# OS files
.DS_Store
Expand Down
10 changes: 9 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ python run.py
cd frontend && npm install && npm run dev

# Both at once (Linux/WSL)
./scripts/dev/start.sh
./dev.sh

# Frontend lint
cd frontend && npm run lint
Expand Down Expand Up @@ -75,6 +75,14 @@ Browser → Nginx (`:80`/`:443`) → proxy_pass to Docker containers (`:8001-899

The Dockerfile is multi-stage: Node 20 builds frontend, Python 3.11 serves everything via Gunicorn with GeventWebSocket workers. Built frontend is served from Flask's static folder.

## Platform & Distro Awareness

ServerKit deploys on Linux (bare metal, VPS, or Docker). Development may happen on Windows/macOS.

- **Service layer is Linux-only** — nginx, systemctl, apt/dnf, PHP-FPM, etc. are inherently Linux. No need to abstract these for Windows.
- **Platform-agnostic code** (config management, storage, API layer) should guard Unix-only calls like `os.chmod` with `if os.name != 'nt'` so the dev server can run locally on any OS.
- **Distro differences matter** — use `backend/app/utils/system.py` helpers (`get_package_manager`, `is_package_installed`, `install_package`) instead of calling `apt`/`dpkg`/`dnf` directly. Not all targets are Debian-based.

## Code Style

### Python
Expand Down
29 changes: 24 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ chmod +x ./scripts/dev/*.sh
./scripts/dev/setup-wsl.sh

# 3. Start dev servers
./scripts/dev/start.sh
./dev.sh
```

Open http://localhost:5173 — login: `admin` / `admin`
Expand All @@ -31,7 +31,7 @@ Open http://localhost:5173 — login: `admin` / `admin`

```bash
./scripts/dev/setup-linux.sh
./scripts/dev/start.sh
./dev.sh
```

### Docker
Expand All @@ -47,7 +47,7 @@ docker compose -f docker-compose.dev.yml up --build # Linux/Mac

| Task | Command |
|------|---------|
| Start both | `./scripts/dev/start.sh` |
| Start both | `./dev.sh` |
| Backend only | `cd backend && source venv/bin/activate && python run.py` |
| Frontend only | `cd frontend && npm run dev` |
| Build frontend | `cd frontend && npm run build` |
Expand All @@ -72,6 +72,7 @@ docker compose -f docker-compose.dev.yml up --build # Linux/Mac
git clone https://github.com/YOUR_USERNAME/ServerKit.git
cd ServerKit
git remote add upstream https://github.com/jhd3197/ServerKit.git
git checkout dev
```

### Backend Setup
Expand Down Expand Up @@ -258,6 +259,22 @@ npm test
npm run test:coverage # With coverage
```

### Validate Before Submitting

Run the dev validation suite to check for common issues:

```powershell
# Windows
.\dev.ps1 validate
```

```bash
# Linux/macOS
./dev.sh validate
```

This runs eslint, bandit (security scanner), pytest, and a frontend production build.

### Manual Testing

Before submitting, test your changes:
Expand All @@ -276,7 +293,7 @@ Before submitting, test your changes:
1. **Update your fork:**
```bash
git fetch upstream
git rebase upstream/main
git rebase upstream/dev
```

2. **Push your branch:**
Expand All @@ -285,10 +302,12 @@ Before submitting, test your changes:
```

3. **Create Pull Request:**
- Go to GitHub and create a PR
- Go to GitHub and create a PR **targeting the `dev` branch** (not `main`)
- Fill out the PR template
- Link any related issues

> **Important:** All PRs should target the `dev` branch, not `main`. The `main` branch is reserved for stable releases.

4. **PR Description:**
- Describe what changed and why
- Include screenshots for UI changes
Expand Down
18 changes: 9 additions & 9 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,18 @@ This document outlines the development roadmap for ServerKit. Features are organ

---

## Phase 12: Backup & Restore (Planned)
## Phase 12: Backup & Restore (Completed)

**Priority: High**

- [ ] Automated database backups
- [ ] File/directory backups
- [ ] S3-compatible storage support
- [ ] Backblaze B2 integration
- [ ] Backup scheduling
- [ ] One-click restore
- [ ] Backup retention policies
- [ ] Offsite backup verification
- [x] Automated database backups
- [x] File/directory backups
- [x] S3-compatible storage support
- [x] Backblaze B2 integration
- [x] Backup scheduling
- [x] One-click restore
- [x] Backup retention policies
- [x] Offsite backup verification

---

Expand Down
12 changes: 11 additions & 1 deletion backend/.bandit
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
exclude_dirs = tests,venv,.venv

# Skip checks that are expected noise for a server management tool:
# B108: hardcoded_tmp_directory — intentional temp dirs for sync operations
# B110: try_except_pass — cleanup/daemon patterns throughout codebase
# B310: urllib_urlopen — internal diagnostic and update-check calls
# B321: ftplib — FTP service exists by design
# B402: import_ftplib — same as above
# B404: import_subprocess — we intentionally use subprocess throughout
# B602: subprocess_popen_with_shell_equals_true — build/cron/deploy hooks require shell
# B603: subprocess_without_shell_check — we use subprocess.run deliberately
# B607: start_process_with_partial_path — expected for system commands
skips = B404,B603,B607
# B608: hardcoded_sql_expressions — admin-only DB service with internal calls, not user input
# B105: hardcoded_password_string — false positives on empty-string defaults and mask values
# B112: try_except_continue — same pattern as B110, used in iteration/cleanup loops
# B311: random — used for non-security port selection, not crypto
skips = B105,B108,B110,B112,B310,B311,B321,B402,B404,B602,B603,B607,B608
7 changes: 7 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ __pycache__/
*.so
.Python
venv/
.venv/
env/
ENV/
.env.local
.env.*.local
*.key
*.pem
*.crt
*.csr

# Database
*.db
Expand Down
Loading