Commit Graph

29 Commits

Author SHA1 Message Date
24cf84fda3 팜큐 관리자 시스템 구현 가이드 및 설계 원칙 문서 추가
- Headscale CLI 기반 제어 방식의 핵심 아키텍처 설명
- 이중 데이터베이스 전략 및 실시간 동기화 방법론 정리
- 실제 구현 코드 예시와 표준 패턴 제시
- Phase별 기능 확장 로드맵 및 개발 가이드라인
- 성능 최적화, 보안, 디버깅 방안 포함
- 향후 모든 기능 구현의 기준 문서로 활용

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 10:49:48 +09:00
45c952258b Add node deletion functionality to FARMQ Admin
- Add DELETE API endpoint for node deletion via Headscale CLI
- Add delete buttons to both table and card views in machine list
- Implement confirmation dialog with clear warning message
- Add proper error handling and user feedback with toast messages
- Auto-refresh page after successful deletion
- Match Headplane functionality for complete node management

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 10:44:49 +09:00
11f6ff16d0 Implement real-time online status synchronization with Headplane
- Add Headscale CLI integration to get real-time online status
- Replace timeout-based logic with exact same logic as Headplane
- Use 'online' field from Headscale CLI JSON output
- Update dashboard statistics to show 3 online nodes matching Headplane
- Update pharmacy and machine management views with real-time status

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 10:38:14 +09:00
1f0afd4cae Fix machine count display and pharmacy edit functionality
🔧 Machine Management Fixes:
- Fix duplicate machine counting (was showing 10 instead of 5)
- Update dashboard stats to use Headscale nodes instead of FARMQ profiles
- Fix JavaScript counting to only count active view (List/Card)
- Add view change listeners to update counters correctly

🏥 Pharmacy Management Fixes:
- Add API endpoint for individual pharmacy data retrieval
- Fix pharmacy edit modal to load existing data as form values
- Add proper form validation and error handling
- Implement edit vs add mode detection

📊 Database Integration:
- Improve machine counting logic using Headscale Node table
- Fix online/offline status calculation with 5-minute threshold
- Add debug logging for machine data retrieval

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 09:41:55 +09:00
5d89277e5c Fix Tailscale download URLs: Use dynamic version detection
- Add GitHub API integration to get latest Tailscale version
- Fix broken download URLs by using correct versioned filenames
- Add fallback version (1.86.2) if API call fails
- Update both English and Korean PowerShell scripts
- Resolves download errors in installation process

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 08:34:43 +09:00
bd33604982 Fix infinite loop in PowerShell script: Rename function to avoid collision
- Rename Test-Connection function to Test-NetworkConnection
- Fix PowerShell function name collision with built-in cmdlet
- Use fully qualified names for PowerShell Test-Connection cmdlet
- Resolves infinite recursion in network verification

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 01:03:40 +09:00
176c6bb1c2 Update documentation for PowerShell encoding fix
- Update README.md with English PowerShell commands
- Update WINDOWS_QUICK_START.md with encoding issue solution
- Add FAQ section for Korean character encoding problems
- Recommend farmq-install-en.ps1 to prevent character display issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 01:01:36 +09:00
b7c621f294 Fix PowerShell encoding issues: Add English-only version
- Add farmq-install-en.ps1 with UTF-8 encoding support
- Remove Korean characters to prevent PowerShell encoding issues
- Use ASCII-only status indicators ([*], [+], [!])
- Maintain all functionality while ensuring compatibility

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 01:00:28 +09:00
09cdb088af Add Windows installation section to README and create quick start guide
- Add Windows PowerShell one-click installation to main README
- Create comprehensive Windows quick start guide (WINDOWS_QUICK_START.md)
- Provide copy-paste friendly commands for easy execution
- Include step-by-step instructions with screenshots example
- Add FAQ section for common PowerShell execution issues
- Include troubleshooting guide for Windows-specific problems
- Add useful post-installation commands reference

Features:
- Copy-paste optimized command formatting
- Clear 3-step installation process
- Administrator PowerShell access instructions
- Force reinstall option for existing Tailscale installations
- Windows Defender firewall handling
- Network connectivity verification

🚀 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 00:55:31 +09:00
ea11f92070 Add Windows PowerShell one-click installation script
- Complete PowerShell script with colorful output and error handling
- Auto-detect existing Tailscale installations
- Smart handling of existing connections (like Linux version)
- Administrator privilege checking with clear instructions
- Automatic Tailscale download and silent installation
- Windows Defender firewall configuration
- Network connectivity testing and verification
- Comprehensive final status report

Features:
- One-line web execution support
- Force reinstall option (-Force parameter)
- Detailed system information display
- Graceful error handling and cleanup
- Windows-native user experience

