-
Notifications
You must be signed in to change notification settings - Fork 0
/
seedbox.sh
executable file
·1917 lines (1704 loc) · 63.5 KB
/
seedbox.sh
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
#!/bin/bash
CSI="\033["
CEND="${CSI}0m"
CRED="${CSI}1;31m"
CGREEN="${CSI}1;32m"
CPURPLE="${CSI}1;35m"
CCYAN="${CSI}1;36m"
###################################################################################################################################################
progress-bar() {
local duration=${1}
printf '\n'
echo -e "${CGREEN}Patientez ... ${CEND}"
printf '\n'
already_done() { for ((done=0; done<$elapsed; done++)); do printf "#"; done }
remaining() { for ((remain=$elapsed; remain<$duration; remain++)); do printf " "; done }
percentage() { printf "| %s%%" $(( (($elapsed)*100)/($duration)*100/100 )); }
clean_line() { printf "\r"; }
for (( elapsed=1; elapsed<=$duration; elapsed++ )); do
already_done; remaining; percentage
sleep 0.2
clean_line
done
clean_line
printf '\n'
}
clear
logo.sh
echo ""
echo -e "${CCYAN}INSTALLATION${CEND}"
echo -e "${CGREEN}${CEND}"
echo -e "${CGREEN} 1) Installation de docker && docker-compose (Ubuntu, Debian) ${CEND}"
echo -e "${CGREEN} 2) Configuration du docker-compose ${CEND}"
echo -e "${CGREEN} 3) Configuration rclone ${CEND}"
echo -e "${CGREEN} 4) Configuration plexdrive V-5.0.0 ${CEND}"
echo -e "${CGREEN} 5) Lancement des applications ${CEND}"
echo -e "${CGREEN} 6) Configuration plex_autoscan && unionfs_cleaner && plex_dupefinder ${CEND}"
echo -e "${CGREEN} 7) Sauvegarde des volumes ${CEND}"
echo -e "${CGREEN} 8) Quitter ${CEND}"
echo -e ""
until [[ "$PORT_CHOICE" =~ ^[1-8]$ ]]; do
read -p "Votre choix [1-8]: " -e -i 1 PORT_CHOICE
done
case $PORT_CHOICE in
1) ## Installation de docker et docker-compose
logo.sh
echo -e "${CGREEN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CCYAN} INSTALLATION DOCKER ET DOCKER-COMPOSE ${CEND}"
echo -e "${CGREEN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo ""
# Installation possible sur debian ou ubuntu
OS=$(cat /etc/*release | grep ^NAME | tr -d 'NAME="')
if [ "$OS" = "Ubuntu" ]
then
apt-get install \
apache2
unzip
apt install docker.io
curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
clear
logo.sh
echo -e "${CCYAN}Installation docker & docker compose terminée${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour revenir au menu principal"
touch /etc/apache2/.htpasswd
seedbox.sh
else
apt-get install \
apache2-utils \
unzip \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
lsb-release \
software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | sh
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
apt update
apt install docker-ce
curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
clear
logo.sh
echo -e "${CCYAN}Installation docker & docker compose terminée${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour revenir au menu principal"
seedbox.sh
fi
;;
2) ## Mise en place des variables necéssaire au docker-compose
clear
logo.sh
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CCYAN} PRECISONS SUR LES VARIABLES ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN} Cette étape permet une installation personnalisée configurable à vos besoins ${CEND}"
echo -e "${CGREEN} Une fois les variables définies, la configuration sera complètement automatisée ${CEND}"
echo -e "${CRED}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CCYAN} ${CEND}"
echo -e "${CCYAN} UNE ATTENTION PARTICULIERE EST REQUISE POUR CETTE ETAPE ${CEND}"
echo -e "${CCYAN} ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN}${CEND}"
## définition des variables
echo -e "${CCYAN}Nom de domaine ${CEND}"
read -rp "DOMAIN = " DOMAIN
if [ -n "$DOMAIN" ]
then
export DOMAIN
fi
echo ""
echo -e "${CCYAN}Nom d'utilisateur ${CEND}"
read -rp "USERNAME = " USERNAME
if [ -n "$USERNAME" ]
then
export USERNAME
fi
echo ""
echo -e "${CCYAN}Adresse mail ${CEND}"
read -rp "MAIL = " MAIL
if [ -n "$MAIL" ]
then
export MAIL
fi
echo ""
echo -e "${CCYAN}Remote crypté, doit pointer vers /home/plexdrive dans votre fichier rclone.conf (Modifier le fichier rclone.conf en conséquence) ${CEND}"
echo -e "${CRED}TRES IMPORTANT${CGREEN} mettez le "/" à la fin du remote ${CEND}"
read -rp "RemotePath = " RemotePath
if [ -n "$RemotePath" ]
then
export RemotePath
fi
echo ""
echo -e "${CCYAN}Remote crypté dans rclone.conf, celui qui est solicité pour les transferts ${CEND}"
echo -e "${CRED}TRES IMPORTANT${CGREEN} mettez le "/" à la fin du remote ${CEND}"
read -rp "RemoteLocal = " RemoteLocal
if [ -n "$RemoteLocal" ]
then
export RemoteLocal
fi
clear
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CGREEN} LES VARIABLES CI DESSOUS SONT DEFINIES PAR DEFAULT DANS LES CONTAINERS ${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CRED} ${CPURPLE}MountPoint:${CRED} Montage crypté plexdrive monté en clair dans: ${CCYAN}/mnt/rclone ${CEND}"
echo -e "${CRED} ${CPURPLE}MountUnion:${CRED} Montage Unionfs-fuse monté dans: ${CCYAN}/mnt/Union ${CEND}"
echo -e "${CRED} ${CPURPLE}MountLocal:${CRED} Montage local par défault monté dans: ${CCYAN}/mnt/Pre ${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CGREEN} LA VARIABLE CI DESSOUS EST DEFINIE PAR DEFAULT SUR L HOTE ${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CCYAN} ${CPURPLE}VOLUMES_ROOT_PATH:${CRED} Emplacement des volumes sur l'hote: ${CCYAN}/mnt/docker ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CGREEN} VOUS POUVEZ MODIFIER TOUTES CES VARIABLES A VOTRE CONVENANCE ${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CRED}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN}${CEND}"
# Variables par défault, peuvent être modifiée
export MountPoint=/mnt/rclone
export MountUnion=/mnt/Union
export MountLocal=/mnt/Pre
export VOLUMES_ROOT_PATH=/mnt/docker
export PLEXDRIVE_MOUNT_POINT=/home/plexdrive
read -rp "Voulez-vous modifier les variables ci dessus ? (o/n) : " EXCLUDE
if [[ "$EXCLUDE" = "o" ]] || [[ "$EXCLUDE" = "O" ]]; then
echo -e "${CCYAN}Par défault le montage crypté plexdrive est monté en clair dans le dossier /mnt/rclone ${CEND}"
read -rp "MountPoint = " MountPoint
if [ -n "$MountPoint" ]
then
export MountPoint
else
MountPoint=/mnt/rclone
export MountPoint
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Par défault le montage unionfs est: /mnt/Union ${CEND}"
read -rp "MountUnion = " MountUnion
if [ -n "$MountUnion" ]
then
export MountUnion
else
MountUnion=/mnt/Union
export MountUnion
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Par défault le montage du dossier local est : /mnt/Pre ${CEND}"
read -rp "MountLocal = " MountLocal
if [ -n "$MountLocal" ]
then
export MountLocal
else
MountLocal=/mnt/Pre
export MountLocal
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Par défault le montage des volumes est dans : /mnt/docker ${CEND}"
read -rp "VOLUMES_ROOT_PATH = " VOLUMES_ROOT_PATH
if [ -n "$VOLUMES_ROOT_PATH" ]
then
export VOLUMES_ROOT_PATH
else
VOLUMES_ROOT_PATH=/mnt/docker
export VOLUMES_ROOT_PATH
fi
fi
clear
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CGREEN} ORGANISATION DES DOSSIERS EN LOCAL ${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CGREEN} Pour que Unionfs fonctionne, il faut que l'arborescence montée en local corresponde ${CEND}"
echo -e "${CGREEN} exactement à celle montée par rclone (plexdrive crypté monté en clair par rclone). ${CEND}"
echo -e "${CRED} Il est donc nécessaire de créer les mêmes dossiers que ceux existant sur Gdrive. ${CEND}"
echo -e "${CCYAN} exemple: Films ou Media/Films (sans "/" devant Media) et sans ACCENTS ${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
## Création des dossiers locaux pour unionfs
mkdir -p ${VOLUMES_ROOT_PATH}
touch ${VOLUMES_ROOT_PATH}/local.txt
read -rp "Taper ok pour démarrer: " EXCLUDE
cat <<- EOF > ${VOLUMES_ROOT_PATH}/local.txt
EOF
if [[ "$EXCLUDE" = "ok" ]] || [[ "$EXCLUDE" = "OK" ]]; then
echo -e "${CCYAN}\nTapez le nom des dossiers, à la fin de chaque saisie appuyer sur la touche Entrée et taper ${CPURPLE}STOP${CEND}${CCYAN} si vous avez terminé.\n${CEND}"
while :
do
read -p "" EXCLUDEPATH
if [[ "$EXCLUDEPATH" = "STOP" ]] || [[ "$EXCLUDEPATH" = "stop" ]]; then
break
fi
echo "$EXCLUDEPATH" >> ${VOLUMES_ROOT_PATH}/local.txt
done
fi
while IFS=: read user
do
mkdir -p ${VOLUMES_ROOT_PATH}/plexdrive/Pre/$user
done < ${VOLUMES_ROOT_PATH}/local.txt
FILMS=$(grep -E 'films|film|Films|FILMS|MOVIES|Movies|movies|movie|VIDEOS|VIDEO|Video|Videos' ${VOLUMES_ROOT_PATH}/local.txt | cut -d: -f2 | cut -d ' ' -f2)
SERIES=$(grep -E 'series|TV|tv|Series|SERIES|SERIES TV|Series TV|series tv|serie tv|serie TV|series TV|Shows' ${VOLUMES_ROOT_PATH}/local.txt | cut -d: -f2 | cut -d ' ' -f2-3)
ANIMES=$(grep -E 'ANIMES|ANIME|Animes|Anime|Animation|ANIMATION|animes|anime' ${VOLUMES_ROOT_PATH}/local.txt | cut -d: -f2 | cut -d ' ' -f2)
MUSIC=$(grep -E 'MUSIC|Music|music|Musiques|Musique|MUSIQUE|MUSIQUES|musiques|musique' ${VOLUMES_ROOT_PATH}/local.txt | cut -d: -f2 | cut -d ' ' -f2)
export FILMS
export SERIES
export ANIMES
export MUSIC
rm ${VOLUMES_ROOT_PATH}/local.txt
clear
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CCYAN} LES VARIABLES CI DESSOUS DONT DEFINIES PAR DEFAULT ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CRED} ${CCYAN}TRAEFIK_DASHBOARD_URL:${CRED} traefik.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}PLEX_FQDN:${CRED} plex.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}EMBY_FQDN:${CRED} emby.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}MEDUSA_FQDN:${CRED} medusa.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}RTORRENT_FQDN:${CRED} rtorrent.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}RADARR_FQDN:${CRED} radarr.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}SONARR_FQDN:${CRED} sonarr.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}JACKETT_FQDN:${CRED} jackett.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}WATCHER_FQDN:${CRED} watcher.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}OMBI_FQDN:${CRED} ombi.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}TAUTULLI_FQDN:${CRED} tautulli.${DOMAIN} ${CEND}"
echo -e "${CRED}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN} VOUS POUVEZ MODIFIER TOUTES CES VARIABLES A VOTRE CONVENANCE ${CEND}"
echo -e "${CGREEN} TAPER ENSUITE SUR LA TOUCHE ENTREE POUR VALIDER ${CEND}"
echo -e "${CRED}-------------------------------------------------------------------------------------------------------------------------${CEND}"
export PROXY_NETWORK=traefik_proxy
export TRAEFIK_DASHBOARD_URL=traefik.${DOMAIN}
export PLEX_FQDN=plex.${DOMAIN}
export EMBY_FQDN=emby.${DOMAIN}
export MEDUSA_FQDN=medusa.${DOMAIN}
export RTORRENT_FQDN=rtorrent.${DOMAIN}
export RADARR_FQDN=radarr.${DOMAIN}
export SONARR_FQDN=sonarr.${DOMAIN}
export JACKETT_FQDN=jackett.${DOMAIN}
export WATCHER_FQDN=watcher.${DOMAIN}
export OMBI_FQDN=ombi.${DOMAIN}
export TAUTULLI_FQDN=tautulli.${DOMAIN}
read -rp "Voulez-vous modifier les variables ci dessus ? (o/n) : " EXCLUDE
if [[ "$EXCLUDE" = "o" ]] || [[ "$EXCLUDE" = "O" ]]; then
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CCYAN} JUSTE SAISIR LE SOUS DOMAINE ET NON LE DOMAINE ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CCYAN}Sous domaine de Traefik${CEND}"
read -rp "TRAEFIK_DASHBOARD_URL = " TRAEFIK_DASHBOARD_URL
if [ -n "$TRAEFIK_DASHBOARD_URL" ]
then
export TRAEFIK_DASHBOARD_URL=${TRAEFIK_DASHBOARD_URL}.${DOMAIN}
else
TRAEFIK_DASHBOARD_URL=traefik.${DOMAIN}
export TRAEFIK_DASHBOARD_URL
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de Plex${CEND}"
read -rp "PLEX_FQDN = " PLEX_FQDN
if [ -n "$PLEX_FQDN" ]
then
export PLEX_FQDN=${PLEX_FQDN}.${DOMAIN}
else
PLEX_FQDN=plex.${DOMAIN}
export PLEX_FQDN
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de Emby${CEND}"
read -rp "EMBY_FQDN = " EMBY_FQDN
if [ -n "$EMBY_FQDN" ]
then
export EMBY_FQDN=${EMBY_FQDN}.${DOMAIN}
else
EMBY_FQDN=emby.${DOMAIN}
export EMBY_FQDN
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de Medusa${CEND}"
read -rp "MEDUSA_FQDN = " MEDUSA_FQDN
if [ -n "$MEDUSA_FQDN" ]
then
export MEDUSA_FQDN=${MEDUSA_FQDN}.${DOMAIN}
else
MEDUSA_FQDN=medusa.${DOMAIN}
export MEDUSA_FQDN
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de Rtorrent${CEND}"
read -rp "RTORRENT_FQDN = " RTORRENT_FQDN
if [ -n "$RTORRENT_FQDN" ]
then
export RTORRENT_FQDN=${RTORRENT_FQDN}.${DOMAIN}
else
RTORRENT_FQDN=rtorrent.${DOMAIN}
export RTORRENT_FQDN
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de Radarr${CEND}"
read -rp "RADARR_FQDN = " RADARR_FQDN
if [ -n "$RADARR_FQDN" ]
then
export RADARR_FQDN=${RADARR_FQDN}..${DOMAIN}
else
RADARR_FQDN=radarr.${DOMAIN}
export RADARR_FQDN
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de Sonarr${CEND}"
read -rp "SONARR_FQDN = " SONARR_FQDN
if [ -n "$SONARR_FQDN" ]
then
export SONARR_FQDN=${SONARR_FQDN}.${DOMAIN}
else
SONARR_FQDN=sonarr.${DOMAIN}
export SONARR_FQDN
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de Jackett${CEND}"
read -rp "JACKETT_FQDN = " JACKETT_FQDN
if [ -n "$JACKETT_FQDN" ]
then
export JACKETT_FQDN=${JACKETT_FQDN}.${DOMAIN}
else
JACKETT_FQDN=jackett.${DOMAIN}
export JACKETT_FQDN
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de Watcher3${CEND}"
read -rp "WATCHER_FQDN = " WATCHER_FQDN
if [ -n "$WATCHER_FQDN" ]
then
export WATCHER_FQDN=${WATCHER_FQDN}.${DOMAIN}
else
WATCHER_FQDN=watcher.${DOMAIN}
export WATCHER_FQDN
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de Ombi${CEND}"
read -rp "OMBI_FQDN = " OMBI_FQDN
if [ -n "$OMBI_FQDN" ]
then
export OMBI_FQDN=${OMBI_FQDN}.${DOMAIN}
else
OMBI_FQDN=ombi.${DOMAIN}
export OMBI_FQDN
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de Tautulli${CEND}"
read -rp "TAUTULLI_FQDN = " TAUTULLI_FQDN
if [ -n "$TAUTULLI_FQDN" ]
then
export TAUTULLI_FQDN=${TAUTULLI_FQDN}.${DOMAIN}
else
TAUTULLI_FQDN=tautulli.${DOMAIN}
export TAUTULLI_FQDN
fi
fi
## création d'une authentification pour rtorrent
VAR=$(htpasswd -c /etc/apache2/.htpasswd $USERNAME 2>/dev/null)
VAR=$(sed -e 's/\$/\$$/g' /etc/apache2/.htpasswd 2>/dev/null)
export VAR
## Création d'un fichier .env
docker network create traefik_proxy 2>/dev/null
docker network create torrent 2>/dev/null
cat <<- EOF > /mnt/.env
FILMS=$FILMS
SERIES=$SERIES
ANIMES=$ANIMES
MUSIC=$MUSIC
VOLUMES_ROOT_PATH=$VOLUMES_ROOT_PATH
VAR=$VAR
MAIL=$MAIL
USERNAME=$USERNAME
DOMAIN=$DOMAIN
PLEXDRIVE_MOUNT_POINT=$PLEXDRIVE_MOUNT_POINT
MountPoint=$MountPoint
MountUnion=$MountUnion
MountLocal=$MountLocal
RemotePath=$RemotePath
RemoteLocal=$RemoteLocal
PROXY_NETWORK=$PROXY_NETWORK
TRAEFIK_DASHBOARD_URL=$TRAEFIK_DASHBOARD_URL
PLEX_FQDN=$PLEX_FQDN
EMBY_FQDN=$EMBY_FQDN
MEDUSA_FQDN=$MEDUSA_FQDN
RTORRENT_FQDN=$RTORRENT_FQDN
RADARR_FQDN=$RADARR_FQDN
SONARR_FQDN=$SONARR_FQDN
JACKETT_FQDN=$JACKETT_FQDN
WATCHER_FQDN=$WATCHER_FQDN
OMBI_FQDN=$OMBI_FQDN
TAUTULLI_FQDN=$TAUTULLI_FQDN
EOF
## Création d'un fichier traefik.toml
mkdir -p ${VOLUMES_ROOT_PATH}/traefik
cat <<- EOF > ${VOLUMES_ROOT_PATH}/traefik/traefik.toml
defaultEntryPoints = ["https","http"]
[api]
entryPoint = "traefik"
dashboard = true
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
minVersion = "VersionTLS12"
cipherSuites = [
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA"
]
[entryPoints.traefik]
address = ":8080"
[acme]
email = "${MAIL}"
storage = "/etc/traefik/acme/acme.json"
entryPoint = "https"
onHostRule = true
onDemand = false
[acme.httpChallenge]
entryPoint = "http"
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "${DOMAIN}"
watch = true
exposedbydefault = false
EOF
## creation du docker-compose personnalisé dans lequel viendront s'incrémenter les variables du fichier .envt
cat <<- EOF > /mnt/docker-compose.yml
version: '3'
services:
traefik:
image: traefik
container_name: traefik
restart: unless-stopped
hostname: traefik
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${TRAEFIK_DASHBOARD_URL}
- traefik.port=8080
- traefik.docker.network=${PROXY_NETWORK}
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ${VOLUMES_ROOT_PATH}/traefik/traefik.toml:/traefik.toml:ro
- ${VOLUMES_ROOT_PATH}/letsencrypt/certs:/etc/traefik/acme:rw
ports:
- "80:80"
- "443:443"
networks:
- proxy
plexdrive:
container_name: plexdrive
image: laster13/plexdrive-rclone
restart: unless-stopped
cap_add:
- SYS_ADMIN
- MKNOD
privileged: true
devices:
- /dev/fuse
security_opt:
- apparmor:unconfined
environment:
- RemotePath=${RemotePath}
- RemoteLocal=${RemoteLocal}
- MountUnion=${MountUnion}
- MountLocal=${MountLocal}
- MountPoint=${MountPoint}
volumes:
- ${VOLUMES_ROOT_PATH}/plexdrive/config/.config/rclone:/root/.config/rclone
- ${VOLUMES_ROOT_PATH}/plexdrive/config:/config
- ${VOLUMES_ROOT_PATH}/plexdrive/Union:${MountUnion}:shared
- ${VOLUMES_ROOT_PATH}/plexdrive/Pre:${MountLocal}:shared
- ${VOLUMES_ROOT_PATH}/plexdrive/rclone:${MountPoint}:shared
- ${VOLUMES_ROOT_PATH}/plexdrive/crypte:${PLEXDRIVE_MOUNT_POINT}:shared
networks:
- proxy
plex:
container_name: plex
image: laster13/plex
restart: unless-stopped
hostname: plex
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${PLEX_FQDN}
- traefik.port=32400
- traefik.docker.network=${PROXY_NETWORK}
healthcheck:
disable: true
environment:
- MountUnion=${MountUnion}
- MountLocal=${MountLocal}
- MountPoint=${MountPoint}
- TZ=Europe/Paris
- PLEX_CLAIM=
- PLEX_UID=0
- PLEX_GID=0
ports:
- 32400:32400
volumes:
- ${VOLUMES_ROOT_PATH}/plexdrive/Union:${MountUnion}:shared
- ${VOLUMES_ROOT_PATH}/plex/config:/config
- /dev/shm:/transcode
networks:
- proxy
emby:
container_name: emby
image: emby/embyserver
restart: unless-stopped
hostname: emby
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${EMBY_FQDN}
- traefik.port=8096
- traefik.docker.network=${PROXY_NETWORK}
volumes:
- ${VOLUMES_ROOT_PATH}/plexdrive/Union:${MountUnion}:shared
- ${VOLUMES_ROOT_PATH}/plex/Pre:${MountLocal}:shared
- ${VOLUMES_ROOT_PATH}/emby/config:/config:rw
- /etc/localtime:/etc/localtime:ro
environment:
- MountUnion=${MountUnion}
- MountLocal=${MountLocal}
- MountPoint=${MountPoint}
- TZ=Paris/Europe
- PUID=0
- PGID=0
networks:
- proxy
sonarr:
container_name: sonarr
image: linuxserver/sonarr
restart: unless-stopped
hostname: sonarr
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${SONARR_FQDN}
- traefik.port=8989
- traefik.docker.network=${PROXY_NETWORK}
environment:
- /etc/localtime:/etc/localtime:ro
- TZ=Paris/Europe
- PUID=0
- PGID=0
volumes:
- ${VOLUMES_ROOT_PATH}/sonarr/config:/config
- ${VOLUMES_ROOT_PATH}/rutorrent/downloads:/downloads
- ${VOLUMES_ROOT_PATH}/plexdrive/Union:/tv
networks:
- proxy
radarr:
container_name: radarr
image: linuxserver/radarr
restart: unless-stopped
hostname: radarr
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${RADARR_FQDN}
- traefik.port=7878
- traefik.docker.network=${PROXY_NETWORK}
environment:
- /etc/localtime:/etc/localtime:ro
- TZ=Paris/Europe
- PUID=0
- PGID=0
volumes:
- ${VOLUMES_ROOT_PATH}/radarr/config:/config
- ${VOLUMES_ROOT_PATH}/rutorrent/downloads:/downloads
- ${VOLUMES_ROOT_PATH}/plexdrive/Union/${FILMS}:/movies
networks:
- proxy
watcher:
image: linuxserver/watcher
container_name: watcher
restart: unless-stopped
hostname: watcher
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${WATCHER_FQDN}
- traefik.port=9090
- traefik.docker.network=${PROXY_NETWORK}
volumes:
- ${VOLUMES_ROOT_PATH}/plexdrive/Union/${FILMS}:/movies
- ${VOLUMES_ROOT_PATH}/rutorrent/downloads:/downloads
- ${VOLUMES_ROOT_PATH}/watcher/config:/config
environment:
- /etc/localtime:/etc/localtime:ro
- TZ=Paris/Europe
- PUID=0
- PGID=0
networks:
- proxy
medusa:
image: linuxserver/medusa
container_name: medusa
restart: unless-stopped
hostname: medusa
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${MEDUSA_FQDN}
- traefik.port=8081
- traefik.docker.network=${PROXY_NETWORK}
volumes:
- ${VOLUMES_ROOT_PATH}/plexdrive/Union/${SERIES}:/tv
- ${VOLUMES_ROOT_PATH}/rutorrent/downloads:/downloads
- ${VOLUMES_ROOT_PATH}/medusa/config:/config
environment:
- /etc/localtime:/etc/localtime:ro
- TZ=Paris/Europe
- PUID=0
- PGID=0
networks:
- proxy
torrent:
container_name: torrent
image: xataz/rtorrent-rutorrent:filebot
restart: unless-stopped
hostname: torrent
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${RTORRENT_FQDN}
- traefik.port=8080
- traefik.docker.network=${PROXY_NETWORK}
- traefik.frontend.auth.basic=${VAR}
environment:
- FILEBOT_RENAME_METHOD=copy
- FILEBOT_RENAME_MOVIES={n} ({y})/{n} ({y})
- UID=1001
- GID=1001
- DHT_RTORRENT=on
- PORT_RTORRENT=6881
volumes:
- ${VOLUMES_ROOT_PATH}/plexdrive/Pre:${MountLocal}
- ${VOLUMES_ROOT_PATH}/rutorrent/downloads:/data/torrents
- ${VOLUMES_ROOT_PATH}/rutorrent/filebot:/scripts
- ${VOLUMES_ROOT_PATH}/rutorrent/data:/data
- ${VOLUMES_ROOT_PATH}/rutorrent/config:/config
networks:
- torrent
- proxy
jackett:
container_name: jackett
image: xataz/jackett
restart: unless-stopped
hostname: jackett
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${JACKETT_FQDN}
- traefik.port=9117
- traefik.docker.network=${PROXY_NETWORK}
environment:
- TZ=Paris/Europe
- PUID=0
- PGID=0
volumes:
- ${VOLUMES_ROOT_PATH}/Jackett/config:/config
- ${VOLUMES_ROOT_PATH}/Jackett/downloads:/downloads
networks:
- proxy
ombi:
container_name: ombi
image: linuxserver/ombi:latest
restart: unless-stopped
hostname: ombi
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${OMBI_FQDN}
- traefik.port=3579
- traefik.docker.network=${PROXY_NETWORK}
environment:
- TZ=Paris/Europe
- PUID=0
- PGID=0
volumes:
- ${VOLUMES_ROOT_PATH}/ombi/config:/config
networks:
- proxy
tautulli:
container_name: tautulli
image: tautulli/tautulli
restart: unless-stopped
hostname: tautulli
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${TAUTULLI_FQDN}
- traefik.port=8181
- traefik.docker.network=${PROXY_NETWORK}
environment:
- TZ=Paris/Europe
- PUID=0
- PGID=0
volumes:
- ${VOLUMES_ROOT_PATH}/tautulli/config:/config
- ${VOLUMES_ROOT_PATH}/plex/config/Library/Application Support/Plex Media Server/Logs:/logs:ro
networks:
- proxy
networks:
torrent:
proxy:
external:
name: ${PROXY_NETWORK}
EOF
clear
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CCYAN} VERIFICATION DE LA CONFORMITE DU DOCKER-COMPOSE ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
read -p "Appuyer sur la touche Entrer pour continuer"
nano /mnt/docker-compose.yml
progress-bar 20
cd /mnt
docker-compose up -d plexdrive traefik 2>/dev/null
echo ""
echo -e "${CCYAN}La configuration des variables s'est parfaitement déroulée ${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour continuer"
seedbox.sh
;;
3)
clear
export $(xargs </mnt/.env)
logo.sh
echo -e "${CGREEN}----------------------------${CEND}"
echo -e "${CCYAN} CONFIGURATION DE RCLONE ${CEND}"
echo -e "${CGREEN}----------------------------${CEND}"
echo ""
echo -e "${CGREEN} 1) Tentative de récupération ${CCYAN}"rclone.conf"${CGREEN} à partir du serveur ${CEND}"
echo -e "${CGREEN} 2) Edition d'un fichier rclone.conf ${CEND}"
echo -e "${CGREEN} 3) Configuration rclone.conf à partir de l'utilitaire ${CRED}rclone config${CGREEN}${CEND}"
echo -e "${CGREEN} 4) Retour au menu principal ${CEND}"
until [[ "$RCLONE" =~ ^[1-4]$ ]]; do
echo ""
read -p "rclone choix [1-4]: " -e -i 1 RCLONE
done
case $RCLONE in
1) ## recherche fichier rclone.conf déjà présent sur le serveur
var=$(ls -a ${VOLUMES_ROOT_PATH}/plexdrive/config/.config/rclone/ 2>/dev/null | sed -e "/\.$/d" | wc -l )
progress-bar 20
echo ""
RESULTAT=$(find /root/.config/rclone -name rclone.conf 2>/dev/null)
if [ -z "$RESULTAT" ]
then
echo -e "${CCYAN}Pas de fichier rclone.conf trouvé${CEND}"
progress-bar 20
echo ""
elif [ "$var" -eq 0 ]
then
DEST=${VOLUMES_ROOT_PATH}/plexdrive/config/.config/rclone/
cp $RESULTAT ${VOLUMES_ROOT_PATH}/plexdrive/config/.config/rclone 2>/dev/null
echo -e "${CRED}------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CCYAN} Les fichiers de configuration ont bien été transférés vers le dossier $DEST ${CEND}"
echo -e "${CRED}------------------------------------------------------------------------------------------------------------------------${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour retourner au menu principal"
else
echo ""
echo -e "${CCYAN}Le fichier rclone.conf est déjà présent dans ${VOLUMES_ROOT_PATH}/plexdrive/.config/rclone .. Veuillez vérifier${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour continuer"
fi
seedbox.sh
;;
2) ## éditer un fichier rclone.conf
var=$(ls -a ${VOLUMES_ROOT_PATH}/plexdrive/config/.config/rclone/ 2>/dev/null | sed -e "/\.$/d" | wc -l)
if [ "$var" -ne 0 ]
then
progress-bar 20
echo ""
echo -e "${CCYAN}Le fichier rclone.conf est déjà présent dans ${VOLUMES_ROOT_PATH}/plexdrive/config/.config/rclone .. Veuillez vérifier${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour revenir au menu principal"
seedbox.sh
fi
echo ""
read -rp "Voulez-vous créer un fichier de configuration rclone.conf ? (o/n) : " EXCLUDE
cat <<- EOF >> ${VOLUMES_ROOT_PATH}/plexdrive/config/.config/rclone/rclone.conf
EOF
if [[ "$EXCLUDE" = "o" ]] || [[ "$EXCLUDE" = "O" ]]; then
echo -e "${CCYAN}\nColler votre configuration avec le clic droit, à la fin de la saisie appuyer sur la touche Entrée et Taper ${CPURPLE}STOP${CEND}${CCYAN} pour poursuivre le script.\n${CEND}"
while :
do
read -p "" EXCLUDEPATH
if [[ "$EXCLUDEPATH" = "STOP" ]] || [[ "$EXCLUDEPATH" = "stop" ]]; then
break
fi
echo "$EXCLUDEPATH" >> ${VOLUMES_ROOT_PATH}/plexdrive/config/.config/rclone/rclone.conf
done
else
seedbox.sh
fi
echo ""
progress-bar 20
echo ""
echo -e "${CCYAN}Le fichier rclone.conf a été créé avec succés${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour revenir au menu principal"
seedbox.sh
;;
3) ## création d'un nouveau rclone.conf
var=$(ls -a ${VOLUMES_ROOT_PATH}/plexdrive/config/.config/rclone/ 2>/dev/null | sed -e "/\.$/d" | wc -l)
if [ "$var" -ne 0 ]
then
progress-bar 20
echo ""
echo -e "${CCYAN}Le fichier rclone.conf est déjà présent ${VOLUMES_ROOT_PATH}/plexdrive/config/.config/rclone .. Veuillez vérifier${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour revenir au menu principal"
seedbox.sh
else
docker exec -ti plexdrive rclone config
echo -e "${CCYAN}Le fichier rclone.conf a été créé avec succés${CEND}"
read -p "Appuyer sur la touche Entrer pour revenir au menu principal"
seedbox.sh
fi
;;
4)
seedbox.sh
;;
esac
;;
4)
clear
logo.sh
export $(xargs </mnt/.env)
echo ""
echo -e "${CRED}-----------------------------------${CEND}"
echo -e "${CCYAN} CONFIGURATION Plexdrive V-5.0.0 ${CEND}"
echo -e "${CRED}-----------------------------------${CEND}"
echo ""
echo -e "${CGREEN} 1) Création de la configuration plexdrive avec ${CRED}rclone config${CGREEN}${CEND}"
echo -e "${CGREEN} 2) Retour menu principal ${CEND}"
until [[ "$PLEXDRIVE" =~ ^[1-2]$ ]]; do
echo ""
read -p "plexdrive choix [1-2]: " -e -i 1 PLEXDRIVE
done
case $PLEXDRIVE in
1) ## création des fichiers plexdrive
RESULT1=$(ls -a ${VOLUMES_ROOT_PATH}/plexdrive/config/.config/.plexdrive/ 2>/dev/null | sed -e "/\.$/d" | wc -l)