Manual Compilation
Build ElasticView from source code for custom configurations, development, or when pre-built binaries are not available for your platform.
Prerequisites
Required Tools
- Go: Version 1.19 or higher
- Node.js: Version 16 or higher
- npm or yarn: Package manager
- Git: For cloning the repository
System Requirements
- RAM: 4GB or more (for compilation)
- Storage: 2GB free space
- OS: Linux, macOS, or Windows
Build Steps
1. Clone Repository
bash
git clone https://github.com/1340691923/ElasticView.git
cd ElasticView2. Install Dependencies
Frontend Dependencies
bash
cd web
npm install
# or
yarn installBackend Dependencies
bash
cd ../
go mod download3. Build Frontend
bash
cd web
npm run build
# or
yarn build4. Build Backend
bash
cd ../
go build -o elasticview main.go5. Run ElasticView
bash
./elasticviewAdvanced Build Options
Cross-Platform Compilation
For Linux
bash
GOOS=linux GOARCH=amd64 go build -o elasticview-linux-amd64 main.goFor Windows
bash
GOOS=windows GOARCH=amd64 go build -o elasticview-windows-amd64.exe main.goFor macOS
bash
GOOS=darwin GOARCH=amd64 go build -o elasticview-darwin-amd64 main.goOptimized Build
bash
go build -ldflags="-s -w" -o elasticview main.goWith Version Information
bash
go build -ldflags="-X main.version=v1.0.0 -X main.buildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)" -o elasticview main.goDevelopment Setup
Hot Reload Development
Backend (with air)
bash
# Install air for hot reload
go install github.com/cosmtrek/air@latest
# Run with hot reload
airFrontend
bash
cd web
npm run dev
# or
yarn devRunning Tests
bash
# Run all tests
go test ./...
# Run with coverage
go test -cover ./...
# Frontend tests
cd web
npm testBuild Scripts
Create a build script for automation:
Linux/macOS (build.sh)
bash
#!/bin/bash
echo "Building ElasticView..."
# Build frontend
echo "Building frontend..."
cd web
npm install
npm run build
cd ..
# Build backend
echo "Building backend..."
go mod download
go build -ldflags="-s -w" -o elasticview main.go
echo "Build complete!"Windows (build.bat)
batch
@echo off
echo Building ElasticView...
echo Building frontend...
cd web
npm install
npm run build
cd ..
echo Building backend...
go mod download
go build -ldflags="-s -w" -o elasticview.exe main.go
echo Build complete!Troubleshooting
Go Module Issues
bash
go clean -modcache
go mod downloadNode.js Memory Issues
bash
export NODE_OPTIONS="--max-old-space-size=4096"
npm run buildPermission Issues
bash
chmod +x build.sh
./build.shContributing
Development Workflow
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
Code Standards
- Follow Go conventions
- Use gofmt for formatting
- Add tests for new features
- Update documentation