🚀 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 00:54:13 +09:00
f69ee95443 Add support for root account execution without sudo
- Update script comments and documentation for root vs regular users
- Improve error message for missing root privileges
- Add separate command examples for root accounts (Proxmox, containers, etc.)
- Update README and installation guide with both sudo and non-sudo examples

🚀 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 00:44:44 +09:00
591173d1cf Enhanced script to handle existing Tailscale connections
- Add automatic detection of existing Tailscale/Headscale connections
- Implement smart server comparison to avoid unnecessary re-registration
- Add --force option for mandatory re-registration
- Improve user interaction for terminal vs pipe execution
- Add better logout verification with retry logic
- Update documentation with force registration examples
- Change default behavior to auto-register (Y) instead of skip (N)

🚀 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 00:42:38 +09:00
7e32632186 Add one-click client installation section to README
- Add quick installation commands for new servers
- Include support for multiple Linux distributions
- Maintain original README structure and content
- Add curl/wget installation methods

🚀 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 00:37:05 +09:00
522d39d3df Add comprehensive quick installation guide and update server URLs
- Complete installation guide with examples and troubleshooting
- Update Headscale server URL to https://head.0bin.in
- Add support information and network configuration details
- Include colored terminal output examples

🚀 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 00:33:04 +09:00
8bd6b1f400 Add one-click installation script for Headscale clients
- Complete automated script for Tailscale + Headscale registration
- Support for Ubuntu, Debian, CentOS, RHEL, Rocky, Fedora, Arch
- Universal binary fallback for unsupported distros
- Automatic firewall configuration
- Network connectivity verification
- Fix Headscale health check (nc -> headscale version)
- Add comprehensive error handling and colored output

🚀 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 00:30:47 +09:00
53c1f45e02 🚀 Add complete client registration system for FARMQ Headscale
## New Features:
- **register-client.sh**: Automated client registration script
  - Auto-detects OS (Ubuntu/CentOS/macOS)
  - Installs Tailscale automatically
  - Registers to https://head.0bin.in with pre-auth key
  - Verifies connection and displays status

- **create-preauth-key.sh**: Pre-auth key management script
  - Creates users and pre-auth keys with custom expiration
  - Supports reusable keys for multiple devices
  - Provides ready-to-use registration commands
  - Example: `./create-preauth-key.sh pharmacy1 7d`

- **CLIENT_SETUP_GUIDE.md**: Complete installation guide
  - Automated and manual installation instructions
  - Cross-platform support (Linux/macOS/Windows/Mobile)
  - Troubleshooting section
  - Key management for admins

## Pharmacy Page Fix:
- Fix machine count display in pharmacy management page
- Update get_all_pharmacies_with_stats() to use actual Headscale Node data
- Show correct online/offline machine counts per pharmacy
- Fixed: "0대" → "2대 online" for proper machine statistics

## Key Benefits:
- **One-line registration**: `sudo ./register-client.sh`
- **Pre-auth keys work once, connect forever** - answers user's question
- **Reusable keys** for multiple devices per pharmacy
- **Cross-platform** support for all major operating systems

Current active keys:
- myuser: fc4f2dc55ee00c5352823d156129b9ce2df4db02f1d76a21
- pharmacy1: 5c15b41ea8b135dbed42455ad1a9a0cf0352b100defd241c (7d validity)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 18:23:04 +09:00
1ea11a6a3c 🔧 Fix machine connectivity and pharmacy display issues
- Fix database initialization to use correct Headscale DB path
- Implement proper data synchronization between Headscale and FARMQ
- Resolve timezone comparison error in machine online status detection
- Update machine listing to use actual Headscale Node data instead of MachineProfile
- Add proper pharmacy-to-machine mapping display
- Show both technical Headscale usernames and actual pharmacy business names
- Fix machine offline status display - now correctly shows online machines
- Add humanize_datetime utility function for better timestamp display

All machines now correctly display:
- Online status (matching actual Headscale status)
- Technical username (myuser)
- Actual pharmacy name (세종온누리약국)
- Manager name and business details

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 17:56:38 +09:00
ca61a89739 🏥 Add complete FARMQ Admin Flask application
## Features
- 한국어 Flask 관리 인터페이스 with Bootstrap 5
- Headscale과 분리된 독립 데이터베이스 구조
- 약국 관리 시스템 (pharmacy management)
- 머신 모니터링 및 상태 관리
- 실시간 대시보드 with 통계 및 알림
- Headscale 사용자명과 약국명 분리 관리

## Database Architecture
- 별도 FARMQ SQLite DB (farmq.sqlite)
- Headscale DB와 외래키 충돌 방지
- 느슨한 결합 설계 (ID 참조만 사용)

## UI Components
- 반응형 대시보드 with 실시간 통계
- 약국별 머신 상태 모니터링
- 한국어 지역화 및 사용자 친화적 인터페이스
- 머신 온라인/오프라인 상태 표시 (24시간 타임아웃)

