-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint.html
More file actions
2440 lines (2346 loc) · 138 KB
/
Copy pathprint.html
File metadata and controls
2440 lines (2346 loc) · 138 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
<!DOCTYPE HTML>
<html lang="en" class="mocha sidebar-visible" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>UNIT3D Documentation</title>
<meta name="robots" content="noindex">
<!-- Custom HTML head -->
<meta name="description" content="Comprehensive documentation for UNIT3D - A modern private torrent tracker platform built with Laravel">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon-de23e50b.svg">
<link rel="shortcut icon" href="favicon-8114d1fc.png">
<link rel="stylesheet" href="css/variables-8adf115d.css">
<link rel="stylesheet" href="css/general-2459343d.css">
<link rel="stylesheet" href="css/chrome-ae938929.css">
<link rel="stylesheet" href="css/print-9e4910d8.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="fonts/fonts-9644e21d.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" id="mdbook-highlight-css" href="highlight-493f70e1.css">
<link rel="stylesheet" id="mdbook-tomorrow-night-css" href="tomorrow-night-4c0ae647.css">
<link rel="stylesheet" id="mdbook-ayu-highlight-css" href="ayu-highlight-3fdfc3ac.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="./theme/catppuccin.css">
<!-- Provide site root and default themes to javascript -->
<script>
const path_to_root = "";
const default_light_theme = "mocha";
const default_dark_theme = "mocha";
window.path_to_searchindex_js = "searchindex-54239a59.js";
</script>
<!-- Start loading toc.js asap -->
<script src="toc-a419843d.js"></script>
</head>
<body>
<div id="mdbook-help-container">
<div id="mdbook-help-popup">
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
<div>
<p>Press <kbd>←</kbd> or <kbd>→</kbd> to navigate between chapters</p>
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
<p>Press <kbd>?</kbd> to show this help</p>
<p>Press <kbd>Esc</kbd> to hide this help</p>
</div>
</div>
</div>
<div id="mdbook-body-container">
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
let theme = localStorage.getItem('mdbook-theme');
let sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme;
let theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
const html = document.documentElement;
html.classList.remove('mocha')
html.classList.add(theme);
html.classList.add("js");
</script>
<input type="checkbox" id="mdbook-sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
let sidebar = null;
const sidebar_toggle = document.getElementById("mdbook-sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
sidebar_toggle.checked = false;
}
if (sidebar === 'visible') {
sidebar_toggle.checked = true;
} else {
html.classList.remove('sidebar-visible');
}
</script>
<nav id="mdbook-sidebar" class="sidebar" aria-label="Table of contents">
<!-- populated by js -->
<mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
<noscript>
<iframe class="sidebar-iframe-outer" src="toc.html"></iframe>
</noscript>
<div id="mdbook-sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<div id="mdbook-page-wrapper" class="page-wrapper">
<div class="page">
<div id="mdbook-menu-bar-hover-placeholder"></div>
<div id="mdbook-menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="mdbook-sidebar-toggle" class="icon-button" for="mdbook-sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="mdbook-sidebar">
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg></span>
</label>
<button id="mdbook-theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="mdbook-theme-list">
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M371.3 367.1c27.3-3.9 51.9-19.4 67.2-42.9L600.2 74.1c12.6-19.5 9.4-45.3-7.6-61.2S549.7-4.4 531.1 9.6L294.4 187.2c-24 18-38.2 46.1-38.4 76.1L371.3 367.1zm-19.6 25.4l-116-104.4C175.9 290.3 128 339.6 128 400c0 3.9 .2 7.8 .6 11.6c1.8 17.5-10.2 36.4-27.8 36.4H96c-17.7 0-32 14.3-32 32s14.3 32 32 32H240c61.9 0 112-50.1 112-112c0-2.5-.1-5-.2-7.5z"/></svg></span>
</button>
<ul id="mdbook-theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-latte">Latte</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-frappe">Frappé</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-macchiato">Macchiato</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-mocha">Mocha</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-ayu">Ayu</button></li>
</ul>
<button id="mdbook-search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="mdbook-searchbar">
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352c79.5 0 144-64.5 144-144s-64.5-144-144-144S64 128.5 64 208s64.5 144 144 144z"/></svg></span>
</button>
</div>
<h1 class="menu-title">UNIT3D Documentation</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<span class=fa-svg id="print-button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M128 0C92.7 0 64 28.7 64 64v96h64V64H354.7L384 93.3V160h64V93.3c0-17-6.7-33.3-18.7-45.3L400 18.7C388 6.7 371.7 0 354.7 0H128zM384 352v32 64H128V384 368 352H384zm64 32h32c17.7 0 32-14.3 32-32V256c0-35.3-28.7-64-64-64H64c-35.3 0-64 28.7-64 64v96c0 17.7 14.3 32 32 32H64v64c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V384zm-16-88c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/></svg></span>
</a>
<a href="https://github.com/ReUnit3d/ReUnit3d" title="Git repository" aria-label="Git repository">
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg></span>
</a>
</div>
</div>
<div id="mdbook-search-wrapper" class="hidden">
<form id="mdbook-searchbar-outer" class="searchbar-outer">
<div class="search-wrapper">
<input type="search" id="mdbook-searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="mdbook-searchresults-outer" aria-describedby="searchresults-header">
<div class="spinner-wrapper">
<span class=fa-svg id="fa-spin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M304 48c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zm0 416c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zM48 304c26.5 0 48-21.5 48-48s-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48zm464-48c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zM142.9 437c18.7-18.7 18.7-49.1 0-67.9s-49.1-18.7-67.9 0s-18.7 49.1 0 67.9s49.1 18.7 67.9 0zm0-294.2c18.7-18.7 18.7-49.1 0-67.9S93.7 56.2 75 75s-18.7 49.1 0 67.9s49.1 18.7 67.9 0zM369.1 437c18.7 18.7 49.1 18.7 67.9 0s18.7-49.1 0-67.9s-49.1-18.7-67.9 0s-18.7 49.1 0 67.9z"/></svg></span>
</div>
</div>
</form>
<div id="mdbook-searchresults-outer" class="searchresults-outer hidden">
<div id="mdbook-searchresults-header" class="searchresults-header"></div>
<ul id="mdbook-searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('mdbook-sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('mdbook-sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#mdbook-sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="mdbook-content" class="content">
<main>
<h1 id="introduction-8"><a href="#introduction-8" class="header">Introduction</a></h1>
<p>Welcome to the official documentation for <strong>UNIT3D</strong> - a modern, feature-rich private torrent tracker platform built with Laravel.</p>
<h3 id="about-unit3d"><a class="header" href="#about-unit3d">About UNIT3D</a></h3>
<p>UNIT3D (pronounced “united”) is a powerful, open-source private torrent tracker solution that provides a comprehensive platform for managing and sharing content within your community. Built from the ground up with modern web technologies, UNIT3D combines excellent performance, security, and scalability with a feature-rich interface that rivals other private tracker softwares around the world. UNIT3D is a complete BitTorrent tracker management system designed for private communities. It handles everything from user management, torrent uploads and downloads, peer tracking, to community features like forums, achievements, real-time chat and much more. The codebase follows the MVC (Model-View-Controller) architectural pattern to ensure clarity between business logic and presentation, making it maintainable and extensible.</p>
<h3 id="technology-stack"><a class="header" href="#technology-stack">Technology Stack</a></h3>
<p>UNIT3D is built on a modern technology stack:</p>
<h4 id="backend"><a class="header" href="#backend">Backend</a></h4>
<ul>
<li><strong>PHP 8.4+</strong> - Latest PHP version with performance enhancements and type safety</li>
<li><strong>Laravel 12</strong> - The leading PHP framework for web artisans</li>
<li><strong>Livewire 3</strong> - Full-stack framework for building dynamic interfaces without leaving Laravel</li>
<li><strong>Laravel Scout</strong> - Full-text search with Meilisearch integration</li>
<li><strong>MySQL 8+</strong> - Relational database with strict mode compliance</li>
<li><strong>Redis</strong> - In-memory data structure store for caching and queues</li>
</ul>
<h4 id="frontend"><a class="header" href="#frontend">Frontend</a></h4>
<ul>
<li><strong>AlpineJS 3</strong> - Lightweight JavaScript framework for reactive interfaces</li>
<li><strong>Vite</strong> - Next-generation frontend build tool</li>
<li><strong>Livewire 3</strong> - Reactive components without writing JavaScript</li>
<li><strong>Socket.io</strong> - Real-time bidirectional event-based communication</li>
</ul>
<h4 id="development--quality"><a class="header" href="#development--quality">Development & Quality</a></h4>
<ul>
<li><strong>Pest</strong> - Elegant testing framework</li>
<li><strong>Larastan</strong> - PHPStan wrapper for Laravel static analysis</li>
<li><strong>Pint</strong> - Opinionated PHP code style fixer</li>
<li><strong>Prettier + Blade Plugin</strong> - Blade code formatting</li>
<li><strong>ParaTest</strong> - Parallel testing for faster test execution</li>
<li><strong>Laravel Debugbar</strong> - Debugging and profiling</li>
</ul>
<h2 id="project-structure"><a class="header" href="#project-structure">Project Structure</a></h2>
<p>UNIT3D follows Laravel’s conventional directory structure with some custom additions:</p>
<pre><code>UNIT3D/
├── app/ # Application core
│ ├── Achievements/ # Achievement system
│ ├── Actions/ # Single-purpose action classes (Fortify)
│ ├── Bots/ # IRC and other bot integrations
│ ├── Console/ # Artisan commands
│ ├── DTO/ # Data Transfer Objects
│ ├── Enums/ # Enumerations
│ ├── Events/ # Event classes
│ ├── Exceptions/ # Custom exception handlers
│ ├── Helpers/ # Helper functions
│ ├── Http/ # Controllers, middleware, requests, livewire components, resources
│ ├── Interfaces/ # Contracts and interfaces
│ ├── Jobs/ # Queued jobs
│ ├── Listeners/ # Event listeners
│ ├── Mail/ # Mail classes
│ ├── Models/ # Eloquent models
│ ├── Notifications/ # Notification classes
│ ├── Observers/ # Model observers
│ ├── Providers/ # Service providers
│ ├── Repositories/ # Data access layer
│ ├── Rules/ # Validation rules
│ ├── Services/ # External services (Rust announce, TMDB, IGDB)
│ ├── Traits/ # Reusable traits
│ └── View/ # View composers
│
├── bootstrap/ # Framework bootstrap
│ ├── app.php # Application bootstrap
│ └── cache/ # Compiled services and packages
│
├── config/ # Configuration files
│ ├── app.php # Core application config
│ ├── database.php # Database connections
│ ├── torrent.php # Torrent-specific settings
│ ├── unit3d.php # UNIT3D custom config
│ └── ... # 40+ configuration files
│
├── database/ # Database layer
│ ├── factories/ # Model factories for testing
│ ├── migrations/ # Database migrations
│ ├── schema/ # Database schema dumps
│ └── seeders/ # Database seeders
│
├── lang/ # Internationalization (60+ languages)
│ ├── en/ # English translations
│ ├── es/ # Spanish translations
│ ├── fr/ # French translations
│ └── ... # 60+ language directories
│
├── public/ # Web server document root
│ ├── index.php # Entry point
│ ├── build/ # Compiled assets (Vite)
│ ├── img/ # Images
│ └── sounds/ # Audio files
│
├── resources/ # Raw assets and views
│ ├── js/ # JavaScript source files
│ ├── sass/ # SCSS/Sass stylesheets
│ └── views/ # Blade templates
│
├── routes/ # Application routes
│ ├── web.php # Web routes
│ ├── api.php # API routes
│ ├── announce.php # Torrent announce routes
│ ├── rss.php # RSS feed routes
│ ├── chat.php # Chat component routes
│ └── channels.php # WebSocket channels
│
├── storage/ # Generated files and logs
│ ├── app/ # User uploads
│ ├── framework/ # Framework generated files
│ ├── logs/ # Application logs
│ └── backups/ # Automated backups
│
├── tests/ # Automated tests
│ ├── Feature/ # Feature tests
│ ├── Unit/ # Unit tests
│ └── Pest.php # Pest configuration
│
├── book/ # Documentation (mdBook)
│ └── src/ # Documentation source
│
├── artisan # Laravel CLI tool
├── composer.json # PHP dependencies
├── package.json # Node dependencies
├── vite.config.js # Vite build configuration
├── phpstan.neon # Static analysis configuration
├── pint.json # Code style configuration
└── phpunit.xml # PHPUnit test configuration
</code></pre>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="unit3d-development-on-arch-linux-with-laravel-sail"><a class="header" href="#unit3d-development-on-arch-linux-with-laravel-sail">UNIT3D development on Arch Linux with Laravel Sail</a></h1>
<!-- cspell:ignore dockerized,pacman,reqs -->
<p><em>A guide by EkoNesLeg</em></p>
<p>This guide outlines the steps to set up UNIT3D using Laravel Sail on Arch Linux. While the guide highlights the use of Arch Linux, the instructions can be adapted to other environments.</p>
<blockquote class="blockquote-tag blockquote-tag-important">
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>Important</p>
<p>This guide is intended for local development environments only and is not suitable for production deployment.</p>
</blockquote>
<h2 id="modifying-env-and-secure-headers-for-non-https-instances"><a class="header" href="#modifying-env-and-secure-headers-for-non-https-instances">Modifying <code>.env</code> and secure headers for non-HTTPS instances</a></h2>
<p>For local development, HTTP is commonly used instead of HTTPS. To prevent mixed content issues, adjust your <code>.env</code> file as follows:</p>
<ol>
<li><strong>Create the <code>.env</code> Config:</strong>
<ul>
<li>
<p>Create a <code>.env</code> file in the root directory of your UNIT3D project.</p>
</li>
<li>
<p>Copy and paste the contents from <code>.env.example</code> into the <code>.env</code> file.</p>
</li>
<li>
<p>Add or modify the following environment variables:</p>
<pre><code class="language-dotenv">DB_HOST=mysql # Match the container name in the compose file
DB_USERNAME=unit3d # The username can be anything except `root`
SESSION_SECURE_COOKIE=false # Disables secure cookies
REDIS_HOST=redis # Match the container name in the compose file
CSP_ENABLED=false # Disables Content Security Policy
HSTS_ENABLED=false # Disables Strict Transport Security
</code></pre>
</li>
</ul>
</li>
</ol>
<h2 id="prerequisites"><a class="header" href="#prerequisites">Prerequisites</a></h2>
<p>Ensure Docker and Docker Compose are installed, as they are required for managing the Dockerized development environment provided by Laravel Sail.</p>
<h3 id="installing-docker-and-docker-compose"><a class="header" href="#installing-docker-and-docker-compose">Installing Docker and Docker Compose</a></h3>
<p>Refer to the <a href="https://wiki.archlinux.org/title/Docker">Arch Linux Docker documentation</a> and install the necessary packages:</p>
<pre><code class="language-sh">sudo pacman -S docker docker-compose
</code></pre>
<h2 id="step-1-clone-the-repository"><a class="header" href="#step-1-clone-the-repository">Step 1: clone the repository</a></h2>
<p>Clone the UNIT3D repository to your local environment:</p>
<ol>
<li>
<p>Navigate to your chosen workspace directory:</p>
<pre><code class="language-sh">cd ~/PhpstormProjects
</code></pre>
</li>
<li>
<p>Clone the repository:</p>
<pre><code class="language-sh">git clone git@github.com:ReUnit3d/ReUnit3d.git
</code></pre>
</li>
</ol>
<h2 id="step-2-composer-dependency-installation"><a class="header" href="#step-2-composer-dependency-installation">Step 2: Composer dependency installation</a></h2>
<ol>
<li>
<p><strong>Change to the project’s root directory:</strong></p>
<pre><code class="language-sh">cd ~/PhpstormProjects/UNIT3D
</code></pre>
</li>
<li>
<p><strong>Install Composer dependencies:</strong></p>
<p>Run the following command to install the PHP dependencies:</p>
<pre><code class="language-sh">composer install --ignore-platform-reqs
</code></pre>
</li>
</ol>
<h2 id="step-3-docker-environment-initialization"><a class="header" href="#step-3-docker-environment-initialization">Step 3: Docker environment initialization</a></h2>
<ol>
<li>
<p><strong>Switch to branch <code>development</code>:</strong></p>
<p>Before starting Docker, switch to the <code>development</code> branch:</p>
<pre><code class="language-sh">git checkout development
</code></pre>
</li>
<li>
<p><strong>Start the Docker environment using Laravel Sail:</strong></p>
<pre><code class="language-sh">./vendor/bin/sail up -d
</code></pre>
</li>
</ol>
<h2 id="step-4-app-key-generation"><a class="header" href="#step-4-app-key-generation">Step 4: app key generation</a></h2>
<p>Generate a new <code>APP_KEY</code> in the <code>.env</code> file for encryption:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan key:generate
</code></pre>
<p><strong>Note</strong>: If you are importing a database backup, make sure to set the <code>APP_KEY</code> in the <code>.env</code> file to match the key used when the backup was created.</p>
<h2 id="step-5-database-migrations-and-seeders"><a class="header" href="#step-5-database-migrations-and-seeders">Step 5: database migrations and seeders</a></h2>
<p>Initialize your database with sample data by running migrations and seeders:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan migrate:fresh --seed
</code></pre>
<blockquote class="blockquote-tag blockquote-tag-important">
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>Important</p>
<p>This operation resets your database and seeds it with default data. Avoid running this in a production environment.</p>
</blockquote>
<h2 id="step-6-database-preparation"><a class="header" href="#step-6-database-preparation">Step 6: database preparation</a></h2>
<h3 id="initial-database-loading"><a class="header" href="#initial-database-loading">Initial database loading</a></h3>
<p>Prepare your database with the initial schema and data. Make sure you have a database dump file, such as <code>prod-site-backup.sql</code>.</p>
<h3 id="mysql-data-importation"><a class="header" href="#mysql-data-importation">MySQL data importation</a></h3>
<p>Import your database dump into MySQL within the Docker environment:</p>
<pre><code class="language-bash">./vendor/bin/sail mysql -u root -p unit3d < prod-site-backup.sql
</code></pre>
<p><strong>Note</strong>: Ensure that the <code>APP_KEY</code> in the <code>.env</code> file matches the key used in your deployment environment for compatibility.</p>
<h2 id="step-7-npm-dependency-management"><a class="header" href="#step-7-npm-dependency-management">Step 7: NPM dependency management</a></h2>
<p>Manage Node.js dependencies and compile assets within the Docker environment:</p>
<pre><code class="language-bash">./vendor/bin/sail bun install
./vendor/bin/sail bun run build
</code></pre>
<p>If needed, refresh the Node.js environment:</p>
<pre><code class="language-bash">./vendor/bin/sail rm -rf node_modules && bun pm cache rm && bun install && bun run build
</code></pre>
<h2 id="step-8-application-cache-configuration"><a class="header" href="#step-8-application-cache-configuration">Step 8: application cache configuration</a></h2>
<p>Optimize the application’s performance by setting up the cache:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan set:all_cache
</code></pre>
<h2 id="step-9-environment-restart"><a class="header" href="#step-9-environment-restart">Step 9: environment restart</a></h2>
<p>Apply new configurations or restart the environment by toggling the Docker environment:</p>
<pre><code class="language-bash">./vendor/bin/sail restart && ./vendor/bin/sail artisan queue:restart
</code></pre>
<h2 id="additional-notes"><a class="header" href="#additional-notes">Additional notes</a></h2>
<ul>
<li><strong>Permissions</strong>: Use <code>sudo</code> cautiously to avoid permission conflicts, particularly with Docker commands that require elevated access.</li>
</ul>
<h3 id="appendix-sail-commands-for-unit3d"><a class="header" href="#appendix-sail-commands-for-unit3d">Appendix: Sail commands for UNIT3D</a></h3>
<p>This section provides a reference for managing and interacting with UNIT3D using Laravel Sail.</p>
<h4 id="docker-management"><a class="header" href="#docker-management">Docker management</a></h4>
<ul>
<li>
<p><strong>Start environment</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail up -d
</code></pre>
<p>Starts Docker containers in detached mode.</p>
</li>
<li>
<p><strong>Stop environment</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail down
</code></pre>
<p>Stops and removes Docker containers.</p>
</li>
<li>
<p><strong>Restart environment</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail restart
</code></pre>
<p>Applies changes by restarting the Docker environment.</p>
</li>
</ul>
<h4 id="dependency-management"><a class="header" href="#dependency-management">Dependency management</a></h4>
<ul>
<li>
<p><strong>Install Composer dependencies</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail composer install
</code></pre>
<p>Installs PHP dependencies defined in <code>composer.json</code>.</p>
</li>
<li>
<p><strong>Update Composer dependencies</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail composer update
</code></pre>
<p>Updates PHP dependencies defined in <code>composer.json</code>.</p>
</li>
</ul>
<h4 id="laravel-artisan"><a class="header" href="#laravel-artisan">Laravel Artisan</a></h4>
<ul>
<li>
<p><strong>Run migrations</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan migrate
</code></pre>
<p>Executes database migrations.</p>
</li>
<li>
<p><strong>Seed database</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan db:seed
</code></pre>
<p>Seeds the database with predefined data.</p>
</li>
<li>
<p><strong>Refresh database</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan migrate:fresh --seed
</code></pre>
<p>Resets and seeds the database.</p>
</li>
<li>
<p><strong>Cache configurations</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan set:all_cache
</code></pre>
<p>Clears and caches configurations for performance.</p>
</li>
</ul>
<h4 id="npm-and-assets"><a class="header" href="#npm-and-assets">NPM and assets</a></h4>
<ul>
<li>
<p><strong>Install NPM dependencies</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail bun install
</code></pre>
<p>Installs Node.js dependencies.</p>
</li>
<li>
<p><strong>Compile assets</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail bun run build
</code></pre>
<p>Compiles CSS and JavaScript assets.</p>
</li>
</ul>
<h4 id="database-operations"><a class="header" href="#database-operations">Database operations</a></h4>
<ul>
<li><strong>MySQL interaction</strong>:
<pre><code class="language-bash">./vendor/bin/sail mysql -u root -p
</code></pre>
Opens MySQL CLI for database interaction.</li>
</ul>
<h4 id="queue-management"><a class="header" href="#queue-management">Queue management</a></h4>
<ul>
<li><strong>Restart queue workers</strong>:
<pre><code class="language-bash">./vendor/bin/sail artisan queue:restart
</code></pre>
Restarts queue workers after changes.</li>
</ul>
<h4 id="troubleshooting"><a class="header" href="#troubleshooting">Troubleshooting</a></h4>
<ul>
<li>
<p><strong>View logs</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail logs
</code></pre>
<p>Displays Docker container logs.</p>
</li>
<li>
<p><strong>Run PHPUnit (PEST) tests</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan test
</code></pre>
<p>Runs PEST tests for the application.</p>
</li>
</ul>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="unit3d-v8xx-on-macos-with-laravel-sail-and-phpstorm"><a class="header" href="#unit3d-v8xx-on-macos-with-laravel-sail-and-phpstorm">UNIT3D v8.x.x on MacOS with Laravel Sail and PhpStorm</a></h1>
<p><em>A guide by HDVinnie</em></p>
<p>This guide is designed for setting up UNIT3D, a Laravel application, leveraging Laravel Sail on MacOS.</p>
<p><strong>Warning</strong>: This setup guide is intended for local development environments only and is not suitable for production
deployment.</p>
<h2 id="modifying-env-and-secure-headers-for-non-https-instances-1"><a class="header" href="#modifying-env-and-secure-headers-for-non-https-instances-1">Modifying .env and secure headers for non-HTTPS instances</a></h2>
<p>For local development, HTTP is commonly used instead of HTTPS. To prevent mixed content issues, adjust your <code>.env</code> file as follows:</p>
<ol>
<li><strong>Create the <code>.env</code> Config:</strong>
<ul>
<li>
<p>Create a <code>.env</code> file in the root directory of your UNIT3D project.</p>
</li>
<li>
<p>Copy and paste the contents from <code>.env.example</code> into the <code>.env</code> file.</p>
</li>
<li>
<p>Add or modify the following environment variables:</p>
<pre><code class="language-dotenv">DB_HOST=mysql # Match the container name in the compose file
DB_USERNAME=unit3d # The username can be anything except `root`
SESSION_SECURE_COOKIE=false # Disables secure cookies
REDIS_HOST=redis # Match the container name in the compose file
CSP_ENABLED=false # Disables Content Security Policy
HSTS_ENABLED=false # Disables Strict Transport Security
</code></pre>
</li>
</ul>
</li>
</ol>
<h2 id="prerequisites-1"><a class="header" href="#prerequisites-1">Prerequisites</a></h2>
<h3 id="installing-homebrew"><a class="header" href="#installing-homebrew">Installing Homebrew</a></h3>
<p>If you don’t have Homebrew installed:</p>
<pre><code class="language-bash">/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
</code></pre>
<h3 id="installing-php-and-composer"><a class="header" href="#installing-php-and-composer">Installing PHP and Composer</a></h3>
<pre><code class="language-bash">brew install php composer
</code></pre>
<h3 id="installing-docker-desktop"><a class="header" href="#installing-docker-desktop">Installing Docker Desktop</a></h3>
<p><a href="https://docs.docker.com/desktop/install/mac-install/">Install Docker Desktop</a></p>
<p>Once installed, launch Docker Desktop</p>
<h3 id="installing-github-desktop"><a class="header" href="#installing-github-desktop">Installing GitHub Desktop</a></h3>
<p><a href="https://desktop.github.com">Install GitHub Desktop</a></p>
<p>Once installed, launch GitHub Desktop</p>
<h3 id="installing-phpstorm"><a class="header" href="#installing-phpstorm">Installing PHPStorm</a></h3>
<p><a href="https://www.jetbrains.com/phpstorm/">Install PHPStorm</a></p>
<p>Once installed, launch PHPStorm</p>
<h2 id="step-1-clone-the-repository-1"><a class="header" href="#step-1-clone-the-repository-1">Step 1: clone the repository</a></h2>
<p>Firstly, clone the UNIT3D repository to your local environment by visiting <a href="https://github.com/ReUnit3d/ReUnit3d">UNIT3D Repo</a>. Then click the blue colored code button and select <code>Open with Github Desktop</code>. Once Github Desktop is open set you local path to clone to like <code>/Users/HDVinnie/Documents/Personal/UNIT3D</code></p>
<h2 id="step-2-open-the-project-in-phpstorm"><a class="header" href="#step-2-open-the-project-in-phpstorm">Step 2: open the project in PHPStorm</a></h2>
<p>Within PHPStorm goto <code>File</code> and then click <code>Open</code>. Select the local path you just did like <code>/Users/HDVinnie/Documents/Personal/UNIT3D</code>.</p>
<h3 id="the-following-commands-are-run-in-phpstorm-can-do-so-by-clicking-tools-run-command"><a class="header" href="#the-following-commands-are-run-in-phpstorm-can-do-so-by-clicking-tools-run-command">The following commands are run in PHPStorm. Can do so by clicking <code>Tools->Run Command</code>.</a></h3>
<h2 id="step-2-environment-configuration"><a class="header" href="#step-2-environment-configuration">Step 2: Environment configuration</a></h2>
<ol>
<li>
<p><strong>Create the <code>.env</code> file:</strong></p>
<pre><code class="language-bash">cp .env.example .env
</code></pre>
</li>
<li>
<p><strong>Configure Docker-specific settings:</strong>
Edit your <code>.env</code> file and ensure these Docker container settings are configured:</p>
<pre><code class="language-dotenv">DB_HOST=mysql # Match the container name in the compose file
DB_USERNAME=unit3d # The username can be anything except `root`
REDIS_HOST=redis # Match the container name in the compose file
</code></pre>
</li>
</ol>
<h2 id="step-3-composer-dependency-installation"><a class="header" href="#step-3-composer-dependency-installation">Step 3: Composer dependency installation</a></h2>
<p>Install PHP dependencies to bootstrap Laravel Sail:</p>
<pre><code class="language-bash">composer install
</code></pre>
<p><strong>Note</strong>: This step is required before using Laravel Sail because <code>./vendor/bin/sail</code> doesn’t exist until Composer installs the Laravel Sail package and creates the vendor directory.</p>
<h2 id="step-4-start-sail"><a class="header" href="#step-4-start-sail">Step 4: start Sail</a></h2>
<p>Initialize the Docker environment using Laravel Sail:</p>
<pre><code class="language-bash">./vendor/bin/sail up -d
</code></pre>
<h2 id="step-5-app-key-generation"><a class="header" href="#step-5-app-key-generation">Step 5: app key generation</a></h2>
<p>Generate a new <code>APP_KEY</code> in the <code>.env</code> file for encryption:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan key:generate
</code></pre>
<p><strong>Note</strong>: If you are importing a database backup, make sure to set the <code>APP_KEY</code> in the <code>.env</code> file to match the key used when the backup was created.</p>
<h2 id="step-6-bun-dependency-install-and-compile-assets"><a class="header" href="#step-6-bun-dependency-install-and-compile-assets">Step 6: Bun dependency install and compile assets</a></h2>
<pre><code class="language-bash">./vendor/bin/sail bun install
</code></pre>
<pre><code class="language-bash">./vendor/bin/sail bun run build
</code></pre>
<h2 id="step-7-database-setup"><a class="header" href="#step-7-database-setup">Step 7: Database setup</a></h2>
<p>Choose one of the following options:</p>
<h3 id="step-7a-database-migrations-and-seeders-for-sample-data"><a class="header" href="#step-7a-database-migrations-and-seeders-for-sample-data">Step 7a: Database migrations and seeders (for sample data)</a></h3>
<p>For database initialization with sample data, apply migrations and seeders:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan migrate:fresh --seed
</code></pre>
<p><strong>Caution</strong>: This operation will reset your database and seed it with default data. Exercise caution in production
settings.</p>
<h3 id="step-7b-database-preparation-for-production-database-backup"><a class="header" href="#step-7b-database-preparation-for-production-database-backup">Step 7b: Database preparation (for production database backup)</a></h3>
<p>If you want to use a production database backup locally:</p>
<h3 id="initial-database-loading-1"><a class="header" href="#initial-database-loading-1">Initial database loading</a></h3>
<p>Prepare your database with the initial schema and data. Ensure you have a database dump file,
e.g., <code>prod-site-backup.sql</code>.</p>
<h3 id="mysql-data-importation-1"><a class="header" href="#mysql-data-importation-1">MySQL data importation</a></h3>
<p>To import your database dump into MySQL within the local environment, use:</p>
<pre><code class="language-bash">./vendor/bin/sail mysql -u root -p unit3d < prod-site-backup.sql
</code></pre>
<p><strong>Note</strong>: For this to work properly you must set the APP_KEY value in your local <code>.env</code> file to match you prod APP_KEY value.</p>
<h2 id="step-8-application-cache-configuration-1"><a class="header" href="#step-8-application-cache-configuration-1">Step 8: application cache configuration</a></h2>
<p>Optimize the application’s performance by setting up the cache:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan set:all_cache
</code></pre>
<h2 id="step-9-visit-local-instance"><a class="header" href="#step-9-visit-local-instance">Step 9: visit local instance</a></h2>
<p>Open your browser and visit <code>localhost</code>. Enjoy!</p>
<h2 id="additional-notes-1"><a class="header" href="#additional-notes-1">Additional notes</a></h2>
<ul>
<li><strong>Permissions</strong>: Exercise caution with <code>sudo</code> to avoid permission conflicts, particularly for Docker commands
requiring elevated access.</li>
</ul>
<h3 id="appendix-sail-commands-for-unit3d-1"><a class="header" href="#appendix-sail-commands-for-unit3d-1">Appendix: Sail commands for UNIT3D</a></h3>
<p>This section outlines commands for managing and interacting with UNIT3D using Laravel Sail.</p>
<h4 id="sail-management"><a class="header" href="#sail-management">Sail management</a></h4>
<ul>
<li>
<p><strong>Start environment</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail up -d
</code></pre>
<p>Starts Docker containers in detached mode.</p>
</li>
<li>
<p><strong>Stop environment</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail down -v
</code></pre>
<p>Stops and removes Docker containers.</p>
</li>
<li>
<p><strong>Restart environment</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail restart
</code></pre>
<p>Applies changes by restarting Docker environment.</p>
</li>
</ul>
<h4 id="dependency-management-1"><a class="header" href="#dependency-management-1">Dependency management</a></h4>
<ul>
<li>
<p><strong>Install Composer dependencies</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail composer install
</code></pre>
<p>Installs PHP dependencies defined in <code>composer.json</code>.</p>
</li>
<li>
<p><strong>Update Composer dependencies</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail composer update
</code></pre>
<p>Updates PHP dependencies defined in <code>composer.json</code>.</p>
</li>
</ul>
<h4 id="laravel-artisan-1"><a class="header" href="#laravel-artisan-1">Laravel Artisan</a></h4>
<ul>
<li>
<p><strong>Run migrations</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan migrate
</code></pre>
<p>Executes database migrations.</p>
</li>
<li>
<p><strong>Seed database</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan db:seed
</code></pre>
<p>Seeds database with predefined data.</p>
</li>
<li>
<p><strong>Refresh database</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan migrate:fresh --seed
</code></pre>
<p>Resets and seeds database.</p>
</li>
<li>
<p><strong>Cache configurations</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan set:all_cache
</code></pre>
<p>Clears and caches configurations for performance.</p>
</li>
</ul>
<h4 id="npm-and-assets-1"><a class="header" href="#npm-and-assets-1">NPM and assets</a></h4>
<ul>
<li>
<p><strong>Install Bun dependencies</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail bun install
</code></pre>
<p>Installs Node.js dependencies.</p>
</li>
<li>
<p><strong>Compile assets</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail bun run build
</code></pre>
<p>Compiles CSS and JavaScript assets.</p>
</li>
</ul>
<h4 id="database-operations-1"><a class="header" href="#database-operations-1">Database operations</a></h4>
<ul>
<li><strong>MySQL interaction</strong>:
<pre><code class="language-bash">./vendor/bin/sail mysql -u root -p
</code></pre>
Opens MySQL CLI for database interaction.</li>
</ul>
<h4 id="queue-management-1"><a class="header" href="#queue-management-1">Queue management</a></h4>
<ul>
<li><strong>Restart queue workers</strong>:
<pre><code class="language-bash">./vendor/bin/sail artisan queue:restart
</code></pre>
Restarts queue workers after changes.</li>
</ul>
<h4 id="troubleshooting-1"><a class="header" href="#troubleshooting-1">Troubleshooting</a></h4>
<ul>
<li>
<p><strong>View logs</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail logs
</code></pre>
<p>Displays Docker container logs.</p>
</li>
<li>
<p><strong>PHPUnit (PEST) tests</strong>:</p>
<pre><code class="language-bash">./vendor/bin/sail artisan test
</code></pre>
<p>Runs PEST tests for application.</p>
</li>
</ul>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="server-management"><a class="header" href="#server-management">Server management</a></h1>
<!-- cspell:ignore certbot,chgrp,usermod -->
<blockquote class="blockquote-tag blockquote-tag-important">
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>Important</p>
<p>The following assumptions are made:</p>
<ul>
<li>You have one <code>root</code> user and one regular user with sudo privileges on the dedicated server.</li>
<li>The regular user with sudo privileges is assumed to have the username <code>ubuntu</code>.</li>
<li>The project root directory is located at <code>/var/www/html</code>.</li>
<li>All commands are run from the project root directory.</li>
</ul>
</blockquote>
<h2 id="1-elevated-shell"><a class="header" href="#1-elevated-shell">1. Elevated shell</a></h2>
<p>All SSH and SFTP operations should be conducted using the non-root user. Use <code>sudo</code> for any commands that require elevated privileges. Do not use the <code>root</code> user directly.</p>
<h2 id="2-file-permissions"><a class="header" href="#2-file-permissions">2. File permissions</a></h2>
<p>Ensure that everything in <code>/var/www/html</code> is owned by <code>www-data:www-data</code>, except for <code>node_modules</code>, which should be owned by <code>root:root</code>.</p>
<p>Set up these permissions with the following commands:</p>
<pre><code class="language-sh">sudo usermod -a -G www-data ubuntu
sudo chown -R www-data:www-data /var/www/html
sudo find /var/www/html -type f -exec chmod 664 {} \;
sudo find /var/www/html -type d -exec chmod 775 {} \;
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
sudo rm -rf node_modules && sudo bun install && sudo bun run build
</code></pre>
<h2 id="3-handling-code-changes"><a class="header" href="#3-handling-code-changes">3. Handling code changes</a></h2>
<h3 id="php-changes"><a class="header" href="#php-changes">PHP changes</a></h3>
<p>If any PHP files are modified, run the following commands to clear the cache, restart the PHP-FPM service, and restart the Laravel queues:</p>
<pre><code class="language-sh">sudo php artisan set:all_cache && sudo systemctl restart php8.4-fpm && sudo php artisan queue:restart
</code></pre>
<h3 id="static-assets-scss-js"><a class="header" href="#static-assets-scss-js">Static assets (SCSS, JS)</a></h3>
<p>If you make changes to SCSS or JavaScript files, rebuild the static assets using:</p>
<pre><code class="language-sh">bun run build
</code></pre>
<h2 id="4-changing-the-domain"><a class="header" href="#4-changing-the-domain">4. Changing the domain</a></h2>
<ol>
<li>
<p><strong>Update the environment variables:</strong></p>
<p>Modify the domain in the <code>APP_URL</code> and <code>MIX_ECHO_ADDRESS</code> variables within the <code>.env</code> file:</p>
<pre><code class="language-sh">sudo nano ./.env
</code></pre>
</li>
<li>
<p><strong>Refresh the TLS certificate:</strong></p>
<p>Use <code>certbot</code> to refresh the TLS certificate:</p>
<pre><code class="language-sh">certbot --redirect --nginx -n --agree-tos --email=sysop@your_domain.tld -d your_domain.tld -d www.your_domain.tld --rsa-key-size 2048
</code></pre>
</li>
<li>
<p><strong>Update the WebSocket configuration:</strong></p>
<p>Update all domains listed in the WebSocket configuration to reflect the new domain:</p>
<pre><code class="language-sh">sudo nano ./laravel-echo-server.json
</code></pre>
</li>
<li>
<p><strong>Restart the chatbox server:</strong></p>
<p>Reload the Supervisor configuration to apply changes:</p>
<pre><code class="language-sh">sudo supervisorctl reload
</code></pre>
</li>
<li>
<p><strong>Compile static assets:</strong></p>
<p>Rebuild the static assets:</p>
<pre><code class="language-sh">bun run build
</code></pre>
</li>
</ol>
<h2 id="5-meilisearch-maintenance"><a class="header" href="#5-meilisearch-maintenance">5. Meilisearch maintenance</a></h2>
<p>Refer <a href="https://github.com/ReUnit3d/ReUnit3d/wiki/Meilisearch-Setup-for-UNIT3D">Meilisearch setup for UNIT3D</a>, specifically the <a href="https://github.com/ReUnit3d/ReUnit3d/wiki/Meilisearch-Setup-for-UNIT3D#3-maintenance">maintenance</a> section, for managing upgrades and syncing indexes.</p>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="meilisearch-setup-for-unit3d"><a class="header" href="#meilisearch-setup-for-unit3d">Meilisearch setup for UNIT3D</a></h1>
<p><strong>Note:</strong> This guide assumes you are using a <code>sudo</code> user named <code>ubuntu</code>.</p>
<h2 id="1-install-and-configure-meilisearch"><a class="header" href="#1-install-and-configure-meilisearch">1. Install and configure Meilisearch</a></h2>
<ol>
<li>
<p><strong>Install Meilisearch:</strong></p>
<pre><code class="language-sh">sudo curl -L https://install.meilisearch.com | sudo sh
sudo mv ./meilisearch /usr/local/bin/
sudo chmod +x /usr/local/bin/meilisearch
</code></pre>
</li>
<li>
<p><strong>Set up directories:</strong></p>
<pre><code class="language-sh">sudo mkdir -p /var/lib/meilisearch/data /var/lib/meilisearch/dumps /var/lib/meilisearch/snapshots
sudo chown -R ubuntu:ubuntu /var/lib/meilisearch
sudo chmod -R 750 /var/lib/meilisearch
</code></pre>
</li>
<li>
<p><strong>Generate and record a master key:</strong></p>
<p>Generate a 16-byte master key:</p>
<pre><code class="language-sh">openssl rand -hex 16
</code></pre>
<p>Record this key, as it will be used in the configuration file.</p>
</li>
<li>
<p><strong>Configure Meilisearch:</strong></p>
<pre><code class="language-sh">sudo curl https://raw.githubusercontent.com/meilisearch/meilisearch/latest/config.toml -o /etc/meilisearch.toml
sudo nano /etc/meilisearch.toml
</code></pre>
<p>Update the following in <code>/etc/meilisearch.toml</code>:</p>
<pre><code class="language-toml">env = "production"
master_key = "your_16_byte_master_key"
db_path = "/var/lib/meilisearch/data"
dump_dir = "/var/lib/meilisearch/dumps"
snapshot_dir = "/var/lib/meilisearch/snapshots"
</code></pre>
</li>
<li>
<p><strong>Create and enable service:</strong></p>
<pre><code class="language-sh">sudo nano /etc/systemd/system/meilisearch.service
</code></pre>
<p>Add the following:</p>
<pre><code class="language-ini">[Unit]
Description=Meilisearch
After=systemd-user-sessions.service
[Service]
Type=simple
WorkingDirectory=/var/lib/meilisearch
ExecStart=/usr/local/bin/meilisearch --config-file-path /etc/meilisearch.toml
User=ubuntu
Group=ubuntu
Restart=on-failure
[Install]
WantedBy=multi-user.target
</code></pre>
<p>Enable and start the service:</p>
<pre><code class="language-sh">sudo systemctl enable meilisearch
sudo systemctl start meilisearch
sudo systemctl status meilisearch
</code></pre>
</li>
</ol>
<h2 id="2-configure-unit3d-for-meilisearch"><a class="header" href="#2-configure-unit3d-for-meilisearch">2. Configure UNIT3D for Meilisearch</a></h2>
<ol>
<li>
<p><strong>Update <code>.env</code>:</strong></p>
<pre><code class="language-sh">sudo nano /var/www/html/.env
</code></pre>
<p>Add the following:</p>
<pre><code class="language-env">SCOUT_DRIVER=meilisearch
MEILISEARCH_HOST=http://127.0.0.1:7700
MEILISEARCH_KEY=your_16_byte_master_key
</code></pre>
</li>
<li>
<p><strong>Clear configuration and restart services:</strong></p>
<pre><code class="language-sh">sudo php artisan set:all_cache
sudo systemctl restart php8.4-fpm
sudo php artisan queue:restart
</code></pre>
</li>
</ol>
<h2 id="3-maintenance"><a class="header" href="#3-maintenance">3. Maintenance</a></h2>
<ol>
<li>
<p><strong>Reload data and sync indexes:</strong></p>
<ul>
<li>
<p><strong>Sync index settings:</strong></p>
<p>After UNIT3D updates, sync the index settings to ensure they are up to date:</p>
<pre><code class="language-sh">sudo php artisan scout:sync-index-settings
</code></pre>
</li>
<li>
<p><strong>Reload data:</strong></p>
<p>Whenever Meilisearch is upgraded or during the initial setup, the database must be reloaded:</p>
<pre><code class="language-sh">sudo php artisan auto:sync_torrents_to_meilisearch --wipe && sudo php artisan auto:sync_people_to_meilisearch
</code></pre>
</li>
</ul>
</li>
</ol>
<h2 id="see-also"><a class="header" href="#see-also">See also</a></h2>
<p>For further details, refer to the <a href="https://www.meilisearch.com/docs/guides/deployment/running_production">official Meilisearch documentation</a>.</p>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="unit3d-announce"><a class="header" href="#unit3d-announce">UNIT3D-Announce</a></h1>
<p>UNIT3D-Announce is an optional external announce service written in rust that is designed to reduce CPU usage on high-volume trackers managing over 1 million peers.</p>
<blockquote class="blockquote-tag blockquote-tag-tip">
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"></path></svg>Tip</p>
<p>Enable only when extra performance is needed. The default announce suffices otherwise.</p>
</blockquote>
<p>Refer to the upstream documentation for configuration and usage details.</p>
<ul>
<li>
<p><strong>Consult</strong> the <a href="https://github.com/ReUnit3d/ReUnit3d-Announce/blob/main/README.md">README</a> for installation and usage instructions.</p>
</li>
<li>
<p><strong>Review</strong> the <a href="https://github.com/ReUnit3d/ReUnit3d-Announce/blob/main/.env.example"><code>.env.example</code></a> to configure required variables.</p>
</li>
</ul>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="migrating-from-supervisor-to-systemd"><a class="header" href="#migrating-from-supervisor-to-systemd">Migrating from Supervisor to Systemd</a></h1>
<p><strong>Note:</strong> This guide assumes you are using a <code>sudo</code> user named <code>ubuntu</code> and UNIT3D is installed at <code>/var/www/html</code>.</p>
<h2 id="why-migrate"><a class="header" href="#why-migrate">Why Migrate?</a></h2>
<p>Systemd offers several advantages over Supervisor for managing UNIT3D services:</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Aspect</th><th>Supervisor</th><th>Systemd</th></tr>
</thead>
<tbody>
<tr><td><strong>Overhead</strong></td><td>Python daemon, socket communication</td><td>Native kernel integration</td></tr>
<tr><td><strong>Memory</strong></td><td>~20-50MB for supervisord</td><td>Already running (init system)</td></tr>
<tr><td><strong>Boot Integration</strong></td><td>Requires separate service</td><td>Native system integration</td></tr>
<tr><td><strong>Logging</strong></td><td>File-based</td><td>Journald (structured, rotated)</td></tr>
<tr><td><strong>Security</strong></td><td>Basic</td><td>Namespaces, sandboxing, cgroups</td></tr>
</tbody>
</table>
</div>
<h2 id="1-create-systemd-unit-files"><a class="header" href="#1-create-systemd-unit-files">1. Create Systemd Unit Files</a></h2>
<h3 id="unit3d-announce-1"><a class="header" href="#unit3d-announce-1">UNIT3D-Announce</a></h3>
<blockquote class="blockquote-tag blockquote-tag-caution">
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Caution</p>
<p>Only create this Systemd unit file if usings rust based unit3d-announce!</p>
</blockquote>
<pre><code class="language-sh">sudo nano /etc/systemd/system/unit3d-announce.service
</code></pre>
<p>Add the following:</p>
<pre><code class="language-ini"># /etc/systemd/system/unit3d-announce.service
#
# Systemd service unit for UNIT3D-Announce
[Unit]
Description=UNIT3D Announce Tracker
Documentation=https://github.com/ReUnit3d/ReUnit3d-Announce
After=network.target mysql.service
Wants=mysql.service
[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/var/www/html/unit3d-announce