Complete LinkSyncServer and LinkSyncExtension implementation
LinkSyncServer: - Fix app.py imports, add CORS middleware, lifespan events - Create api/routes.py router aggregator - Create config/settings.py for centralized configuration - Rewrite models/base.py with proper relationships and serialization - Rewrite all API endpoints with real DB integration (auth, links, collections, sync, queries, tags) - Add admin endpoints (user management, stats, audit log) - Complete query parser with recursive descent and proper precedence - Complete query executor with set operations and field filters - Set up Alembic migrations with initial schema - Create web interface (templates, CSS, JS) - Add 42 passing tests (auth, links, collections, queries) - Add deploy.ps1 and deploy.sh scripts - Update README with deployment workflow LinkSyncExtension: - Create utils/api.js (REST client with retries, auth, error handling) - Create utils/sync.js (3 sync modes + conflict detection) - Create utils/collection.js (collection management) - Create utils/query-engine.js (client-side query parser) - Rewrite background.js (sync loop, bookmark events, message routing) - Rewrite popup.js (tabs, settings modal, notifications, CRUD) - Update popup.html (tabbed interface, query builder, modal) - Update popup.css (full redesign) - Create content/content.js (page metadata extraction) - Create options.html/js (dedicated settings page) - Generate icons (48x48, 96x96) - Update manifest.json (host permissions, content scripts, options) - Create AGENTS.md
This commit is contained in:
105
LinkSyncServer/deploy.ps1
Normal file
105
LinkSyncServer/deploy.ps1
Normal file
@@ -0,0 +1,105 @@
|
||||
#Requires -Version 7
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Prepares a deployment package for LinkSyncServer.
|
||||
|
||||
.DESCRIPTION
|
||||
Copies only the files needed for production deployment to a target folder,
|
||||
excludes development artifacts, and creates a starter .env file.
|
||||
After running, the user should edit the .env file with production secrets
|
||||
and run docker-compose up -d --build in the target folder.
|
||||
|
||||
.PARAMETER DeployPath
|
||||
Path to the deployment folder. Will be created if it does not exist.
|
||||
|
||||
.EXAMPLE
|
||||
.\deploy.ps1 -DeployPath "..\linksync-deploy"
|
||||
.\deploy.ps1 ..\linksync-deploy
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory = $true, Position = 0)]
|
||||
[string]$DeployPath
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$SourceDir = if ($PSScriptRoot) { $PSScriptRoot } else { (Get-Location).Path }
|
||||
|
||||
# Patterns excluded from deployment
|
||||
|
||||
Write-Host "LinkSyncServer - Deploy Script" -ForegroundColor Cyan
|
||||
Write-Host " Source: $SourceDir" -ForegroundColor Gray
|
||||
Write-Host " Deploy to: $DeployPath" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
|
||||
# Resolve to absolute path
|
||||
if (Test-Path $DeployPath) {
|
||||
$DeployPath = (Get-Item $DeployPath).FullName
|
||||
}
|
||||
else {
|
||||
$DeployPath = (New-Item -ItemType Directory -Force -Path $DeployPath).FullName
|
||||
}
|
||||
|
||||
# Clean target folder if it exists and has content
|
||||
if (Test-Path $DeployPath) {
|
||||
$existing = Get-ChildItem -Path $DeployPath -Force -ErrorAction SilentlyContinue
|
||||
if ($existing) {
|
||||
$confirm = Read-Host "Target folder already exists. Clear it? (y/N)"
|
||||
if ($confirm -ne "y") {
|
||||
Write-Host "Aborted." -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
Remove-Item -Path "$DeployPath\*" -Recurse -Force
|
||||
}
|
||||
}
|
||||
else {
|
||||
New-Item -ItemType Directory -Force -Path $DeployPath | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Copying files..." -ForegroundColor Gray
|
||||
|
||||
# Build robocopy arguments
|
||||
$robocopyArgs = @(
|
||||
$SourceDir,
|
||||
$DeployPath,
|
||||
"/E",
|
||||
"/NFL",
|
||||
"/NDL",
|
||||
"/NJH",
|
||||
"/NJS",
|
||||
"/NC",
|
||||
"/NS",
|
||||
"/NP",
|
||||
"/XD", "__pycache__", ".pytest_cache", ".git", ".vscode", ".idea",
|
||||
".mypy_cache", ".ruff_cache", "node_modules", "dist", "build", "tests",
|
||||
"/XF", "*.pyc", "*.pyo", "*.pyd", "*.db", "*.sqlite3",
|
||||
"*.egg-info", "deploy.ps1", "deploy.sh"
|
||||
)
|
||||
|
||||
$result = & robocopy @robocopyArgs
|
||||
|
||||
# robocopy exit codes: 0-7 are success, 8+ are errors
|
||||
$exitCode = $LASTEXITCODE
|
||||
if ($exitCode -ge 8) {
|
||||
Write-Host "Error during file copy (robocexit code: $exitCode)" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Copy .env.example as .env
|
||||
if (Test-Path "$SourceDir\.env.example") {
|
||||
Copy-Item "$SourceDir\.env.example" "$DeployPath\.env"
|
||||
Write-Host " Created .env from .env.example" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Deployment package prepared at: $DeployPath" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Next steps:" -ForegroundColor Yellow
|
||||
Write-Host " 1. Edit $DeployPath\.env with production secrets" -ForegroundColor Gray
|
||||
Write-Host " - Set DATABASE_URL (PostgreSQL connection string)" -ForegroundColor Gray
|
||||
Write-Host " - Set SECRET_KEY (generate: openssl rand -base64 32)" -ForegroundColor Gray
|
||||
Write-Host " - Set ADMIN_PASSWORD (strong password)" -ForegroundColor Gray
|
||||
Write-Host " 2. Run: cd $DeployPath" -ForegroundColor Gray
|
||||
Write-Host " 3. Run: docker-compose up -d --build" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
Reference in New Issue
Block a user