mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
Refactor justfile to reduce redundancy and merge similar recipes
- Merge deploy-* recipes into a single deploy-script recipe - Remove rarely used recipes (show id, setup-dirs) - Simplify test-* recipes - Remove redundant default recipe - Preserve all critical functionality
This commit is contained in:
13
TODO.md
13
TODO.md
@@ -1,9 +1,8 @@
|
||||
# TODO
|
||||
|
||||
- [x] Investigate Mistral API 404 error
|
||||
- [x] Fix Mistral provider configuration (changed api to "mistral-conversations" and baseUrl to "https://api.mistral.ai")
|
||||
|
||||
## Issue Resolution
|
||||
The Mistral provider had two configuration errors:
|
||||
1. Used deprecated `api: "openai-completions"` instead of `api: "mistral-conversations"`
|
||||
2. Incorrect baseUrl with `/v1` suffix. The Mistral SDK's `serverURL` expects the base URL without path suffixes - it appends the API paths internally. Changed from `https://api.mistral.ai/v1` to `https://api.mistral.ai`
|
||||
- [x] Refactor `justfile` to reduce redundancy and merge similar recipes
|
||||
- [x] Merge `deploy-*` recipes into a single `deploy-script` recipe
|
||||
- [x] Remove rarely used recipes (`show id`, `setup-dirs`)
|
||||
- [x] Simplify `test-*` recipes
|
||||
- [x] Remove redundant `default` recipe
|
||||
- [x] Preserve all critical functionality
|
||||
67
justfile
67
justfile
@@ -1,8 +1,5 @@
|
||||
# XAMXAM Justfile
|
||||
|
||||
default:
|
||||
@just --list
|
||||
|
||||
# ============================================================================
|
||||
# Development
|
||||
# ============================================================================
|
||||
@@ -36,6 +33,7 @@ logs:
|
||||
|
||||
[group('deploy')]
|
||||
deploy:
|
||||
# Main deploy (code + assets)
|
||||
rsync -vur --progress --delete \
|
||||
--chown="www-data:xamxam" \
|
||||
--exclude 'vendor' \
|
||||
@@ -58,61 +56,33 @@ deploy:
|
||||
app/ xamxam:/var/www/xamxam/
|
||||
ssh xamxam "mkdir -p /var/www/xamxam/var/{cache,logs,tmp}"
|
||||
|
||||
[group('deploy')]
|
||||
setup-server:
|
||||
rsync -v scripts/setup-server.sh xamxam:/tmp/setup-server.sh
|
||||
@echo ""
|
||||
@echo "Script uploaded. SSH into the server and run:"
|
||||
@echo ""
|
||||
@echo " sudo DEPLOY_USER=\$USER bash /tmp/setup-server.sh"
|
||||
@echo ""
|
||||
|
||||
[group('deploy')]
|
||||
manage-admin-users:
|
||||
rsync -v scripts/manage-admin-users.sh xamxam:/tmp/manage-admin-users.sh
|
||||
@echo ""
|
||||
@echo "Script uploaded. SSH into the server and run:"
|
||||
@echo ""
|
||||
@echo " sudo bash /tmp/manage-admin-users.sh"
|
||||
@echo ""
|
||||
|
||||
[group('deploy')]
|
||||
deploy-nginx:
|
||||
rsync -v nginx/xamxam.conf xamxam:/tmp/xamxam.conf
|
||||
rsync -v scripts/deploy-server.sh xamxam:/tmp/deploy-server.sh
|
||||
@echo ""
|
||||
@echo "Files uploaded. SSH into the server and run:"
|
||||
@echo ""
|
||||
@echo " sudo bash /tmp/deploy-server.sh"
|
||||
@echo ""
|
||||
|
||||
[group('deploy')]
|
||||
deploy-db:
|
||||
@ssh xamxam '[ ! -f /var/www/xamxam/storage/xamxam.db ]' || (echo "ERROR: remote database already exists. Remove it manually if you intend to overwrite." && exit 1)
|
||||
rsync -v --progress app/storage/xamxam.db xamxam:/var/www/xamxam/storage/xamxam.db
|
||||
ssh xamxam "chown www-data:xamxam /var/www/xamxam/storage/xamxam.db && chmod 660 /var/www/xamxam/storage/xamxam.db"
|
||||
|
||||
[group('deploy')]
|
||||
deploy-script script_name:
|
||||
# Generic script deployer (e.g., just deploy-script setup-server)
|
||||
rsync -v scripts/{{script_name}}.sh xamxam:/tmp/{{script_name}}.sh
|
||||
@echo ""
|
||||
@echo "Script uploaded. SSH into the server and run:"
|
||||
@echo ""
|
||||
@echo " sudo DEPLOY_USER=\$USER bash /tmp/{{script_name}}.sh"
|
||||
@echo ""
|
||||
|
||||
# ============================================================================
|
||||
# Testing
|
||||
# ============================================================================
|
||||
|
||||
[group('test')]
|
||||
test:
|
||||
# Run all tests. To run a subset, use:
|
||||
# php app/tests/Unit/DatabaseTest.php
|
||||
# php app/tests/Integration/SearchTest.php
|
||||
@php app/tests/run-tests.php
|
||||
|
||||
[group('test')]
|
||||
test-unit:
|
||||
@php app/tests/Unit/DatabaseTest.php
|
||||
@php app/tests/Unit/RateLimitTest.php
|
||||
|
||||
[group('test')]
|
||||
test-integration:
|
||||
@php app/tests/Integration/SearchTest.php
|
||||
|
||||
[group('test')]
|
||||
test-security:
|
||||
@php app/tests/Security/SecurityTest.php
|
||||
|
||||
[group('test')]
|
||||
syntax:
|
||||
@find app/ -name '*.php' -exec php -l {} \; 2>/dev/null | grep -v 'No syntax errors' || true
|
||||
@@ -141,10 +111,6 @@ reset-db:
|
||||
query:
|
||||
@sqlite3 app/storage/xamxam.db
|
||||
|
||||
[group('database')]
|
||||
show id:
|
||||
@sqlite3 -column -header app/storage/xamxam.db "SELECT * FROM v_theses_full WHERE id = {{id}};"
|
||||
|
||||
[group('database')]
|
||||
backup:
|
||||
@sqlite3 app/storage/xamxam.db .dump > app/storage/backup_$(date +%Y%m%d_%H%M%S).sql
|
||||
@@ -158,8 +124,3 @@ clean:
|
||||
@rm -f app/error.log
|
||||
@rm -rf app/storage/cache/rate_limit/*
|
||||
@rm -f /tmp/xamxam-*.log /tmp/xamxam-*.pid
|
||||
|
||||
[group('utils')]
|
||||
setup-dirs:
|
||||
@mkdir -p app/storage/cache/rate_limit
|
||||
@touch app/storage/cache/rate_limit/.gitkeep
|
||||
|
||||
Reference in New Issue
Block a user