-
Notifications
You must be signed in to change notification settings - Fork 3
/
seedbox.sh
1650 lines (1464 loc) · 53.9 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) Applications ${CEND}"
echo -e "${CGREEN} 4) Sécuriser la Seedbox ${CEND}"
echo -e "${CGREEN} 5) Sauvegarde && Restauration${CEND}"
echo -e "${CGREEN} 6) Quitter ${CEND}"
echo -e ""
until [[ "$PORT_CHOICE" =~ ^[1-6]$ ]]; do
read -p "Votre choix [1-6]: " -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 update && apt upgrade -y
apt install apache2-utils curl unzip -y
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | sh
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
mkdir -p /etc/apache2
touch /etc/apache2/.htpasswd
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
else
apt update && apt upgrade -y
apt install -y \
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 -y
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 pour l'authentification WEB ${CEND}"
read -rp "USERNAME = " USERNAME
if [ -n "$USERNAME" ]
then
export USERNAME
mkdir -p /etc/apache2
VAR=$(htpasswd -c /etc/apache2/.htpasswd $USERNAME 2>/dev/null)
VAR=$(sed -e 's/\$/\$$/g' /etc/apache2/.htpasswd 2>/dev/null)
export VAR
fi
echo ""
echo -e "${CCYAN}Adresse mail ${CEND}"
read -rp "MAIL = " MAIL
if [ -n "$MAIL" ]
then
export MAIL
fi
echo ""
read -rp "Souhaitez vous utiliser Nextcloud ? (o/n) : " EXCLUDE
if [[ "$EXCLUDE" = "o" ]] || [[ "$EXCLUDE" = "O" ]]; then
echo -e "${CGREEN}${CEND}"
read -rp "Choisir un mot de passe pour la base de donnée MARIADB = " PASS
if [ -n "$PASS" ]
then
export PASS
echo -e "${CGREEN}Vous devrez lancer nextcloud à partir des applications choix 3${CEND}"
fi
fi
clear
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}/home/predator999 ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CGREEN} TU PEUX MODIFIER CETTE VARIABLE A TA CONVENANCE ${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CRED}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN}${CEND}"
# Variables par défault, peuvent être modifiée
export VOLUMES_ROOT_PATH=/home/predator999
read -rp "Voulez modifier la variable ci dessus ? (o/n) : " EXCLUDE
if [[ "$EXCLUDE" = "o" ]] || [[ "$EXCLUDE" = "O" ]]; then
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Par défault le montage des volumes est dans : /home/predator999 ${CEND}"
read -rp "VOLUMES_ROOT_PATH = " VOLUMES_ROOT_PATH
if [ -n "$VOLUMES_ROOT_PATH" ]
then
export VOLUMES_ROOT_PATH
else
VOLUMES_ROOT_PATH=/home/predator999
export VOLUMES_ROOT_PATH
fi
fi
clear
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CGREEN} ORGANISATION DES DOSSIERS DE MEDIAS ${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CCYAN}-------------------------------------------------------------------------------------------------------------------------${CEND}"
echo -e "${CGREEN} ${CEND}"
echo -e "${CCYAN} exemple: Movies, Shows, Musics, Animes ${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 dans lesquels seront stockés les Medias, à 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}/Medias/$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}PYLOAD_FQDN:${CRED} pyload.${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}SYNCTHING_FQDN:${CRED} syncthing.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}JACKETT_FQDN:${CRED} jackett.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}LIDARR_FQDN:${CRED} lidarr.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}PORTAINER_FQDN:${CRED} portainer.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}TAUTULLI_FQDN:${CRED} tautulli.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}NEXTCLOUD_FQDN:${CRED} nextcloud.${DOMAIN} ${CEND}"
echo -e "${CRED} ${CCYAN}HEIMDALL_FQDN:${CRED} heimdall.${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 PYLOAD_FQDN=pyload.${DOMAIN}
export MEDUSA_FQDN=medusa.${DOMAIN}
export RTORRENT_FQDN=rtorrent.${DOMAIN}
export RADARR_FQDN=radarr.${DOMAIN}
export SYNCTHING_FQDN=syncthing.${DOMAIN}
export JACKETT_FQDN=jackett.${DOMAIN}
export LIDARR_FQDN=lidarr.${DOMAIN}
export PORTAINER_FQDN=portainer.${DOMAIN}
export TAUTULLI_FQDN=tautulli.${DOMAIN}
export NEXTCLOUD_FQDN=nextcloud.${DOMAIN}
export HEIMDALL_FQDN=heimdall.${DOMAIN}
read -rp "Voulez-vous modifier les variables ci dessus ? (o/n) : " EXCLUDE
echo""
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 pyload${CEND}"
read -rp "PYLOAD_FQDN = " PYLOAD_FQDN
if [ -n "$PYLOAD_FQDN" ]
then
export PYLOAD_FQDN=${PYLOAD_FQDN}.${DOMAIN}
else
PYLOAD_FQDN=pyload.${DOMAIN}
export PYLOAD_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 syncthing${CEND}"
read -rp "SYNCTHING_FQDN = " SYNCTHING_FQDN
if [ -n "$SYNCTHING_FQDN" ]
then
export SYNCTHING_FQDN=${SYNCTHING_FQDN}.${DOMAIN}
else
SYNCTHING_FQDN=syncthing.${DOMAIN}
export SYNCTHING_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 lidarr${CEND}"
read -rp "LIDARR_FQDN = " LIDARR_FQDN
if [ -n "$LIDARR_FQDN" ]
then
export LIDARR_FQDN=${LIDARR_FQDN}.${DOMAIN}
else
LIDARR_FQDN=lidarr.${DOMAIN}
export LIDARR_FQDN
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de portainer${CEND}"
read -rp "PORTAINER_FQDN = " PORTAINER_FQDN
if [ -n "$PORTAINER_FQDN" ]
then
export PORTAINER_FQDN=${PORTAINER_FQDN}.${DOMAIN}
else
PORTAINER_FQDN=portainer.${DOMAIN}
export PORTAINER_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
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de nextcloud${CEND}"
read -rp "NEXTCLOUD_FQDN = " NEXTCLOUD_FQDN
if [ -n "$NEXTCLOUD_FQDN" ]
then
export NEXTCLOUD_FQDN=${NEXTCLOUD_FQDN}.${DOMAIN}
else
NEXTCLOUD_FQDN=nextcloud.${DOMAIN}
export NEXTCLOUD_FQDN
fi
echo -e "${CGREEN}${CEND}"
echo -e "${CCYAN}Sous domaine de heimdall${CEND}"
read -rp "HEIMDALL_FQDN = " HEIMDALL_FQDN
if [ -n "$HEIMDALL_FQDN" ]
then
export HEIMDALL_FQDN=${HEIMDALL_FQDN}.${DOMAIN}
else
HEIMDALL_FQDN=heimdall.${DOMAIN}
export HEIMDALL_FQDN
fi
fi
## Création d'un fichier .env
docker network create traefik_proxy 2>/dev/null
docker network create torrent 2>/dev/null
export PROXY_NETWORK=traefik_proxy
export TRAEFIK_DASHBOARD_URL=traefik.${DOMAIN}
export PLEX_FQDN=plex.${DOMAIN}
export PYLOAD_FQDN=pyload.${DOMAIN}
export MEDUSA_FQDN=medusa.${DOMAIN}
export RTORRENT_FQDN=rtorrent.${DOMAIN}
export RADARR_FQDN=radarr.${DOMAIN}
export SYNCTHING_FQDN=syncthing.${DOMAIN}
export JACKETT_FQDN=jackett.${DOMAIN}
export LIDARR_FQDN=lidarr.${DOMAIN}
export PORTAINER_FQDN=portainer.${DOMAIN}
export TAUTULLI_FQDN=tautulli.${DOMAIN}
export NEXTCLOUD_FQDN=nextcloud.${DOMAIN}
export HEIMDALL_FQDN=heimdall.${DOMAIN}
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
PASS=$PASS
PROXY_NETWORK=$PROXY_NETWORK
TRAEFIK_DASHBOARD_URL=$TRAEFIK_DASHBOARD_URL
PLEX_FQDN=$PLEX_FQDN
LIDARR_FQDN=$LIDARR_FQDN
MEDUSA_FQDN=$MEDUSA_FQDN
RTORRENT_FQDN=$RTORRENT_FQDN
RADARR_FQDN=$RADARR_FQDN
PORTAINER_FQDN=$PORTAINER_FQDN
JACKETT_FQDN=$JACKETT_FQDN
NEXTCLOUD_FQDN=$NEXTCLOUD_FQDN
TAUTULLI_FQDN=$TAUTULLI_FQDN
SYNCTHING_FQDN=$SYNCTHING_FQDN
PYLOAD_FQDN=$PYLOAD_FQDN
HEIMDALL_FQDN=$HEIMDALL_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"]
InsecureSkipVerify = true
[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}
- traefik.frontend.auth.basic=${VAR}
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
- /var/log/traefik:/var/log
ports:
- "80:80"
- "443:443"
networks:
- proxy
command:
- --web
- --accessLog.filePath=/var/log/access.log
- --accessLog.filters.statusCodes=400-499
plex:
container_name: plex
image: plexinc/pms-docker
restart: unless-stopped
hostname: plex
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${PLEX_FQDN}
- traefik.port=32400
- traefik.docker.network=${PROXY_NETWORK}
environment:
- TZ=Europe/Paris
- PLEX_CLAIM=
- PLEX_UID=0
- PLEX_GID=0
ports:
- 32400:32400
volumes:
- ${VOLUMES_ROOT_PATH}/Medias:/mnt
- ${VOLUMES_ROOT_PATH}/plex/config:/config
- /dev/shm:/transcode
networks:
- proxy
lidarr:
container_name: lidarr
image: linuxserver/lidarr
restart: unless-stopped
hostname: lidarr
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${LIDARR_FQDN}
- traefik.port=8686
- traefik.docker.network=${PROXY_NETWORK}
- traefik.frontend.auth.basic=${VAR}
volumes:
- ${VOLUMES_ROOT_PATH}/Medias/${MUSIC}:/music:rw
- ${VOLUMES_ROOT_PATH}/lidarr/config:/config
- ${VOLUMES_ROOT_PATH}/rutorrent/data/torrents:/downloads
environment:
- /etc/localtime:/etc/localtime:ro
- TZ=Paris/Europe
- PUID=0
- PGID=0
networks:
- proxy
pyload:
container_name: pyload
image: writl/pyload
restart: unless-stopped
hostname: pyload
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${PYLOAD_FQDN}
- traefik.port=8000
- traefik.docker.network=${PROXY_NETWORK}
- traefik.frontend.auth.basic=${VAR}
environment:
- /etc/localtime:/etc/localtime:ro
- TZ=Paris/Europe
- PUID=0
- PGID=0
volumes:
- ${VOLUMES_ROOT_PATH}/pyload/download:/opt/pyload/Downloads:rw
- ${VOLUMES_ROOT_PATH}/pyload/config:/opt/pyload/pyload-config:rw
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}
- traefik.frontend.auth.basic=${VAR}
environment:
- /etc/localtime:/etc/localtime:ro
- TZ=Paris/Europe
- PUID=0
- PGID=0
volumes:
- ${VOLUMES_ROOT_PATH}/radarr/config:/config
- ${VOLUMES_ROOT_PATH}/rutorrent/data/torrents:/downloads
- ${VOLUMES_ROOT_PATH}/Medias/${FILMS}:/movies
networks:
- proxy
syncthing:
image: linuxserver/syncthing
container_name: syncthing
restart: unless-stopped
hostname: watcher
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${SYNCTHING_FQDN}
- traefik.port=8384
- traefik.docker.network=${PROXY_NETWORK}
- traefik.frontend.auth.basic=${VAR}
volumes:
- ${VOLUMES_ROOT_PATH}/syncthing/config:/config
- ${VOLUMES_ROOT_PATH}/syncthing/data:/mnt/data
ports:
- 22000:22000
- 21027:21027/udp
environment:
- UMASK_SET=022
- /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}
- traefik.frontend.auth.basic=${VAR}
volumes:
- ${VOLUMES_ROOT_PATH}/Medias/${SERIES}:/tv
- ${VOLUMES_ROOT_PATH}/rutorrent/data/torrents:/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})
- FILEBOT_RENAME_SERIES={n}/Saison {s}/{n} - {s00e00} - {t}
- UID=1001
- GID=1001
- DHT_RTORRENT=on
- PORT_RTORRENT=6881
volumes:
- ${VOLUMES_ROOT_PATH}/rutorrent/data/torrents:/data/torrents
- ${VOLUMES_ROOT_PATH}/Medias:/mnt/Media
- ${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}
- traefik.frontend.auth.basic=${VAR}
environment:
- TZ=Paris/Europe
- PUID=0
- PGID=0
volumes:
- ${VOLUMES_ROOT_PATH}/Jackett/config:/config
- ${VOLUMES_ROOT_PATH}/Jackett/downloads:/downloads
networks:
- proxy
portainer:
container_name: portainer
image: portainer/portainer
restart: unless-stopped
hostname: portainer
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${PORTAINER_FQDN}
- traefik.port=9000
- traefik.docker.network=${PROXY_NETWORK}
volumes:
- ${VOLUMES_ROOT_PATH}/portainer/data:/data
- /var/run/docker.sock:/var/run/docker.sock
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}
- traefik.frontend.auth.basic=${VAR}
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
heimdall:
container_name: heimdall
image: linuxserver/heimdall
restart: unless-stopped
hostname: heimdall
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:${HEIMDALL_FQDN}
- traefik.port=443
- traefik.docker.network=${PROXY_NETWORK}
- traefik.frontend.auth.basic=${VAR}
- traefik.protocol=https
environment:
- TZ=Paris/Europe
- PUID=1001
- PGID=1001
volumes:
- ${VOLUMES_ROOT_PATH}/heimdall/config:/config
networks:
- proxy
nextcloud:
container_name: nextcloud
image: nextcloud
volumes:
- ${VOLUMES_ROOT_PATH}/nextcloud:/var/www/html
labels:
- traefik.backend=nextcloud
- traefik.port=80
- traefik.frontend.rule=Host:${NEXTCLOUD_FQDN}
- traefik.enable=true
- traefik.docker.network=traefik_proxy
- traefik.frontend.auth.basic=${VAR}
depends_on:
- mariadb
networks:
- proxy
- internal
mariadb:
image: mariadb
container_name: mariadb
environment:
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD=${PASS}
- MYSQL_DATABASE=nextcloud
- MYSQL_RANDOM_ROOT_PASSWORD=yes
volumes:
- ${VOLUMES_ROOT_PATH}/mariadb:/var/lib/mysql
networks:
- internal
labels:
- traefik.enable=false
networks:
torrent:
proxy:
external:
name: ${PROXY_NETWORK}
internal:
external: false
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 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
logo.sh
export $(xargs </mnt/.env)
cd /mnt
APPLI=""
sortir=false
while [ !sortir ]
do
echo ""
echo -e "${CRED}-----------------${CEND}"
echo -e "${CCYAN} APPLICATIONS ${CEND}"
echo -e "${CRED}-----------------${CEND}"
echo ""
echo -e "${CGREEN} 1) Plex ${CEND}"
echo -e "${CGREEN} 2) Rtorrent ${CEND}"
echo -e "${CGREEN} 3) Radarr ${CEND}"
echo -e "${CGREEN} 4) Lidarr ${CEND}"
echo -e "${CGREEN} 5) Medusa ${CEND}"
echo -e "${CGREEN} 6) Pyload ${CEND}"
echo -e "${CGREEN} 7) Syncthing ${CEND}"
echo -e "${CGREEN} 8) Jackett ${CEND}"
echo -e "${CGREEN} 9) Portainer ${CEND}"
echo -e "${CGREEN} 10) Tautulli ${CEND}"
echo -e "${CGREEN} 11) Heimball ${CEND}"
echo -e "${CGREEN} 12) Nextcloud ${CEND}"
echo -e "${CGREEN} 13) Retour Menu Principal ${CEND}"
echo ""
read -p "Appli choix [1-13]: " -e -i 1 APPLI
echo ""
case $APPLI in
1)
if ps -e | grep -q Plex; then
echo -e "${CGREEN}Plex est déjà lancé${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour retourner au menu"
clear
logo.sh
else
# CLAIM pour Plex
echo ""
echo -e "${CCYAN}Un token est nécéssaire pour AUTHENTIFIER le serveur Plex ${CEND}"
echo -e "${CCYAN}Pour obtenir un identifiant CLAIM, allez à cette adresse et copier le dans le terminal ${CEND}"
echo -e "${CRED}https://www.plex.tv/claim/ ${CEND}"
echo ""
read -rp "CLAIM = " CLAIM
if [ -n "$CLAIM" ]
then
sed -i -e "s/PLEX_CLAIM=/PLEX_CLAIM=${CLAIM}/g" /mnt/docker-compose.yml
fi
## Lancement de Plex
docker-compose up -d plex 2>/dev/null
echo ""
progress-bar 20
echo ""
echo -e "${CGREEN}Installation de Plex réussie${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour continuer"
clear
logo.sh
fi
;;
2)
if docker ps -a | grep -q torrent; then
echo -e "${CGREEN}rtorrent est déjà lancé${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour retourner au menu"
clear
logo.sh
else
export $(xargs </mnt/.env)
docker-compose up -d torrent
progress-bar 20
echo ""
echo -e "${CGREEN}Installation de Rtorrent réussie${CEND}"
echo ""
# Configuration pour le téléchargement en manuel avec filebot
docker exec -t torrent chown -R 1001:1001 /mnt
docker exec -t torrent sed -i -e "s/data/mnt/g" /usr/local/bin/postdl
docker exec -t torrent sed -i -e "s/Movies/${FILMS}/g" /usr/local/bin/postdl
docker exec -t torrent sed -i -e "s/TV/${SERIES}/g" /usr/local/bin/postdl
docker exec -t torrent sed -i -e "s/Music/${MUSIC}/g" /usr/local/bin/postdl
docker exec -t torrent sed -i -e "s/Animes/${ANIMES}/g" /usr/local/bin/postdl
docker exec -t torrent sed -i '/*)/,/;;/d' /usr/local/bin/postdl
read -p "Appuyer sur la touche Entrer pour continuer"
clear
logo.sh
fi
;;
3)
if docker ps -a | grep -q radarr; then
echo -e "${CGREEN}Radarr est déjà lancé${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour retourner au menu"
clear
logo.sh
else
docker-compose up -d radarr 2>/dev/null
progress-bar 20
echo ""
echo -e "${CGREEN}Installation de radarr réussie${CEND}"
echo ""
read -p "Appuyer sur la touche Entrer pour continuer"
clear
logo.sh
fi
;;
4)