-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
1135 lines (1025 loc) Β· 40.3 KB
/
Copy pathTaskfile.yml
File metadata and controls
1135 lines (1025 loc) Β· 40.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
version: "1"
name: coreskill
alias: cs
short_description: CoreSkill - Ewolucyjny system AI z ewoluujΔ
cymi skillami
description: >
CoreSkill to inteligentny asystent AI, ktΓ³ry potrafi samodzielnie tworzyΔ,
naprawiaΔ i rozwijaΔ swoje zdolnoΕci (skills). System obsΕuguje tryb lokalny
(Docker Compose) oraz produkcyjny (Podman Quadlet).
variables:
# Core
APP_NAME: coreskill
REGISTRY: ghcr.io/wronai
TAG: latest
# Platform-specific paths
BUILD_DIR: dist
TEST_RESULTS_DIR: test-results
COVERAGE_DIR: coverage
# Docker/Compose files
CHAT_COMPOSE: docker-compose.chat.yml
TEST_COMPOSE: docker-compose.test.yml
SIMULATE_COMPOSE: docker-compose.simulate.yml
# Local settings
CHAT_PORT: "3000"
API_PORT: "8001"
LOCAL_DOMAIN: localhost
environments:
local:
desc: Local development environment (Docker Compose)
container_runtime: docker
compose_command: docker compose
variables:
DOMAIN: ${LOCAL_DOMAIN}
API_URL: http://${LOCAL_DOMAIN}:${API_PORT}
CHAT_URL: http://${LOCAL_DOMAIN}:${CHAT_PORT}
prod:
desc: Production environment (Podman Quadlet)
container_runtime: podman
service_manager: quadlet
# Auto-configured from environment variables:
# SSH_HOST β VPS_IP from .env or env var
# SSH_USER β VPS_USER from .env or env var
# SSH_KEY β ~/.ssh/id_ed25519 (default)
variables:
# Use VPS_IP from .env or fallback to placeholder
DOMAIN: ${VPS_IP:-your-vps-ip}
API_URL: http://${VPS_IP:-your-vps-ip}:${API_PORT}
CHAT_URL: http://${VPS_IP:-your-vps-ip}:${CHAT_PORT}
# SSH config from environment
SSH_HOST: ${VPS_IP:-}
SSH_USER: ${VPS_USER:-deploy}
SSH_KEY: ${VPS_SSH_KEY:-~/.ssh/id_ed25519}
platforms:
web:
desc: Web application (Docker container)
variables:
BUILD_DIR: dist/web
desktop:
desc: Desktop application (Electron/webview)
variables:
BUILD_DIR: dist/desktop
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# TASKS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
tasks:
# ==========================================================================
# INIT / SETUP
# ==========================================================================
init:
desc: Initialize project - creates .env from .env.example if missing
cmds:
- |
if [ ! -f .env ]; then
if [ -f .env.example ]; then
echo "π Creating .env from .env.example..."
cp .env.example .env
echo "β
.env created! Please edit it with your settings:"
echo ""
echo " nano .env"
echo ""
echo "Required for VPS deploy:"
echo " VPS_IP=your.vps.ip.address"
echo ""
echo "Then run: taskfile run deploy"
else
echo "β οΈ No .env.example found, creating minimal .env"
echo "# CoreSkill Environment Configuration" > .env
echo "# Generated by: taskfile run init" >> .env
echo "" >> .env
echo "# VPS Configuration (for production deploy)" >> .env
echo "VPS_IP=" >> .env
echo "VPS_USER=deploy" >> .env
echo "VPS_SSH_KEY=~/.ssh/id_ed25519" >> .env
echo "" >> .env
echo "# Container Registry" >> .env
echo "REGISTRY=ghcr.io/wronai" >> .env
echo "TAG=latest" >> .env
echo "" >> .env
echo "# API Keys (optional)" >> .env
echo "OPENROUTER_API_KEY=" >> .env
echo "ANTHROPIC_API_KEY=" >> .env
echo "" >> .env
echo "# Local Settings" >> .env
echo "CHAT_PORT=3000" >> .env
echo "API_PORT=8001" >> .env
echo "OLLAMA_HOST=http://host.docker.internal:11434" >> .env
echo "β
Minimal .env created! Please edit it: nano .env"
fi
else
echo "β
.env already exists"
fi
env-check:
desc: Check .env configuration and show current settings
cmds:
- |
if [ ! -f .env ]; then
echo "β .env not found! Run: taskfile run init"
exit 1
fi
- echo "π Current .env configuration:"
- echo "================================"
- |
# Load and display key variables
set -a
source .env 2>/dev/null || true
set +a
echo "VPS_IP: ${VPS_IP:-'(not set)'}"
echo "VPS_USER: ${VPS_USER:-deploy}"
echo "VPS_SSH_KEY: ${VPS_SSH_KEY:-~/.ssh/id_ed25519}"
echo "REGISTRY: ${REGISTRY:-ghcr.io/wronai}"
echo "TAG: ${TAG:-latest}"
echo "CHAT_PORT: ${CHAT_PORT:-3000}"
echo "API_PORT: ${API_PORT:-8001}"
echo ""
echo "Edit with: nano .env"
# ==========================================================================
# DEVELOPMENT
# ==========================================================================
install:
desc: Install Python dependencies
cmds:
- pip install -r requirements.txt
- echo "β
Dependencies installed"
dev:
desc: Run CoreSkill in development mode (interactive shell)
cmds:
- python3 main.py --verbose
dev-fast:
desc: Run CoreSkill without verbose logging
cmds:
- python3 main.py
check:
desc: Quick health check
cmds:
- python3 main.py --check
# ==========================================================================
# TESTING
# ==========================================================================
test:
desc: Run all tests in Docker
cmds:
- echo "π§ͺ Running complete test suite..."
- ./scripts/run_tests.sh all
test-unit:
desc: Run unit tests only (fast)
cmds:
- echo "π§ͺ Running unit tests..."
- ./scripts/run_tests.sh unit
test-integration:
desc: Run integration tests
cmds:
- echo "π§ͺ Running integration tests..."
- ./scripts/run_tests.sh integration
test-smoke:
desc: Quick smoke test
cmds:
- echo "π§ͺ Running smoke tests..."
- ./scripts/run_tests.sh smoke
test-e2e:
desc: Run E2E tests only
cmds:
- echo "π§ͺ Running E2E tests..."
- ./scripts/run_tests.sh e2e
test-verbose:
desc: Run all tests with verbose output
cmds:
- echo "π§ͺ Running tests with verbose output..."
- ./scripts/run_tests.sh -v all
test-rebuild:
desc: Rebuild test images and run all tests
cmds:
- echo "π§ͺ Rebuilding and running tests..."
- ./scripts/run_tests.sh -r all
ci-test:
desc: Run tests for CI with JUnit output
cmds:
- docker compose -f ${TEST_COMPOSE} run --rm test python -m pytest tests/
-v --tb=short --timeout=60
--junitxml=/app/${TEST_RESULTS_DIR}/junit.xml
--cov=cores --cov-report=xml:/app/${COVERAGE_DIR}/coverage.xml
ci-smoke:
desc: Quick smoke test for CI
cmds:
- docker compose -f ${TEST_COMPOSE} run --rm test-smoke
# ==========================================================================
# CHAT UI β WEB PLATFORM
# ==========================================================================
chat-up:
desc: Start chat UI services (backend + frontend)
platform: [web]
cmds:
- docker compose -f ${CHAT_COMPOSE} down --remove-orphans 2>/dev/null || true
- docker compose -f ${CHAT_COMPOSE} up -d --build --force-recreate
- echo ""
- echo "β
CoreSkill Chat ready at http://${LOCAL_DOMAIN}:${CHAT_PORT}"
chat-down:
desc: Stop chat UI services
platform: [web]
cmds:
- docker compose -f ${CHAT_COMPOSE} down --remove-orphans
- echo "β
Chat services stopped"
chat-web:
desc: Start chat and open in browser
platform: [web]
cmds:
- taskfile run chat-up
- sleep 2
- xdg-open http://${LOCAL_DOMAIN}:${CHAT_PORT} 2>/dev/null || open http://${LOCAL_DOMAIN}:${CHAT_PORT} 2>/dev/null || echo "Open http://${LOCAL_DOMAIN}:${CHAT_PORT}"
chat-logs:
desc: Show live logs from chat services
platform: [web]
cmds:
- docker compose -f ${CHAT_COMPOSE} logs -f --tail=50
chat-status:
desc: Show status of chat services + API health
platform: [web]
cmds:
- echo "π Service status:"
- docker compose -f ${CHAT_COMPOSE} ps
- echo ""
- echo "π₯ API health:"
- curl -sf http://${LOCAL_DOMAIN}:${API_PORT}/health 2>/dev/null && echo "" || echo "API not reachable"
- echo "π€ LLM status:"
- curl -sf http://${LOCAL_DOMAIN}:${API_PORT}/api/status 2>/dev/null | python3 -m json.tool 2>/dev/null || echo "API not responding"
chat-diagnose:
desc: Run LLM connectivity diagnostics
platform: [web]
cmds:
- echo "π Running diagnostics..."
- curl -s http://${LOCAL_DOMAIN}:${API_PORT}/api/diagnose 2>/dev/null | python3 -m json.tool || echo "Diagnostics failed"
chat-shell:
desc: Open shell in backend container
platform: [web]
cmds:
- docker exec -it coreskill-api bash
# ==========================================================================
# CHAT UI β DESKTOP PLATFORM
# ==========================================================================
desktop-up:
desc: Start chat UI for desktop mode
platform: [desktop]
cmds:
- docker compose -f ${CHAT_COMPOSE} up -d
- echo "β
Backend ready for desktop mode"
desktop-run:
desc: Launch desktop application
platform: [desktop]
cmds:
- ./desktop/run.sh
desktop:
desc: Start services and launch desktop app
platform: [desktop]
cmds:
- taskfile run desktop-up
- sleep 1
- taskfile run desktop-run
# ==========================================================================
# SIMULATION
# ==========================================================================
simulate:
desc: Run CoreSkill simulation
cmds:
- docker compose -f ${SIMULATE_COMPOSE} up --build
simulate-down:
desc: Stop simulation
cmds:
- docker compose -f ${SIMULATE_COMPOSE} down
# ==========================================================================
# DEPLOY MATRIX β 4 deploy types
#
# ββββββββββββ¬ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββ
# β β local β prod β
# ββββββββββββΌββββββββββββββββββββββββΌβββββββββββββββββββββββββββ€
# β desktop β ./desktop/run.sh β [create installer/pkg] β
# β web β docker compose up β podman pull + restart β
# ββββββββββββ΄ββββββββββββββββββββββββ΄βββββββββββββββββββββββββββ
#
# Usage:
# taskfile --env local --platform desktop run deploy # Desktop local
# taskfile --env local --platform web run deploy # Web local
# taskfile --env prod --platform web run deploy # Web prod (requires .env config)
# taskfile run deploy # Auto-detect from current env/platform
# ==========================================================================
# βββ Deploy: Web Γ Local βββββββββββββββββββββββββββββββββββββββββββββββββ
deploy-web-local:
desc: Deploy web app locally (Docker Compose)
env: [local]
platform: [web]
cmds:
- docker compose -f ${CHAT_COMPOSE} down --remove-orphans 2>/dev/null || true
- docker compose -f ${CHAT_COMPOSE} up -d --build --force-recreate
- echo ""
- echo "β
CoreSkill Web deployed locally:"
- echo " Frontend: http://${LOCAL_DOMAIN}:${CHAT_PORT}"
- echo " API: http://${LOCAL_DOMAIN}:${API_PORT}"
- echo " Health: http://${LOCAL_DOMAIN}:${API_PORT}/health"
# βββ Deploy: Web Γ Production ββββββββββββββββββββββββββββββββββββββββββββββ
deploy-web-prod:
desc: Deploy web app to VPS automatically (uses VPS_IP and SSH_KEY from .env)
env: [prod]
platform: [web]
deps: [init, build, vps-setup-check]
cmds:
- echo "π Deploying ${APP_NAME}:${TAG} to VPS..."
- echo " VPS: ${VPS_IP}"
- echo " User: ${VPS_USER:-deploy}"
- echo " Registry: ${REGISTRY}"
- |
# Check SSH connectivity
echo "π Testing SSH connection to ${VPS_IP}..."
if ! ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=accept-new ${VPS_USER:-deploy}@${VPS_IP} "echo 'SSH OK'" 2>/dev/null; then
echo ""
echo "β SSH connection failed!"
echo ""
echo "To fix:"
echo " 1. Copy your SSH key to the VPS:"
echo " ssh-copy-id -i ${VPS_SSH_KEY:-~/.ssh/id_ed25519}.pub ${VPS_USER:-deploy}@${VPS_IP}"
echo ""
echo " 2. Or set custom SSH key in .env:"
echo " VPS_SSH_KEY=~/.ssh/my_key"
exit 1
fi
- |
# Build and push image
echo "π¦ Building and pushing image..."
docker build -t ${REGISTRY}/${APP_NAME}:${TAG} -f backend/Dockerfile .
docker push ${REGISTRY}/${APP_NAME}:${TAG}
- |
# Remote deployment via SSH
echo "π€ Deploying to VPS..."
ssh ${VPS_USER:-deploy}@${VPS_IP} "
# Install Podman if not present
if ! command -v podman &>/dev/null; then
echo 'Installing Podman...'
sudo apt-get update && sudo apt-get install -y podman || sudo yum install -y podman
fi
# Pull and run
podman pull ${REGISTRY}/${APP_NAME}:${TAG}
podman stop ${APP_NAME} 2>/dev/null || true
podman rm ${APP_NAME} 2>/dev/null || true
podman run -d \
--name ${APP_NAME} \
-p ${API_PORT}:8000 \
-p ${CHAT_PORT}:80 \
--restart=always \
${REGISTRY}/${APP_NAME}:${TAG}
# Cleanup
podman image prune -f
echo 'β
Deployment complete'
"
- echo ""
- echo "β
Deployed to http://${VPS_IP}:${CHAT_PORT}"
- echo " API: http://${VPS_IP}:${API_PORT}/health"
# βββ Deploy: Desktop Γ Local βββββββββββββββββββββββββββββββββββββββββββββ
deploy-desktop-local:
desc: Run desktop app locally (Chrome --app mode)
env: [local]
platform: [desktop]
cmds:
- |
# Ensure backend is running
if ! curl -sf "http://${LOCAL_DOMAIN}:${API_PORT}/health" &>/dev/null; then
echo "π¦ Starting backend first..."
docker compose -f ${CHAT_COMPOSE} up -d
sleep 3
fi
- echo "π₯οΈ Launching CoreSkill Desktop..."
- ./desktop/run.sh
# βββ Deploy: Desktop Γ Production ββββββββββββββββββββββββββββββββββββββββ
deploy-desktop-prod:
desc: Build desktop packages and create download page
env: [prod]
platform: [desktop]
cmds:
- echo "π¦ Building desktop packages for distribution..."
- echo " Target: ${BUILD_DIR}/desktop"
- |
# Create desktop package structure
mkdir -p ${BUILD_DIR}/desktop
cp -r desktop/ ${BUILD_DIR}/desktop/
cp docker-compose.chat.yml ${BUILD_DIR}/desktop/
cp -r backend ${BUILD_DIR}/desktop/ 2>/dev/null || true
cp -r frontend ${BUILD_DIR}/desktop/ 2>/dev/null || true
- |
# Create launcher script
cat > ${BUILD_DIR}/desktop/CoreSkill.sh << 'EOF'
#!/bin/bash
# CoreSkill Desktop Launcher
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
docker compose -f docker-compose.chat.yml up -d
sleep 2
./desktop/run.sh
EOF
chmod +x ${BUILD_DIR}/desktop/CoreSkill.sh
- |
# Create install script
cat > ${BUILD_DIR}/desktop/install.sh << 'EOF'
#!/bin/bash
# CoreSkill Desktop Installer
set -e
echo "Installing CoreSkill Desktop..."
# Check Docker
if ! command -v docker &>/dev/null; then
echo "β Docker is required. Install from https://docs.docker.com/get-docker/"
exit 1
fi
INSTALL_DIR="${HOME}/.local/share/coreskill"
mkdir -p "$INSTALL_DIR"
cp -r . "$INSTALL_DIR/"
# Create desktop entry
mkdir -p "${HOME}/.local/share/applications"
cat > "${HOME}/.local/share/applications/coreskill.desktop" << 'DESKTOP'
[Desktop Entry]
Name=CoreSkill
Comment=Ewolucyjny system AI
Exec=${HOME}/.local/share/coreskill/CoreSkill.sh
Icon=${HOME}/.local/share/coreskill/desktop/icon.png
Type=Application
Categories=AI;Utility;
DESKTOP
echo "β
CoreSkill Desktop installed!"
echo " Launch from: $INSTALL_DIR/CoreSkill.sh"
echo " Or from your applications menu"
EOF
chmod +x ${BUILD_DIR}/desktop/install.sh
- |
# Create download page
cat > ${BUILD_DIR}/desktop/index.html << EOF
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CoreSkill - Download</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.container {
background: white;
border-radius: 20px;
padding: 40px;
max-width: 600px;
width: 100%;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
h1 {
color: #333;
margin-bottom: 10px;
font-size: 2em;
}
.subtitle {
color: #666;
margin-bottom: 30px;
}
.download-grid {
display: grid;
gap: 15px;
margin-bottom: 30px;
}
.download-btn {
display: flex;
align-items: center;
padding: 20px;
border: 2px solid #e0e0e0;
border-radius: 12px;
text-decoration: none;
color: #333;
transition: all 0.3s ease;
}
.download-btn:hover {
border-color: #667eea;
background: #f8f9ff;
transform: translateY(-2px);
}
.icon {
font-size: 2em;
margin-right: 15px;
}
.info h3 {
margin-bottom: 5px;
color: #333;
}
.info p {
color: #666;
font-size: 0.9em;
}
.version {
text-align: center;
color: #999;
font-size: 0.85em;
margin-top: 20px;
}
.web-link {
display: block;
text-align: center;
margin-top: 20px;
padding: 15px;
background: #667eea;
color: white;
text-decoration: none;
border-radius: 8px;
font-weight: 500;
}
.web-link:hover {
background: #5568d3;
}
</style>
</head>
<body>
<div class="container">
<h1>π§ CoreSkill</h1>
<p class="subtitle">Ewolucyjny system AI z ewoluujΔ
cymi skillami</p>
<div class="download-grid">
<a href="CoreSkill.sh" download class="download-btn">
<span class="icon">π§</span>
<div class="info">
<h3>Linux</h3>
<p>Universal installer (requires Docker)</p>
</div>
</a>
<a href="install.sh" download class="download-btn">
<span class="icon">π¦</span>
<div class="info">
<h3>Install Script</h3>
<p>Automatic system installation</p>
</div>
</a>
<a href="coreskill.zip" download class="download-btn">
<span class="icon">π</span>
<div class="info">
<h3>Source Package</h3>
<p>Full source with Docker setup</p>
</div>
</a>
</div>
<a href="http://${VPS_IP}:${CHAT_PORT}" class="web-link">
π Try Web Version β
</a>
<p class="version">Version ${TAG} | Build $(date -u +%Y-%m-%d)</p>
</div>
</body>
</html>
EOF
- |
# Create ZIP package
cd ${BUILD_DIR}
zip -r desktop/coreskill.zip desktop/ -x "*.zip" 2>/dev/null || tar -czf desktop/coreskill.tar.gz desktop/
- echo ""
- echo "β
Desktop package created: ${BUILD_DIR}/desktop/"
- echo " - CoreSkill.sh β Launcher"
- echo " - install.sh β System installer"
- echo " - index.html β Download page"
- echo " - coreskill.zip β Full package"
- echo ""
- echo "π€ Deploy download page to VPS:"
- echo " taskfile --env prod run desktop-publish"
# βββ Universal deploy (auto-routes based on --env and --platform) βββββββββ
deploy:
desc: "Deploy to current env+platform (use --env and --platform flags)"
cmds:
- echo "π Deploying ${APP_NAME} β env=${ENV:-local} platform=${PLATFORM:-web} tag=${TAG}"
- |
ENV_VAL="${ENV:-local}"
PLATFORM_VAL="${PLATFORM:-web}"
taskfile --env ${ENV_VAL} --platform ${PLATFORM_VAL} run deploy-${PLATFORM_VAL}-${ENV_VAL}
# βββ Deploy all platforms ββββββββββββββββββββββββββββββββββββββββββββββββ
release:
desc: Full release β deploy all platforms
cmds:
- echo "π Releasing ${APP_NAME}:${TAG}"
- git tag -a ${TAG} -m "Release ${TAG}" 2>/dev/null || echo "Tag ${TAG} already exists"
- git push origin ${TAG} 2>/dev/null || echo "Push skipped"
- echo ""
- echo "π¦ Deploying web to production..."
- taskfile --env prod --platform web run deploy-web-prod || echo "β οΈ Web prod deploy failed"
- echo ""
- echo "π₯οΈ Building desktop package..."
- taskfile --env prod --platform desktop run deploy-desktop-prod
- echo ""
- echo "β
Release ${APP_NAME}:${TAG} complete!"
# ==========================================================================
# BUILD
# ==========================================================================
build:
desc: Build Docker images for production
platform: [web]
cmds:
- docker build -t ${REGISTRY}/${APP_NAME}:${TAG} -f backend/Dockerfile backend/
- docker tag ${REGISTRY}/${APP_NAME}:${TAG} ${APP_NAME}:latest
- echo "β
Built ${REGISTRY}/${APP_NAME}:${TAG}"
build-test:
desc: Build test Docker images
cmds:
- docker compose -f ${TEST_COMPOSE} build
- echo "β
Test images built"
push:
desc: Push Docker image to registry
platform: [web]
cmds:
- docker push ${REGISTRY}/${APP_NAME}:${TAG}
- echo "β
Pushed ${REGISTRY}/${APP_NAME}:${TAG}"
# βββ VPS Setup βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
vps-setup:
desc: Setup VPS for CoreSkill deployment (installs Podman, creates user)
env: [prod]
cmds:
- |
if [ -z "${VPS_IP}" ]; then
echo "β VPS_IP not set!"
echo "Add to .env: VPS_IP=your.vps.ip.address"
exit 1
fi
- echo "π§ Setting up VPS at ${VPS_IP}..."
- |
# Run setup on remote server (as root or sudo user)
ssh ${VPS_USER:-root}@${VPS_IP} "
echo '=== CoreSkill VPS Setup ==='
# Update system
apt-get update || yum update -y
# Install Podman
if ! command -v podman &>/dev/null; then
echo 'π¦ Installing Podman...'
apt-get install -y podman || yum install -y podman
fi
# Create deploy user if not exists
if ! id deploy &>/dev/null; then
echo 'π€ Creating deploy user...'
useradd -m -s /bin/bash deploy
usermod -aG sudo deploy || usermod -aG wheel deploy
fi
# Enable linger for deploy user (systemd user services)
loginctl enable-linger deploy || true
# Open firewall ports
if command -v ufw &>/dev/null; then
ufw allow ${CHAT_PORT}/tcp
ufw allow ${API_PORT}/tcp
echo 'β
Firewall configured (ufw)'
elif command -v firewall-cmd &>/dev/null; then
firewall-cmd --permanent --add-port=${CHAT_PORT}/tcp
firewall-cmd --permanent --add-port=${API_PORT}/tcp
firewall-cmd --reload
echo 'β
Firewall configured (firewalld)'
fi
echo 'β
VPS setup complete!'
echo ''
echo 'Next steps:'
echo ' 1. Copy your SSH key: ssh-copy-id deploy@${VPS_IP}'
echo ' 2. Deploy: taskfile --env prod run deploy-web-prod'
"
vps-setup-check:
desc: Check VPS is ready for deployment
env: [prod]
cmds:
- |
if [ -z "${VPS_IP}" ]; then
echo "β VPS_IP not set! Add to .env:"
echo " VPS_IP=your.vps.ip.address"
echo " VPS_USER=deploy"
echo " VPS_SSH_KEY=~/.ssh/id_ed25519"
exit 1
fi
- echo "π Checking VPS ${VPS_IP}..."
- |
ssh ${VPS_USER:-deploy}@${VPS_IP} "
echo 'β
SSH connection OK'
# Check Podman
if command -v podman &>/dev/null; then
echo 'β
Podman installed:' \$(podman --version)
else
echo 'β οΈ Podman not found - run: taskfile --env prod run vps-setup'
exit 1
fi
# Check ports
echo 'β
Ports ${CHAT_PORT} and ${API_PORT} should be open'
echo 'β
VPS ready for deployment!'
" || exit 1
ssh-key-setup:
desc: Generate and copy SSH key to VPS
cmds:
- |
KEY_PATH="${VPS_SSH_KEY:-~/.ssh/id_ed25519}"
if [ ! -f "${KEY_PATH}" ]; then
echo "π Generating SSH key..."
ssh-keygen -t ed25519 -f "${KEY_PATH}" -N "" -C "coreskill-deploy"
echo "β
Key generated: ${KEY_PATH}"
else
echo "β
SSH key exists: ${KEY_PATH}"
fi
- |
if [ -z "${VPS_IP}" ]; then
echo "β VPS_IP not set!"
echo "Add to .env: VPS_IP=your.vps.ip.address"
exit 1
fi
- echo "π Public key:"
- cat ${VPS_SSH_KEY:-~/.ssh/id_ed25519}.pub
- echo ""
- echo "π§ Copying key to VPS ${VPS_IP}..."
- ssh-copy-id -i ${VPS_SSH_KEY:-~/.ssh/id_ed25519}.pub ${VPS_USER:-deploy}@${VPS_IP}
- echo "β
SSH key copied! You can now deploy without password."
# βββ Publish Desktop Download Page βββββββββββββββββββββββββββββββββββββββββ
desktop-publish:
desc: Publish desktop download page to VPS
env: [prod]
platform: [desktop]
deps: [deploy-desktop-prod]
cmds:
- |
if [ -z "${VPS_IP}" ]; then
echo "β VPS_IP not set!"
exit 1
fi
- echo "π€ Publishing desktop download page to VPS..."
- echo " VPS: ${VPS_IP}"
- |
# Upload files to VPS web directory
ssh ${VPS_USER:-deploy}@${VPS_IP} "
mkdir -p ~/coreskill-downloads
echo 'π Created download directory'
"
- scp ${BUILD_DIR}/desktop/* ${VPS_USER:-deploy}@${VPS_IP}:~/coreskill-downloads/
- |
# Start nginx container for downloads
ssh ${VPS_USER:-deploy}@${VPS_IP} "
podman stop coreskill-downloads 2>/dev/null || true
podman rm coreskill-downloads 2>/dev/null || true
podman run -d \\
--name coreskill-downloads \\
-p 8080:80 \\
-v ~/coreskill-downloads:/usr/share/nginx/html:ro \\
--restart=always \\
nginx:alpine
echo 'β
Download page deployed!'
echo ' http://${VPS_IP}:8080'
"
- echo ""
- echo "β
Desktop download page published!"
- echo " π http://${VPS_IP}:8080"
- echo ""
- echo "Downloads available:"
- echo " β’ CoreSkill.sh - Linux launcher"
- echo " β’ install.sh - System installer"
- echo " β’ coreskill.zip - Full package"
# βββ Deploy All (SaaS + Desktop) βββββββββββββββββββββββββββββββββββββββββ
deploy-all:
desc: Deploy everything - SaaS web app + Desktop download page
env: [prod]
cmds:
- echo "π Deploying CoreSkill SaaS + Desktop..."
- echo " VPS: ${VPS_IP}"
- echo ""
- echo "π¦ Step 1/3: Deploy web application (SaaS)..."
- taskfile --env prod --platform web run deploy-web-prod
- echo ""
- echo "π₯οΈ Step 2/3: Build desktop packages..."
- taskfile --env prod --platform desktop run deploy-desktop-prod
- echo ""
- echo "π€ Step 3/3: Publish download page..."
- taskfile --env prod --platform desktop run desktop-publish
- echo ""
- echo "β
All deployments complete!"
- echo ""
- echo "π Access points:"
- echo " β’ Web App: http://${VPS_IP}:${CHAT_PORT}"
- echo " β’ API: http://${VPS_IP}:${API_PORT}"
- echo " β’ Desktop Downloads: http://${VPS_IP}:8080"
- echo ""
- echo "π Local development:"
- echo " taskfile run deploy-web-local # Local web"
- echo " taskfile run deploy-desktop-local # Local desktop"
# ==========================================================================
# QUADLET (Podman production)
# ==========================================================================
quadlet-generate:
desc: Generate Quadlet .container files from docker-compose for Podman
platform: [web]
cmds:
- echo "π§ Generating Quadlet files..."
- mkdir -p deploy/quadlet
- |
# Generate backend container unit
cat > deploy/quadlet/${APP_NAME}-backend.container << 'EOF'
[Unit]
Description=CoreSkill Backend API
After=network.target
[Container]
Image=${REGISTRY}/${APP_NAME}:${TAG}
ContainerName=${APP_NAME}-api
PublishPort=${API_PORT}:8000
Environment=CORESKILL_MODE=demo
Environment=OLLAMA_HOST=http://host.docker.internal:11434
Volume=coreskill-data:/app/data
Volume=coreskill-logs:/app/logs
HealthCmd="curl -f http://localhost:8000/health || exit 1"
HealthInterval=10s
HealthTimeout=5s
HealthRetries=3
[Service]
Restart=always
[Install]
WantedBy=default.target
EOF
- |
# Generate frontend container unit
cat > deploy/quadlet/${APP_NAME}-frontend.container << 'EOF'
[Unit]
Description=CoreSkill Frontend UI
After=${APP_NAME}-backend.service
Requires=${APP_NAME}-backend.service
[Container]
Image=nginx:alpine
ContainerName=${APP_NAME}-ui
PublishPort=${CHAT_PORT}:80
Volume=${APP_NAME}-frontend:/usr/share/nginx/html:ro
[Service]
Restart=always
[Install]
WantedBy=default.target
EOF
- echo "β
Quadlet files generated in deploy/quadlet/"
- echo " Deploy with: taskfile --env prod run quadlet-deploy"
quadlet-deploy:
desc: Deploy Quadlet files to production server (requires SSH)
env: [prod]
platform: [web]
cmds:
- echo "π€ Uploading Quadlet files to server..."
- |
# Uncomment when SSH is configured:
# scp deploy/quadlet/*.container ${SSH_USER}@${SSH_HOST}:~/.config/containers/systemd/
# @remote systemctl --user daemon-reload
# @remote systemctl --user start ${APP_NAME}-backend
# @remote systemctl --user start ${APP_NAME}-frontend
- echo "β
Quadlet deployed (configure SSH to enable)"
# ==========================================================================
# REPORTING
# ==========================================================================
report:
desc: Show test report from previous run
cmds:
- echo "π Test Results"
- echo "==============="
- |
if [ -f ${TEST_RESULTS_DIR}/junit.xml ]; then
total=$(grep -o 'tests="[0-9]*"' ${TEST_RESULTS_DIR}/junit.xml | head -1 | sed 's/[^0-9]//g')
failures=$(grep -o 'failures="[0-9]*"' ${TEST_RESULTS_DIR}/junit.xml | head -1 | sed 's/[^0-9]//g' || echo "0")
errors=$(grep -o 'errors="[0-9]*"' ${TEST_RESULTS_DIR}/junit.xml | head -1 | sed 's/[^0-9]//g' || echo "0")
echo "Total: ${total:-0}"
echo "Failures: ${failures:-0}"
echo "Errors: ${errors:-0}"
passed=$((total - failures - errors))
echo "Passed: ${passed:-0}"
fi
- |
if [ -f ${COVERAGE_DIR}/coverage.xml ]; then
line_rate=$(grep -o 'line-rate="[0-9.]*"' ${COVERAGE_DIR}/coverage.xml | head -1 | sed 's/[^0-9.]//g')
coverage=$(python3 -c "print(f'${line_rate} * 100:.1f')" 2>/dev/null || echo "?")
echo "Coverage: ${coverage}%"
fi
- echo ""
- echo "Reports:"
- echo " HTML: ${TEST_RESULTS_DIR}/report.html"
- echo " JUnit: ${TEST_RESULTS_DIR}/junit.xml"
# ==========================================================================
# CLEANUP
# ==========================================================================
clean:
desc: Clean test artifacts and containers
cmds:
- docker compose -f ${TEST_COMPOSE} rm -f 2>/dev/null || true
- rm -rf ${TEST_RESULTS_DIR}/ ${COVERAGE_DIR}/ htmlcov/
- find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
- echo "π§Ή Cleaned"
clean-all:
desc: Deep clean including Docker images
cmds:
- taskfile run clean
- docker rmi evo-engine-test evo-engine-test-unit evo-engine-test-integration 2>/dev/null || true