## API Endpoints
- `/api/sync/machines` - Headscale 머신 동기화
- `/api/sync/users` - Headscale 사용자 동기화
- `/api/pharmacy/<id>/update` - 약국 정보 업데이트
- 대시보드 통계 및 알림 API

## Problem Resolution
- Fixed foreign key conflicts preventing Windows client connections
- Resolved machine online status detection with proper timeout handling
- Separated technical Headscale usernames from business pharmacy names

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 17:44:56 +09:00
9155bf5479 📝 Update .gitignore to exclude Python virtual environments and cache files
Add comprehensive Python gitignore patterns:
- Virtual environments (venv/, env/, .venv/)
- Python cache files (__pycache__/, *.pyc)
- Distribution files (dist/, build/, *.egg-info/)
- Testing artifacts (.pytest_cache/, .coverage)
- Development tools (.mypy_cache/, .tox/)

Prevents accidental commit of:
- Virtual environment directories
- Python bytecode cache
- Build artifacts
- IDE and testing files

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 15:53:11 +09:00
92091bfe88 🗃️ Add comprehensive SQLAlchemy models for Headscale database
Core Models (based on actual DB schema analysis):
- User: Headscale users with relationships
- Node: Connected machines with detailed host info
- PreAuthKey: Pre-authentication keys with validation
- ApiKey: API authentication keys with expiration
- Policy: ACL policies (JSON format)

Extended Models for FARMQ:
- PharmacyInfo: Pharmacy details (name, business number, contact)
- MachineSpecs: Hardware specifications per machine
- MonitoringData: Real-time monitoring metrics

Features:
- Complete database relationships and foreign keys
- JSON type handling for complex data structures
- Timezone-aware datetime handling
- Helper methods (is_online, is_expired, is_valid)
- Database utility functions
- Comprehensive test suite with actual data validation

Test Results:  All models working with live Headscale SQLite DB
- 1 User: myuser
- 1 Node: 0bin-Ubuntu-VM (100.64.0.1)
- 1 API Key: 8qRr1IB (valid until Dec 2025)
- 1 Pre-auth Key: reusable, valid
- Extended tables created and tested successfully

Ready for FARMQ pharmacy management system integration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 15:47:16 +09:00
247b9dbee7 🏥 Add FARMQ Headplane customization business plan
Comprehensive business plan for customizing Headplane for FARMQ:
- Company overview: 100 pharmacies with Proxmox infrastructure
- Current system analysis: Working Headscale + Headplane setup
- Enhancement requirements: Pharmacy info, machine specs, monitoring
- Database schema design: pharmacy_info, machine_specs, monitoring_data
- Implementation approaches: Fork vs separate system vs plugin
- Technical specifications: React frontend + API backend + Proxmox integration
- Development roadmap: 4-5 weeks phased implementation
- Success metrics and cost analysis

Ready for pharmacy management system development based on existing Headplane.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 15:34:12 +09:00
c3963fc26c 📋 Add Headplane Korean localization plan
- Comprehensive analysis of current Headplane i18n status
- 4 different implementation approaches with pros/cons
- Phase-by-phase implementation plan (browser extension → env vars → react-i18next)
- Detailed Korean translation mappings for UI elements
- Implementation examples and code snippets
- Progress checklist for tracking localization work

Ready to start with browser extension approach for immediate Korean UI.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 15:24:04 +09:00
6e8a7b81fb 📚 Update documentation with Headplane UI access and configuration
- Update INSTALLATION_GUIDE.md:
  * Add Headplane configuration section with proper config.yaml
  * Update docker-compose.yml example with simplified environment variables
  * Add Headplane login instructions and API key information
  * Update troubleshooting section for cookie_secret validation errors
- Update CLIENT_CONNECTION_TEST.md:
  * Add Headplane web UI access information
  * Include external access URL (192.168.0.151:3000/admin/)
  * Add login credentials and API key details
- Update start.sh:
  * Include Headplane UI URLs in installation summary
  * Add external access information for network environments

All documentation now reflects the working Headplane UI configuration
and provides complete setup instructions for both local and external access.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 15:12:54 +09:00
3c6723bcde 🔧 Fix Headplane UI configuration and enable external access
- Update docker-compose.yml: simplify environment variables
- Fix headplane-config/config.yaml with proper configuration:
  * Add required server section with correct cookie_secret (32 chars)
  * Configure headscale connection with API key
  * Enable external access via 192.168.0.151:3000/admin/
- Resolve configuration validation errors
- Headplane UI now fully accessible and functional

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 15:10:56 +09:00
76e727fb99 📚 Add comprehensive documentation for Headscale setup and testing
 새로운 문서 추가:
