chore: import upstream snapshot with attribution
This commit is contained in:
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
|
||||
export SERVER_SSL_KEY=${SERVER_SSL_KEY:-ssl/server.key}
|
||||
export SERVER_SSL_CRT=${SERVER_SSL_CRT:-ssl/server.crt}
|
||||
SERVER_SSL_CSR=ssl/service.csr
|
||||
SERVER_SSL_CA_KEY=ssl/service_ca.key
|
||||
SERVER_SSL_CA_CRT=ssl/service_ca.crt
|
||||
OLLAMA_KEY=/root/.ollama/id_ed25519
|
||||
|
||||
if [ ! -f "$OLLAMA_KEY" ]; then
|
||||
ssh-keygen -t ed25519 -N "" -f $OLLAMA_KEY
|
||||
chmod 600 $OLLAMA_KEY
|
||||
echo "Ollama signing key generated and saved to $OLLAMA_KEY"
|
||||
fi
|
||||
|
||||
if [ -f "$SERVER_SSL_KEY" ] && [ -f "$SERVER_SSL_CRT" ]; then
|
||||
echo "service ssl crt and key already exist"
|
||||
elif [ "$SERVER_USE_SSL" = "true" ]; then
|
||||
echo "Gen service ssl key and crt"
|
||||
openssl genrsa -out ${SERVER_SSL_CA_KEY} 4096
|
||||
openssl req \
|
||||
-new -x509 -days 3650 \
|
||||
-key ${SERVER_SSL_CA_KEY} \
|
||||
-subj "/C=US/ST=NY/L=NY/O=PentAGI/OU=Project/CN=PentAGI CA" \
|
||||
-out ${SERVER_SSL_CA_CRT}
|
||||
openssl req \
|
||||
-newkey rsa:4096 \
|
||||
-sha256 \
|
||||
-nodes \
|
||||
-keyout ${SERVER_SSL_KEY} \
|
||||
-subj "/C=US/ST=NY/L=NY/O=PentAGI/OU=Project/CN=localhost" \
|
||||
-out ${SERVER_SSL_CSR}
|
||||
|
||||
echo "subjectAltName=DNS:pentagi.local" > extfile.tmp
|
||||
echo "keyUsage=critical,digitalSignature,keyAgreement" >> extfile.tmp
|
||||
|
||||
openssl x509 -req \
|
||||
-days 730 \
|
||||
-extfile extfile.tmp \
|
||||
-in ${SERVER_SSL_CSR} \
|
||||
-CA ${SERVER_SSL_CA_CRT} -CAkey ${SERVER_SSL_CA_KEY} -CAcreateserial \
|
||||
-out ${SERVER_SSL_CRT}
|
||||
|
||||
rm extfile.tmp
|
||||
|
||||
cat ${SERVER_SSL_CA_CRT} >> ${SERVER_SSL_CRT}
|
||||
|
||||
chmod g+r ${SERVER_SSL_KEY}
|
||||
|
||||
# Remove CA private key and CSR after signing -- they are no longer
|
||||
# needed at runtime and leaving them on disk increases the attack
|
||||
# surface if the container filesystem is compromised.
|
||||
rm -f ${SERVER_SSL_CA_KEY} ${SERVER_SSL_CSR} ssl/service_ca.srl
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Generate license reports for PentAGI dependencies
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
LICENSES_DIR="./licenses"
|
||||
|
||||
mkdir -p "$LICENSES_DIR"
|
||||
|
||||
echo "Generating license reports..."
|
||||
|
||||
# Backend (Go)
|
||||
echo "→ Backend..."
|
||||
cd backend
|
||||
|
||||
# Generate module list
|
||||
go list -m all > "../$LICENSES_DIR/backend-dependencies.txt"
|
||||
|
||||
# Generate detailed license report using go-licenses
|
||||
if command -v go-licenses &> /dev/null; then
|
||||
echo " Generating detailed license report with go-licenses..."
|
||||
GOROOT=$(go env GOROOT) GOTOOLCHAIN=auto go-licenses csv ./cmd/pentagi > "../$LICENSES_DIR/backend-licenses.csv" 2>/dev/null || {
|
||||
echo " go-licenses failed, install it with: go install github.com/google/go-licenses@latest"
|
||||
}
|
||||
else
|
||||
echo " go-licenses not found, install it with: go install github.com/google/go-licenses@latest"
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
# Frontend (pnpm)
|
||||
echo "→ Frontend..."
|
||||
cd frontend
|
||||
if [ -d "node_modules" ]; then
|
||||
pnpm ls --prod --json > "../$LICENSES_DIR/frontend-dependencies.json" 2>/dev/null || true
|
||||
|
||||
if command -v license-checker &> /dev/null; then
|
||||
license-checker --production --json > "../$LICENSES_DIR/frontend-licenses.json" 2>/dev/null || true
|
||||
license-checker --production --csv > "../$LICENSES_DIR/frontend-licenses.csv" 2>/dev/null || true
|
||||
fi
|
||||
else
|
||||
echo " Run 'pnpm install' in frontend/ for detailed reports"
|
||||
fi
|
||||
cd ..
|
||||
|
||||
echo "Done! Reports saved in: $LICENSES_DIR/"
|
||||
ls -1 "$LICENSES_DIR/" | grep -v -E "(README|gitignore)" | sed 's/^/ - /'
|
||||
@@ -0,0 +1,44 @@
|
||||
# Source this file to set version environment variables
|
||||
# Usage: . .\scripts\version.ps1
|
||||
|
||||
# Get the latest git tag as version
|
||||
$latestTag = git describe --tags --abbrev=0 2>$null
|
||||
if (-not $latestTag) {
|
||||
$latestTag = "v0.0.0"
|
||||
}
|
||||
$env:PACKAGE_VER = $latestTag.TrimStart('v')
|
||||
|
||||
# Get current commit hash
|
||||
$currentCommit = git rev-parse HEAD 2>$null
|
||||
|
||||
# Get commit hash of the latest tag
|
||||
$tagCommit = git rev-list -n 1 $latestTag 2>$null
|
||||
|
||||
# Set revision only if current commit differs from tag commit
|
||||
if ($currentCommit -and ($currentCommit -ne $tagCommit)) {
|
||||
$env:PACKAGE_REV = git rev-parse --short HEAD
|
||||
$buildType = "development"
|
||||
$fullVersion = "$env:PACKAGE_VER-$env:PACKAGE_REV"
|
||||
} else {
|
||||
$env:PACKAGE_REV = ""
|
||||
$buildType = "release"
|
||||
$fullVersion = $env:PACKAGE_VER
|
||||
}
|
||||
|
||||
# Print version information
|
||||
Write-Host "======================================"
|
||||
Write-Host "PentAGI Build Version"
|
||||
Write-Host "======================================"
|
||||
Write-Host "PACKAGE_VER: $env:PACKAGE_VER"
|
||||
if ($env:PACKAGE_REV) {
|
||||
Write-Host "PACKAGE_REV: $env:PACKAGE_REV ($buildType)"
|
||||
} else {
|
||||
Write-Host "PACKAGE_REV: ($buildType)"
|
||||
}
|
||||
Write-Host "Full version: $fullVersion"
|
||||
Write-Host "======================================"
|
||||
Write-Host ""
|
||||
Write-Host "Environment variables exported:"
|
||||
Write-Host " `$env:PACKAGE_VER = $env:PACKAGE_VER"
|
||||
Write-Host " `$env:PACKAGE_REV = $env:PACKAGE_REV"
|
||||
Write-Host ""
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# Source this file to set version environment variables
|
||||
# Usage: source ./scripts/version.sh
|
||||
|
||||
# Get the latest git tag as version
|
||||
PACKAGE_VER=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.0")
|
||||
|
||||
# Get current commit hash
|
||||
CURRENT_COMMIT=$(git rev-parse HEAD 2>/dev/null || echo "")
|
||||
|
||||
# Get commit hash of the latest tag
|
||||
TAG_COMMIT=$(git rev-list -n 1 "$(git describe --tags --abbrev=0 2>/dev/null || echo HEAD)" 2>/dev/null || echo "")
|
||||
|
||||
# Set revision only if current commit differs from tag commit
|
||||
if [ -n "$CURRENT_COMMIT" ] && [ "$CURRENT_COMMIT" != "$TAG_COMMIT" ]; then
|
||||
PACKAGE_REV=$(git rev-parse --short HEAD)
|
||||
else
|
||||
PACKAGE_REV=""
|
||||
fi
|
||||
|
||||
# Export variables for use in docker build
|
||||
export PACKAGE_VER
|
||||
export PACKAGE_REV
|
||||
|
||||
# Print version information
|
||||
echo "======================================"
|
||||
echo "PentAGI Build Version"
|
||||
echo "======================================"
|
||||
echo "PACKAGE_VER: $PACKAGE_VER"
|
||||
if [ -n "$PACKAGE_REV" ]; then
|
||||
echo "PACKAGE_REV: $PACKAGE_REV (development)"
|
||||
echo "Full version: $PACKAGE_VER-$PACKAGE_REV"
|
||||
else
|
||||
echo "PACKAGE_REV: (release)"
|
||||
echo "Full version: $PACKAGE_VER"
|
||||
fi
|
||||
echo "======================================"
|
||||
echo ""
|
||||
echo "Environment variables exported:"
|
||||
echo " \$PACKAGE_VER = $PACKAGE_VER"
|
||||
echo " \$PACKAGE_REV = $PACKAGE_REV"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user