Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
1426 lines (1254 loc) · 58.7 KB
/
Copy pathindex.html
File metadata and controls
1426 lines (1254 loc) · 58.7 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">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SeedBox Control Panel</title>
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#0f3460">
<meta name="description" content="SeedBox Docker Management System - Control Panel for managing media applications">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="SeedBox">
<link rel="apple-touch-icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 180'><rect fill='%230f3460' width='180' height='180'/><text x='50%' y='50%' font-size='90' fill='%233B82F6' font-family='Arial' text-anchor='middle' dy='.3em' font-weight='bold'>SB</text></svg>">
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
* { font-family: 'Inter', sans-serif; }
.gradient-bg {
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.card-gradient {
background: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
backdrop-filter: blur(10px);
}
.app-card:hover {
transform: translateY(-5px);
box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.status-online { animation: pulse 2s infinite; }
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.btn-action {
transition: all 0.3s ease;
}
.btn-action:hover {
transform: scale(1.05);
}
.app-header {
background-size: 80px;
background-repeat: no-repeat;
background-position: right 10px center;
position: relative;
overflow: hidden;
}
.app-header::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: inherit;
opacity: 0.15;
background-size: cover;
background-position: center;
filter: blur(20px);
transform: scale(1.2);
}
.app-header-content {
position: relative;
z-index: 1;
}
.app-logo {
width: 50px;
height: 50px;
object-fit: contain;
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.terminal {
background: #1a1a1a;
font-family: 'Courier New', monospace;
font-size: 13px;
line-height: 1.5;
}
.tab-content { display: none; }
.tab-content.active { display: block; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #1a1a2e; }
::-webkit-scrollbar-thumb { background: #4a5568; border-radius: 4px; }
</style>
</head>
<body class="gradient-bg min-h-screen text-white">
<!-- Header -->
<header class="border-b border-gray-700/50 sticky top-0 z-50 bg-gray-900/80 backdrop-blur-lg">
<div class="container mx-auto px-6 py-4">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-10 h-10 bg-gradient-to-br from-blue-500 to-purple-600 rounded-lg flex items-center justify-center">
<i class="fas fa-server text-white"></i>
</div>
<div>
<h1 class="text-xl font-bold">SeedBox Control Panel</h1>
<p class="text-xs text-gray-400">Docker Management System</p>
</div>
</div>
<div class="flex items-center space-x-4">
<span id="currentTime" class="text-sm text-gray-400"></span>
<button onclick="refreshAll()" class="bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded-lg text-sm font-medium transition">
<i class="fas fa-sync-alt mr-2"></i>Refresh All
</button>
</div>
</div>
</div>
</header>
<!-- Navigation Tabs -->
<nav class="container mx-auto px-6 py-4">
<div class="flex space-x-2 bg-gray-800/50 rounded-xl p-2">
<button onclick="showTab('dashboard')" id="tab-dashboard" class="tab-btn flex-1 py-3 px-4 rounded-lg font-medium transition bg-blue-600">
<i class="fas fa-th-large mr-2"></i>Dashboard
</button>
<button onclick="showTab('apps')" id="tab-apps" class="tab-btn flex-1 py-3 px-4 rounded-lg font-medium transition hover:bg-gray-700">
<i class="fas fa-cubes mr-2"></i>Applications
</button>
<button onclick="showTab('logs')" id="tab-logs" class="tab-btn flex-1 py-3 px-4 rounded-lg font-medium transition hover:bg-gray-700">
<i class="fas fa-terminal mr-2"></i>Logs
</button>
<button onclick="showTab('deploy')" id="tab-deploy" class="tab-btn flex-1 py-3 px-4 rounded-lg font-medium transition hover:bg-gray-700">
<i class="fas fa-rocket mr-2"></i>Deploy Guide
</button>
</div>
</nav>
<main class="container mx-auto px-6 pb-10">
<!-- Dashboard Tab -->
<div id="content-dashboard" class="tab-content active">
<!-- System Stats -->
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8">
<div class="card-gradient rounded-2xl p-6 border border-gray-700/50">
<div class="flex items-center justify-between mb-4">
<span class="text-gray-400 text-sm">Server Uptime</span>
<i class="fas fa-clock text-green-400"></i>
</div>
<p id="uptime" class="text-2xl font-bold">Loading...</p>
<p class="text-xs text-gray-500 mt-1">Since last restart</p>
</div>
<div class="card-gradient rounded-2xl p-6 border border-gray-700/50">
<div class="flex items-center justify-between mb-4">
<span class="text-gray-400 text-sm">CPU Usage</span>
<i class="fas fa-microchip text-blue-400"></i>
</div>
<p id="cpuUsage" class="text-2xl font-bold">0%</p>
<div class="w-full bg-gray-700 rounded-full h-2 mt-2">
<div id="cpuBar" class="bg-blue-500 h-2 rounded-full transition-all" style="width: 0%"></div>
</div>
</div>
<div class="card-gradient rounded-2xl p-6 border border-gray-700/50">
<div class="flex items-center justify-between mb-4">
<span class="text-gray-400 text-sm">Memory Used</span>
<i class="fas fa-memory text-purple-400"></i>
</div>
<p id="memoryUsage" class="text-2xl font-bold">0 GB</p>
<div class="w-full bg-gray-700 rounded-full h-2 mt-2">
<div id="memoryBar" class="bg-purple-500 h-2 rounded-full transition-all" style="width: 0%"></div>
</div>
</div>
<div class="card-gradient rounded-2xl p-6 border border-gray-700/50">
<div class="flex items-center justify-between mb-4">
<span class="text-gray-400 text-sm">Disk Space</span>
<i class="fas fa-hdd text-orange-400"></i>
</div>
<p id="diskUsage" class="text-2xl font-bold">0 TB</p>
<div class="w-full bg-gray-700 rounded-full h-2 mt-2">
<div id="diskBar" class="bg-orange-500 h-2 rounded-full transition-all" style="width: 0%"></div>
</div>
</div>
</div>
<!-- Charts -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8">
<div class="card-gradient rounded-2xl p-6 border border-gray-700/50">
<h3 class="text-lg font-semibold mb-4">Resource Usage (Last 24h)</h3>
<canvas id="resourceChart" height="200"></canvas>
</div>
<div class="card-gradient rounded-2xl p-6 border border-gray-700/50">
<h3 class="text-lg font-semibold mb-4">Storage Distribution</h3>
<canvas id="storageChart" height="200"></canvas>
</div>
</div>
<!-- Quick Status -->
<div class="card-gradient rounded-2xl p-6 border border-gray-700/50">
<h3 class="text-lg font-semibold mb-4">Application Status Overview</h3>
<div class="grid grid-cols-2 md:grid-cols-5 gap-4" id="quickStatus">
<!-- Generated by JS -->
</div>
</div>
</div>
<!-- Applications Tab -->
<div id="content-apps" class="tab-content">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-bold">Docker Applications</h2>
<button onclick="installApp()" class="bg-green-600 hover:bg-green-700 px-4 py-2 rounded-lg text-sm font-medium transition">
<i class="fas fa-plus mr-2"></i>Install New App
</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6" id="appGrid">
<!-- Generated by JS -->
</div>
</div>
<!-- Logs Tab -->
<div id="content-logs" class="tab-content">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-bold">System Logs</h2>
<select id="logFilter" onchange="filterLogs()" class="bg-gray-800 border border-gray-700 rounded-lg px-4 py-2 text-sm">
<option value="all">All Applications</option>
<option value="radarr">Radarr</option>
<option value="sonarr">Sonarr</option>
<option value="plex">Plex</option>
<option value="utorrent">uTorrent</option>
<option value="overseerr">Overseerr</option>
</select>
</div>
<div class="terminal rounded-xl p-4 h-96 overflow-y-auto border border-gray-700" id="logContainer">
<!-- Generated by JS -->
</div>
</div>
<!-- Deploy Guide Tab -->
<div id="content-deploy" class="tab-content">
<h2 class="text-2xl font-bold mb-6">Deployment Guide</h2>
<!-- Step Navigation -->
<div class="flex space-x-2 mb-6 overflow-x-auto pb-2">
<button onclick="showDeployStep(1)" class="deploy-step-btn bg-blue-600 px-4 py-2 rounded-lg text-sm whitespace-nowrap">1. Prerequisites</button>
<button onclick="showDeployStep(2)" class="deploy-step-btn bg-gray-700 px-4 py-2 rounded-lg text-sm whitespace-nowrap">2. Backend Setup</button>
<button onclick="showDeployStep(3)" class="deploy-step-btn bg-gray-700 px-4 py-2 rounded-lg text-sm whitespace-nowrap">3. Nginx Config</button>
<button onclick="showDeployStep(4)" class="deploy-step-btn bg-gray-700 px-4 py-2 rounded-lg text-sm whitespace-nowrap">4. Docker Compose</button>
<button onclick="showDeployStep(5)" class="deploy-step-btn bg-gray-700 px-4 py-2 rounded-lg text-sm whitespace-nowrap">5. Final Steps</button>
</div>
<!-- Step 1: Prerequisites -->
<div id="deploy-step-1" class="deploy-step">
<div class="card-gradient rounded-2xl p-6 border border-gray-700/50">
<h3 class="text-xl font-semibold mb-4"><i class="fas fa-list-check mr-2 text-blue-400"></i>Prerequisites</h3>
<div class="space-y-4 text-gray-300">
<p>Before deploying, ensure you have:</p>
<ul class="list-disc list-inside space-y-2 ml-4">
<li>Ubuntu 20.04+ or Debian 11+ server</li>
<li>Root or sudo access</li>
<li>Domain name pointed to your server (optional but recommended)</li>
<li>Minimum 4GB RAM, 2 CPU cores, 100GB storage</li>
</ul>
<h4 class="font-semibold mt-6 mb-2">Install Required Packages:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto"><code># Update system
sudo apt update && sudo apt upgrade -y
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
# Install Docker Compose
sudo apt install docker-compose -y
# Install Python & dependencies
sudo apt install python3 python3-pip python3-venv nginx -y
# Install Node.js (for frontend if needed)
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install nodejs -y</code></pre>
</div>
</div>
</div>
<!-- Step 2: Backend Setup -->
<div id="deploy-step-2" class="deploy-step hidden">
<div class="card-gradient rounded-2xl p-6 border border-gray-700/50">
<h3 class="text-xl font-semibold mb-4"><i class="fas fa-code mr-2 text-green-400"></i>Python Backend (Flask API)</h3>
<h4 class="font-semibold mb-2">Create project structure:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto mb-4"><code>mkdir -p /opt/seedbox-panel
cd /opt/seedbox-panel
python3 -m venv venv
source venv/bin/activate
pip install flask flask-cors docker psutil gunicorn</code></pre>
<h4 class="font-semibold mb-2">Create app.py:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto text-xs" style="max-height: 500px;"><code>#!/usr/bin/env python3
"""
SeedBox Control Panel - Backend API
Save as: /opt/seedbox-panel/app.py
"""
from flask import Flask, jsonify, request
from flask_cors import CORS
import docker
import psutil
import os
import time
from datetime import datetime, timedelta
app = Flask(__name__)
CORS(app)
# Docker client
client = docker.from_env()
# App configurations
APPS = {
'radarr': {
'name': 'Radarr',
'image': 'linuxserver/radarr:latest',
'port': 7878,
'volumes': {'/opt/seedbox/radarr/config': {'bind': '/config', 'mode': 'rw'},
'/opt/seedbox/downloads': {'bind': '/downloads', 'mode': 'rw'},
'/opt/seedbox/movies': {'bind': '/movies', 'mode': 'rw'}},
'environment': {'PUID': '1000', 'PGID': '1000', 'TZ': 'UTC'}
},
'sonarr': {
'name': 'Sonarr',
'image': 'linuxserver/sonarr:latest',
'port': 8989,
'volumes': {'/opt/seedbox/sonarr/config': {'bind': '/config', 'mode': 'rw'},
'/opt/seedbox/downloads': {'bind': '/downloads', 'mode': 'rw'},
'/opt/seedbox/tv': {'bind': '/tv', 'mode': 'rw'}},
'environment': {'PUID': '1000', 'PGID': '1000', 'TZ': 'UTC'}
},
'plex': {
'name': 'Plex',
'image': 'linuxserver/plex:latest',
'port': 32400,
'volumes': {'/opt/seedbox/plex/config': {'bind': '/config', 'mode': 'rw'},
'/opt/seedbox/movies': {'bind': '/movies', 'mode': 'rw'},
'/opt/seedbox/tv': {'bind': '/tv', 'mode': 'rw'}},
'environment': {'PUID': '1000', 'PGID': '1000', 'TZ': 'UTC', 'VERSION': 'docker'}
},
'utorrent': {
'name': 'uTorrent',
'image': 'ekho/utorrent:latest',
'port': 8080,
'volumes': {'/opt/seedbox/utorrent/config': {'bind': '/utorrent/settings', 'mode': 'rw'},
'/opt/seedbox/downloads': {'bind': '/data', 'mode': 'rw'}},
'environment': {}
},
'overseerr': {
'name': 'Overseerr',
'image': 'linuxserver/overseerr:latest',
'port': 5055,
'volumes': {'/opt/seedbox/overseerr/config': {'bind': '/config', 'mode': 'rw'}},
'environment': {'PUID': '1000', 'PGID': '1000', 'TZ': 'UTC'}
}
}
def get_container(app_id):
"""Get container by app_id"""
try:
return client.containers.get(f"seedbox-{app_id}")
except docker.errors.NotFound:
return None
@app.route('/api/health', methods=['GET'])
def health():
return jsonify({'status': 'ok', 'timestamp': datetime.now().isoformat()})
@app.route('/api/system/stats', methods=['GET'])
def system_stats():
"""Get system statistics"""
# CPU
cpu_percent = psutil.cpu_percent(interval=1)
# Memory
memory = psutil.virtual_memory()
memory_used = memory.used / (1024**3) # GB
memory_total = memory.total / (1024**3) # GB
# Disk
disk = psutil.disk_usage('/')
disk_used = disk.used / (1024**4) # TB
disk_total = disk.total / (1024**4) # TB
disk_free = disk.free / (1024**4) # TB
# Uptime
boot_time = datetime.fromtimestamp(psutil.boot_time())
uptime = datetime.now() - boot_time
return jsonify({
'cpu': {'percent': cpu_percent},
'memory': {
'used': round(memory_used, 2),
'total': round(memory_total, 2),
'percent': memory.percent
},
'disk': {
'used': round(disk_used, 2),
'total': round(disk_total, 2),
'free': round(disk_free, 2),
'percent': disk.percent
},
'uptime': {
'days': uptime.days,
'hours': uptime.seconds // 3600,
'minutes': (uptime.seconds % 3600) // 60,
'formatted': f"{uptime.days}d {uptime.seconds // 3600}h {(uptime.seconds % 3600) // 60}m"
}
})
@app.route('/api/apps', methods=['GET'])
def list_apps():
"""List all applications with their status"""
apps = []
for app_id, config in APPS.items():
container = get_container(app_id)
status = 'stopped'
if container:
status = container.status
apps.append({
'id': app_id,
'name': config['name'],
'status': status,
'port': config['port'],
'image': config['image'],
'installed': container is not None
})
return jsonify(apps)
@app.route('/api/apps/<app_id>/install', methods=['POST'])
def install_app(app_id):
"""Install/deploy an application"""
if app_id not in APPS:
return jsonify({'error': 'App not found'}), 404
config = APPS[app_id]
# Create directories
for host_path in config['volumes'].keys():
os.makedirs(host_path, exist_ok=True)
try:
# Pull image
client.images.pull(config['image'])
# Create and start container
container = client.containers.run(
config['image'],
name=f"seedbox-{app_id}",
detach=True,
restart_policy={'Name': 'unless-stopped'},
ports={f"{config['port']}/tcp": config['port']},
volumes=config['volumes'],
environment=config['environment']
)
return jsonify({
'success': True,
'message': f"{config['name']} installed successfully",
'container_id': container.id[:12]
})
except Exception as e:
return jsonify({'error': str(e)}), 500
@app.route('/api/apps/<app_id>/start', methods=['POST'])
def start_app(app_id):
"""Start an application"""
container = get_container(app_id)
if not container:
return jsonify({'error': 'Container not found'}), 404
try:
container.start()
return jsonify({'success': True, 'message': f'{app_id} started'})
except Exception as e:
return jsonify({'error': str(e)}), 500
@app.route('/api/apps/<app_id>/stop', methods=['POST'])
def stop_app(app_id):
"""Stop an application"""
container = get_container(app_id)
if not container:
return jsonify({'error': 'Container not found'}), 404
try:
container.stop()
return jsonify({'success': True, 'message': f'{app_id} stopped'})
except Exception as e:
return jsonify({'error': str(e)}), 500
@app.route('/api/apps/<app_id>/restart', methods=['POST'])
def restart_app(app_id):
"""Restart an application"""
container = get_container(app_id)
if not container:
return jsonify({'error': 'Container not found'}), 404
try:
container.restart()
return jsonify({'success': True, 'message': f'{app_id} restarted'})
except Exception as e:
return jsonify({'error': str(e)}), 500
@app.route('/api/apps/<app_id>/update', methods=['POST'])
def update_app(app_id):
"""Update an application to latest version"""
if app_id not in APPS:
return jsonify({'error': 'App not found'}), 404
config = APPS[app_id]
container = get_container(app_id)
try:
# Pull latest image
client.images.pull(config['image'])
if container:
# Stop and remove old container
container.stop()
container.remove()
# Create new container with updated image
new_container = client.containers.run(
config['image'],
name=f"seedbox-{app_id}",
detach=True,
restart_policy={'Name': 'unless-stopped'},
ports={f"{config['port']}/tcp": config['port']},
volumes=config['volumes'],
environment=config['environment']
)
return jsonify({
'success': True,
'message': f'{config["name"]} updated successfully',
'container_id': new_container.id[:12]
})
except Exception as e:
return jsonify({'error': str(e)}), 500
@app.route('/api/apps/<app_id>/delete', methods=['DELETE'])
def delete_app(app_id):
"""Delete/uninstall an application"""
container = get_container(app_id)
if not container:
return jsonify({'error': 'Container not found'}), 404
try:
container.stop()
container.remove()
return jsonify({'success': True, 'message': f'{app_id} deleted'})
except Exception as e:
return jsonify({'error': str(e)}), 500
@app.route('/api/apps/<app_id>/logs', methods=['GET'])
def get_logs(app_id):
"""Get application logs"""
container = get_container(app_id)
if not container:
return jsonify({'error': 'Container not found'}), 404
try:
logs = container.logs(tail=100, timestamps=True).decode('utf-8')
return jsonify({'logs': logs.split('\n')})
except Exception as e:
return jsonify({'error': str(e)}), 500
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)</code></pre>
<h4 class="font-semibold mt-4 mb-2">Create systemd service:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto"><code># Create service file
sudo nano /etc/systemd/system/seedbox-panel.service</code></pre>
<pre class="terminal rounded-lg p-4 overflow-x-auto mt-2"><code>[Unit]
Description=SeedBox Control Panel API
After=network.target docker.service
[Service]
Type=simple
User=root
WorkingDirectory=/opt/seedbox-panel
Environment=PATH=/opt/seedbox-panel/venv/bin
ExecStart=/opt/seedbox-panel/venv/bin/gunicorn -w 4 -b 127.0.0.1:5000 app:app
Restart=always
[Install]
WantedBy=multi-user.target</code></pre>
<pre class="terminal rounded-lg p-4 overflow-x-auto mt-2"><code># Enable and start service
sudo systemctl daemon-reload
sudo systemctl enable seedbox-panel
sudo systemctl start seedbox-panel</code></pre>
</div>
</div>
<!-- Step 3: Nginx Config -->
<div id="deploy-step-3" class="deploy-step hidden">
<div class="card-gradient rounded-2xl p-6 border border-gray-700/50">
<h3 class="text-xl font-semibold mb-4"><i class="fas fa-globe mr-2 text-yellow-400"></i>Nginx Configuration</h3>
<h4 class="font-semibold mb-2">Create Nginx config:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto"><code>sudo nano /etc/nginx/sites-available/seedbox-panel</code></pre>
<pre class="terminal rounded-lg p-4 overflow-x-auto mt-2 text-xs"><code># /etc/nginx/sites-available/seedbox-panel
upstream seedbox_api {
server 127.0.0.1:5000;
}
server {
listen 80;
server_name your-domain.com; # Replace with your domain or IP
# Redirect to HTTPS (uncomment after SSL setup)
# return 301 https://$server_name$request_uri;
root /var/www/seedbox-panel;
index index.html;
# Frontend
location / {
try_files $uri $uri/ /index.html;
}
# API Proxy
location /api/ {
proxy_pass http://seedbox_api;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
proxy_read_timeout 86400;
}
# Proxy to Radarr
location /radarr {
proxy_pass http://127.0.0.1:7878;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# Proxy to Sonarr
location /sonarr {
proxy_pass http://127.0.0.1:8989;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# Proxy to Plex
location /plex {
proxy_pass http://127.0.0.1:32400;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# Proxy to uTorrent
location /utorrent {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# Proxy to Overseerr
location /overseerr {
proxy_pass http://127.0.0.1:5055;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
# HTTPS Server (uncomment after SSL setup)
# server {
# listen 443 ssl http2;
# server_name your-domain.com;
#
# ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;
#
# # ... rest of config same as above
# }</code></pre>
<h4 class="font-semibold mt-4 mb-2">Enable site and restart Nginx:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto"><code># Create web directory
sudo mkdir -p /var/www/seedbox-panel
# Copy index.html to web directory
sudo cp index.html /var/www/seedbox-panel/
# Enable site
sudo ln -s /etc/nginx/sites-available/seedbox-panel /etc/nginx/sites-enabled/
# Test and restart
sudo nginx -t
sudo systemctl restart nginx</code></pre>
<h4 class="font-semibold mt-4 mb-2">Setup SSL with Let's Encrypt:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto"><code># Install Certbot
sudo apt install certbot python3-certbot-nginx -y
# Get certificate
sudo certbot --nginx -d your-domain.com
# Auto-renewal (already set up by certbot)
sudo certbot renew --dry-run</code></pre>
</div>
</div>
<!-- Step 4: Docker Compose -->
<div id="deploy-step-4" class="deploy-step hidden">
<div class="card-gradient rounded-2xl p-6 border border-gray-700/50">
<h3 class="text-xl font-semibold mb-4"><i class="fab fa-docker mr-2 text-blue-400"></i>Docker Compose Setup</h3>
<p class="text-gray-300 mb-4">Alternative: Use Docker Compose for easier management of all containers.</p>
<h4 class="font-semibold mb-2">Create docker-compose.yml:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto text-xs" style="max-height: 600px;"><code># /opt/seedbox/docker-compose.yml
version: '3.8'
services:
radarr:
image: linuxserver/radarr:latest
container_name: seedbox-radarr
environment:
- PUID=1000
- PGID=1000
- TZ=UTC
volumes:
- ./radarr/config:/config
- ./downloads:/downloads
- ./movies:/movies
ports:
- 7878:7878
restart: unless-stopped
sonarr:
image: linuxserver/sonarr:latest
container_name: seedbox-sonarr
environment:
- PUID=1000
- PGID=1000
- TZ=UTC
volumes:
- ./sonarr/config:/config
- ./downloads:/downloads
- ./tv:/tv
ports:
- 8989:8989
restart: unless-stopped
plex:
image: linuxserver/plex:latest
container_name: seedbox-plex
network_mode: host
environment:
- PUID=1000
- PGID=1000
- TZ=UTC
- VERSION=docker
volumes:
- ./plex/config:/config
- ./movies:/movies
- ./tv:/tv
restart: unless-stopped
utorrent:
image: ekho/utorrent:latest
container_name: seedbox-utorrent
volumes:
- ./utorrent/config:/utorrent/settings
- ./downloads:/data
ports:
- 8080:8080
- 6881:6881
- 6881:6881/udp
restart: unless-stopped
overseerr:
image: linuxserver/overseerr:latest
container_name: seedbox-overseerr
environment:
- PUID=1000
- PGID=1000
- TZ=UTC
volumes:
- ./overseerr/config:/config
ports:
- 5055:5055
restart: unless-stopped
# Control Panel API
seedbox-api:
build: ./panel
container_name: seedbox-api
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./:/opt/seedbox
ports:
- 5000:5000
restart: unless-stopped
depends_on:
- radarr
- sonarr
- plex
- overseerr
networks:
default:
name: seedbox-network</code></pre>
<h4 class="font-semibold mt-4 mb-2">Create directory structure:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto"><code>mkdir -p /opt/seedbox/{radarr,sonarr,plex,utorrent,overseerr}/config
mkdir -p /opt/seedbox/{downloads,movies,tv}
cd /opt/seedbox
# Set permissions
sudo chown -R 1000:1000 /opt/seedbox</code></pre>
<h4 class="font-semibold mt-4 mb-2">Deploy with Docker Compose:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto"><code># Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop all services
docker-compose down
# Update all services
docker-compose pull && docker-compose up -d</code></pre>
</div>
</div>
<!-- Step 5: Final Steps -->
<div id="deploy-step-5" class="deploy-step hidden">
<div class="card-gradient rounded-2xl p-6 border border-gray-700/50">
<h3 class="text-xl font-semibold mb-4"><i class="fas fa-check-circle mr-2 text-green-400"></i>Final Steps & Security</h3>
<h4 class="font-semibold mb-2">1. Configure Firewall:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto"><code># Setup UFW firewall
sudo ufw allow ssh
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
# Optional: Allow direct access to apps (if not using reverse proxy)
# sudo ufw allow 7878/tcp # Radarr
# sudo ufw allow 8989/tcp # Sonarr
# sudo ufw allow 32400/tcp # Plex
# sudo ufw allow 8080/tcp # uTorrent
# sudo ufw allow 5055/tcp # Overseerr</code></pre>
<h4 class="font-semibold mt-4 mb-2">2. Setup Authentication:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto"><code># Install htpasswd utility
sudo apt install apache2-utils -y
# Create password file
sudo htpasswd -c /etc/nginx/.htpasswd admin
# Add to Nginx location blocks:
# auth_basic "Restricted";
# auth_basic_user_file /etc/nginx/.htpasswd;</code></pre>
<h4 class="font-semibold mt-4 mb-2">3. Access Your Applications:</h4>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
<div class="bg-gray-800/50 rounded-lg p-4">
<p class="font-medium text-blue-400">Control Panel</p>
<code class="text-sm text-gray-300">https://your-domain.com/</code>
</div>
<div class="bg-gray-800/50 rounded-lg p-4">
<p class="font-medium text-orange-400">Radarr</p>
<code class="text-sm text-gray-300">https://your-domain.com:7878</code>
</div>
<div class="bg-gray-800/50 rounded-lg p-4">
<p class="font-medium text-blue-400">Sonarr</p>
<code class="text-sm text-gray-300">https://your-domain.com:8989</code>
</div>
<div class="bg-gray-800/50 rounded-lg p-4">
<p class="font-medium text-yellow-400">Plex</p>
<code class="text-sm text-gray-300">https://your-domain.com:32400/web</code>
</div>
<div class="bg-gray-800/50 rounded-lg p-4">
<p class="font-medium text-green-400">uTorrent</p>
<code class="text-sm text-gray-300">https://your-domain.com:8080</code>
</div>
<div class="bg-gray-800/50 rounded-lg p-4">
<p class="font-medium text-purple-400">Overseerr</p>
<code class="text-sm text-gray-300">https://your-domain.com:5055</code>
</div>
</div>
<h4 class="font-semibold mt-6 mb-2">4. Maintenance Commands:</h4>
<pre class="terminal rounded-lg p-4 overflow-x-auto"><code># Check container status
docker ps -a
# View container logs
docker logs -f seedbox-radarr
# Restart a container
docker restart seedbox-sonarr
# Update a container
docker pull linuxserver/radarr:latest
docker-compose up -d radarr
# Backup configs
tar -czvf seedbox-backup-$(date +%Y%m%d).tar.gz /opt/seedbox/*/config
# Monitor resources
docker stats</code></pre>
<div class="mt-6 p-4 bg-green-900/30 border border-green-700 rounded-lg">
<h4 class="font-semibold text-green-400 mb-2"><i class="fas fa-party-horn mr-2"></i>Deployment Complete!</h4>
<p class="text-gray-300">Your SeedBox control panel is now ready. Access it at your configured domain and start managing your media applications!</p>
</div>
</div>
</div>
</div>
</main>
<!-- Modal -->
<div id="modal" class="fixed inset-0 bg-black/70 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
<div class="bg-gray-800 rounded-2xl max-w-md w-full p-6 border border-gray-700">
<div class="flex justify-between items-center mb-4">
<h3 id="modalTitle" class="text-xl font-semibold">Modal Title</h3>
<button onclick="closeModal()" class="text-gray-400 hover:text-white">
<i class="fas fa-times"></i>
</button>
</div>
<div id="modalContent" class="text-gray-300">
<!-- Dynamic content -->
</div>
</div>
</div>
<!-- Toast Notification -->
<div id="toast" class="fixed bottom-6 right-6 bg-gray-800 border border-gray-700 rounded-xl p-4 shadow-xl transform translate-y-20 opacity-0 transition-all duration-300 z-50">
<div class="flex items-center space-x-3">
<i id="toastIcon" class="fas fa-check-circle text-green-400 text-xl"></i>
<p id="toastMessage" class="text-sm">Operation successful</p>
</div>
</div>
<script>
// Register Service Worker for PWA functionality
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw.js').then(reg => {
console.log('Service Worker registered successfully:', reg);
}).catch(err => {
console.log('Service Worker registration failed:', err);
});
}
// Application data with logos and brand colors
const apps = [
{
id: 'radarr',
name: 'Radarr',
icon: 'fa-film',
port: 7878,
desc: 'Movie collection manager',
logo: 'https://raw.githubusercontent.com/Radarr/Radarr/develop/Logo/256.png',
gradient: 'from-amber-500/90 via-orange-500/80 to-yellow-600/90',
bgColor: '#FFC230'
},
{
id: 'sonarr',
name: 'Sonarr',
icon: 'fa-tv',
port: 8989,
desc: 'TV series collection manager',
logo: 'https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png',
gradient: 'from-sky-400/90 via-cyan-500/80 to-blue-500/90',
bgColor: '#00CCFF'
},
{
id: 'plex',
name: 'Plex',
icon: 'fa-play-circle',
port: 32400,
desc: 'Media streaming server',
logo: 'https://www.plex.tv/wp-content/uploads/2022/04/plex-logo.png',
gradient: 'from-amber-400/90 via-yellow-500/80 to-orange-500/90',
bgColor: '#E5A00D'