Skip to content

Commit 7689228

Browse files
authored
Merge pull request #23 from gpongelli/PR_add_volumes_to_script
Transmission container plus volume management
2 parents c23d787 + 1936989 commit 7689228

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

.templates/transmission/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# create directories for named volumes
4+
TRANSMISSION_BASEDIR=.volumes/transmission
5+
mkdir -p $TRANSMISSION_BASEDIR/downloads
6+
mkdir -p $TRANSMISSION_BASEDIR/watch
7+
mkdir -p $TRANSMISSION_BASEDIR/config

.templates/transmission/service.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
transmission:
2+
image: linuxserver/transmission
3+
container_name: transmission
4+
environment:
5+
- PUID=1000
6+
- PGID=1000
7+
- TZ=Europe/Rome
8+
volumes:
9+
- transm_config_volume:/config
10+
- transm_download_volume:/downloads
11+
- transm_watch_volume:/watch
12+
ports:
13+
- 9091:9091
14+
- 51413:51413
15+
- 51413:51413/udp
16+
restart: unless-stopped

.templates/transmission/volumes.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
transm_download_volume:
3+
driver: local
4+
driver_opts:
5+
o: bind
6+
type: none
7+
device: .volumes/transmission/downloads
8+
9+
transm_watch_volume:
10+
driver: local
11+
driver_opts:
12+
o: bind
13+
type: none
14+
device: .volumes/transmission/watch
15+
16+
transm_config_volume:
17+
driver: local
18+
driver_opts:
19+
o: bind
20+
type: none
21+
device: .volumes/transmission/config

menu.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ declare -A cont_array=(
88
[nodered]="Node-RED"
99
[influxdb]="InfluxDB"
1010
[telegraf]="Telegraf (Requires InfluxDB and Mosquitto)"
11+
[transmission]="transmission"
1112
[grafana]="Grafana"
1213
[mosquitto]="Eclipse-Mosquitto"
1314
[postgres]="Postgres"
@@ -31,6 +32,7 @@ declare -A cont_array=(
3132
[gitea]="Gitea"
3233
)
3334

35+
3436
declare -a armhf_keys=(
3537
"portainer"
3638
"nodered"
@@ -40,6 +42,7 @@ declare -a armhf_keys=(
4042
"telegraf"
4143
"mariadb"
4244
"postgres"
45+
"transmission"
4346
"adminer"
4447
"openhab"
4548
"zigbee2mqtt"
@@ -140,6 +143,9 @@ function yml_builder() {
140143
#if an env file exists check for timezone
141144
[ -f "./services/$1/$1.env" ] && timezones ./services/$1/$1.env
142145

146+
# if a volumes.yml exists, append to overall volumes.yml file
147+
[ -f "./services/$1/volumes.yml" ] && cat "./services/$1/volumes.yml" >> docker-volumes.yml
148+
143149
#add new line then append service
144150
echo "" >>docker-compose.yml
145151
cat $service >>docker-compose.yml
@@ -302,6 +308,14 @@ case $mainmenu_selection in
302308
done
303309
fi
304310
fi
311+
312+
# if a container needs volume, put it at the end of docker-compose
313+
if [ -f docker-volumes.yml ]; then
314+
echo "" >> docker-compose.yml
315+
echo "volumes:" >> docker-compose.yml
316+
cat docker-volumes.yml >> docker-compose.yml
317+
rm docker-volumes.yml
318+
fi
305319

306320
echo "docker-compose successfully created"
307321
echo "run 'docker-compose up -d' to start the stack"

0 commit comments

Comments
 (0)