- INSTALLATION_GUIDE.md: 완전한 설치 가이드
  * Docker Compose 설정 상세 설명
  * 최신 Headscale 설정 형식 적용
  * 포트 충돌 해결 방법
  * 단계별 설치 과정
  * 문제 해결 가이드

- CLIENT_CONNECTION_TEST.md: 클라이언트 연결 테스트 가이드
  * Tailscale 클라이언트 설치 과정
  * Headscale 서버 연결 방법
  * 네트워크 인터페이스 확인
  * 성능 테스트 및 모니터링
  * 다중 플랫폼 연결 방법

🔧 기술적 세부사항:
- 포트 8070 사용으로 충돌 방지
- IPv4/IPv6 듀얼 스택 지원
- Pre-auth 키 기반 자동 인증
- Magic DNS 설정 포함
- Docker 헬스체크 개선

📊 검증된 기능:
-  VPN 터널 구성 (100.64.0.1/32)
-  실시간 노드 관리
-  0% 패킷 손실 확인
-  WireGuard 암호화 적용

🎯 사용자 가이드:
- 초보자도 쉽게 따라할 수 있는 단계별 안내
- 문제 상황별 해결 방법 제시
- 성능 테스트 및 모니터링 방법
- 다중 클라이언트 연결 가이드

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 14:46:29 +09:00
52cc779bca 🎉 Working Headscale Setup with Docker Complete
 주요 성과:
- Headscale 서버 정상 작동 (포트 8070)
- 포트 충돌 문제 해결 (8080 → 8070)
- 최신 Headscale 설정 형식 적용
- 사용자 생성 및 Pre-auth 키 생성 성공
- Docker Compose 완전 설정

🔧 수정된 구성:
- docker-compose.yml: 포트 매핑 및 헬스체크 개선
- config/config.yaml: 최신 DNS 및 Policy 설정 적용
- .env.example: 8070 포트로 업데이트
- README.md: 올바른 접속 정보 및 명령어
- start.sh: 향상된 설치 스크립트

📊 성공한 기능들:
-  Headscale API: http://localhost:8070
-  사용자 생성: myuser (ID: 1)
-  API 키 생성: 8qRr1IB.tV95CmA0fLaCiGGIgBfeoN9daHceFkzI
-  Pre-auth 키: fc4f2dc55ee00c5352823d156129b9ce2df4db02f1d76a21
-  SQLite 데이터베이스 설정

🚧 진행 중:
- Headplane UI 설정 (설정 파일 문제로 보류)
- 클라이언트 연결 테스트 준비 완료

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 14:34:56 +09:00
2045f6dfc0 🔧 Remove auto Git management and finalize setup scripts
 개선사항:
- 자동 Git 관리 기능 제거 (setup-complete.sh 삭제)
- start.sh에서 불필요한 자동화 제거
- README.md 정리 및 올바른 경로 수정
- 깔끔한 수동 설치 프로세스 완성

📝 수정된 파일들:
- start.sh: 설치만 집중, Git 자동화 제거
- README.md: 올바른 파일 구조와 실행 방법 안내
- 환경변수 설정 가이드 추가

🚀 이제 실제 설치 테스트 준비 완료!

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 17:00:18 +09:00
e0c4a9de3d 📝 Add missing files: README.md, config.yaml, start.sh
 추가된 파일들:
- README.md: 프로젝트 문서 및 사용법 가이드
- config/config.yaml: Headscale 완전 설정 파일
- start.sh: 원클릭 자동 설치 스크립트

🔧 설정 세부사항:
- SQLite 데이터베이스 기본 설정
- Magic DNS 활성화
- Korean 시간대 설정
- 보안 설정 포함

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 16:55:35 +09:00
9e7d0cd1bb Initial commit: Headscale + Headplane 완전 구축 프로젝트
🎯 프로젝트 목표:
- Tailscale 완전 대체하는 자체 호스팅 솔루션 구축
- Headscale + Headplane Docker Compose로 원클릭 설치
- Headplane 한글화 및 커스터마이징
- 완전한 VPN 관리 시스템 개발

🛠️ 기술 스택:
- Headscale: Tailscale 호환 컨트롤 서버
- Headplane: 웹 기반 관리 UI
- Docker & Docker Compose
- SQLite 데이터베이스
- 향후 PostgreSQL 지원 예정

🔧 주요 구성:
- docker-compose.yml: 멀티 컨테이너 구성
- config/config.yaml: Headscale 상세 설정
- start.sh: 자동화된 설치 스크립트
- .env: 환경변수 관리

📋 개발 계획:
1. 기본 설치 및 테스트
2. HTTPS/TLS 보안 구성
3. Headplane UI 한글화
4. 고급 네트워킹 설정
5. 모니터링 및 백업 시스템

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 16:50:25 +09:00