From 48b9205da6686d0e2a8697f4deaa7cf04d808258 Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Sat, 21 Oct 2023 15:43:02 -0300 Subject: Testing the new docker-compose file --- .env.example | 11 ++++++ docker-compose.example.yaml | 88 ++++++++++++++++++++++----------------------- docs.org | 21 ++++++----- install.sh | 22 ++++++++---- 4 files changed, 80 insertions(+), 62 deletions(-) create mode 100644 .env.example mode change 100755 => 100644 install.sh diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..217fb1e --- /dev/null +++ b/.env.example @@ -0,0 +1,11 @@ +# Base configuration +PUID= +PGID= +MEDIA_FOLDER= +INSTALL_LOCATION= +MEDIA_SERVICE= + +# VPN configuration +VPN_SERVICE= +VPN_USER= +VPN_PASSWORD= diff --git a/docker-compose.example.yaml b/docker-compose.example.yaml index 5605e37..9658536 100644 --- a/docker-compose.example.yaml +++ b/docker-compose.example.yaml @@ -3,17 +3,17 @@ version: "3" services: # is used to serve your media to the client devices : - image: lscr.io/linuxserver/ - container_name: + image: lscr.io/linuxserver/${MEDIA_SERVICE} + container_name: ${MEDIA_SERVICE} #network_mode: host # plex environment: - - PUID= - - PGID= + - PUID=${PUID} + - PGID=${PGID} - VERSION=docker volumes: - - /movies:/data/movies - - /tvshows:/data/tvshows - - /config/:/config + - ${MEDIA_FOLDER}/movies:/data/movies + - ${MEDIA_FOLDER}/tvshows:/data/tvshows + - ${INSTALL_LOCATION}/config/${MEDIA_SERVICE}:/config ports: - 8096:8096 restart: unless-stopped @@ -23,12 +23,12 @@ services: image: lscr.io/linuxserver/qbittorrent container_name: qbittorrent environment: - - PUID= - - PGID= + - PUID=${PUID} + - PGID=${PGID} - WEB_UI_PORT=8080 volumes: - - /downloads:/downloads - - /config/qbittorrent:/config + - ${MEDIA_FOLDER}/downloads:/downloads + - ${INSTALL_LOCATION}/config/qbittorrent:/config restart: unless-stopped ports: # qbittorrent - 8080:8080 # qbittorrent @@ -40,12 +40,12 @@ services: image: lscr.io/linuxserver/sonarr container_name: sonarr environment: - - PUID= - - PGID= + - PUID=${PUID} + - PGID=${PGID} volumes: - - /tvshows:/tv - - /downloads:/downloads - - /config/sonarr:/config + - ${MEDIA_FOLDER}/tvshows:/tv + - ${MEDIA_FOLDER}/downloads:/downloads + - ${INSTALL_LOCATION}/config/sonarr:/config ports: - 8989:8989 restart: unless-stopped @@ -56,12 +56,12 @@ services: image: lscr.io/linuxserver/radarr container_name: radarr environment: - - PUID= - - PGID= + - PUID=${PUID} + - PGID=${PGID} volumes: - - /movies:/movies - - /downloads:/downloads - - /config/radarr:/config + - ${MEDIA_FOLDER}/movies:/movies + - ${MEDIA_FOLDER}/downloads:/downloads + - ${INSTALL_LOCATION}/config/radarr:/config ports: - 7878:7878 restart: unless-stopped @@ -72,12 +72,12 @@ services: image: lscr.io/linuxserver/lidarr container_name: lidarr environment: - - PUID= - - PGID= + - PUID=${PUID} + - PGID=${PGID} volumes: - - /music:/music - - /downloads:/downloads - - /config/lidarr:/config + - ${MEDIA_FOLDER}/music:/music + - ${MEDIA_FOLDER}/downloads:/downloads + - ${INSTALL_LOCATION}/config/lidarr:/config ports: - 8686:8686 restart: unless-stopped @@ -88,12 +88,12 @@ services: image: lscr.io/linuxserver/readarr:develop container_name: readarr environment: - - PUID= - - PGID= + - PUID=${PUID} + - PGID=${PGID} volumes: - - /books:/books - - /downloads:/downloads - - /config/readarr:/config + - ${MEDIA_FOLDER}/books:/books + - ${MEDIA_FOLDER}/downloads:/downloads + - ${INSTALL_LOCATION}/config/readarr:/config ports: - 8787:8787 restart: unless-stopped @@ -104,12 +104,12 @@ services: image: lscr.io/linuxserver/bazarr container_name: bazarr environment: - - PUID= - - PGID= + - PUID=${PUID} + - PGID=${PGID} volumes: - - /movies:/movies - - /tvshows:/tv - - /config/bazarr:/config + - ${MEDIA_FOLDER}/movies:/movies + - ${MEDIA_FOLDER}/tvshows:/tv + - ${INSTALL_LOCATION}/config/bazarr:/config ports: - 6767:6767 restart: unless-stopped @@ -120,10 +120,10 @@ services: image: lscr.io/linuxserver/prowlarr container_name: prowlarr environment: - - PUID= - - PGID= + - PUID=${PUID} + - PGID=${PGID} volumes: - - /config/prowlarr:/config + - ${INSTALL_LOCATION}/config/prowlarr:/config ports: - 9696:9696 restart: unless-stopped @@ -142,12 +142,12 @@ services: - 8388:8388/udp # Shadowsocks #- 8080:8080/tcp # gluetun volumes: - - /config/gluetun:/config + - ${INSTALL_LOCATION}/config/gluetun:/config environment: - - VPN_SERVICE_PROVIDER= + - VPN_SERVICE_PROVIDER=${VPN_SERVICE} - VPN_TYPE=openvpn - - OPENVPN_USER= - - OPENVPN_PASSWORD= + - OPENVPN_USER=${VPN_USER} + - OPENVPN_PASSWORD=${VPN_PASSWORD} - OPENVPN_CIPHERS=AES-256-GCM restart: unless-stopped @@ -160,7 +160,7 @@ services: volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock:ro - - /config/portainer:/data + - ${INSTALL_LOCATION}/config/portainer:/data restart: unless-stopped # Watchtower is going to keep our instances updated diff --git a/docs.org b/docs.org index fcac196..70ffe19 100644 --- a/docs.org +++ b/docs.org @@ -180,6 +180,7 @@ install_location=${install_location:-/opt/yams} [[ -f "$install_location" ]] || mkdir -p "$install_location" || send_error_message "There was an error with your install location! Make sure the directory exists and the user \"$USER\" has permissions on it" install_location=$(realpath "$install_location") filename="$install_location/docker-compose.yaml" +env_file="$install_location/.env" read -p "What's the user that is going to own the media server files? [$USER]: " username @@ -316,6 +317,7 @@ echo "" echo "Copying $filename..." cp docker-compose.example.yaml "$filename" || send_error_message "Your user ($USER) needs to have permissions on the installation folder!" +cp .env.example "$env_file" || send_error_message "Your user ($USER) needs to have permissions on the installation folder!" #+end_src ** Set PUID, PGID, Media Folder, Media Service, Config folder and VPN @@ -325,36 +327,33 @@ cp docker-compose.example.yaml "$filename" || send_error_message "Your user ($US #+begin_src bash # Set PUID -sed -i -e "s//$puid/g" "$filename" +sed -i -e "s//$puid/g" "$env_file" # Set PGID -sed -i -e "s//$pgid/g" "$filename" +sed -i -e "s//$pgid/g" "$env_file" # Set media_folder -sed -i -e "s;;$media_folder;g" "$filename" +sed -i -e "s;;$media_folder;g" "$env_file" # Set media_service +sed -i -e "s;;$media_service;g" "$env_file" sed -i -e "s;;$media_service;g" "$filename" if [ "$media_service" == "plex" ]; then sed -i -e "s;#network_mode: host # plex;network_mode: host # plex;g" "$filename" fi # Set config folder -sed -i -e "s;;$install_location;g" "$filename" +sed -i -e "s;;$install_location;g" "$env_file" # Set VPN if [ "$setup_vpn" == "y" ]; then - sed -i -e "s;;$vpn_service;g" "$filename" - sed -i -e "s;;$vpn_user;g" "$filename" - sed -i -e "s;;$vpn_country;g" "$filename" - sed -i -e "s;;$vpn_password;g" "$filename" + sed -i -e "s;;$vpn_service;g" "$env_file" + sed -i -e "s;;$vpn_user;g" "$env_file" + sed -i -e "s;;$vpn_password;g" "$env_file" sed -i -e "s;#network_mode: \"service:gluetun\";network_mode: \"service:gluetun\";g" "$filename" sed -i -e "s;ports: # qbittorrent;#port: # qbittorrent;g" "$filename" sed -i -e "s;- 8080:8080 # qbittorrent;#- 8080:8080 # qbittorrent;g" "$filename" sed -i -e "s;#- 8080:8080/tcp # gluetun;- 8080:8080/tcp # gluetun;g" "$filename" - if echo "nordvpn perfect privacy private internet access vyprvpn wevpn windscribe" | grep -qw "$vpn_service"; then - sed -i -e "s;SERVER_COUNTRIES;SERVER_REGIONS;g" "$filename" - fi fi #+end_src diff --git a/install.sh b/install.sh old mode 100755 new mode 100644 index eeb9f7b..b943422 --- a/install.sh +++ b/install.sh @@ -77,6 +77,7 @@ install_location=${install_location:-/opt/yams} [[ -f "$install_location" ]] || mkdir -p "$install_location" || send_error_message "There was an error with your install location! Make sure the directory exists and the user \"$USER\" has permissions on it" install_location=$(realpath "$install_location") filename="$install_location/docker-compose.yaml" +env_file="$install_location/.env" read -p "What's the user that is going to own the media server files? [$USER]: " username @@ -168,6 +169,11 @@ if [ "$setup_vpn" == "y" ]; then fi done echo + + echo "What country do you want to use?" + echo "If you are using: NordVPN, Perfect Privacy, Private Internet Access, VyprVPN, WeVPN or Windscribe, then input a region" + read -p "You can check the countries/regions list for your VPN here: https://github.com/qdm12/gluetun/wiki/$vpn_service#servers [brazil]: " vpn_country + vpn_country=${vpn_country:-"brazil"} fi echo "Configuring the docker-compose file for the user \"$username\" on \"$install_location\"..." @@ -176,30 +182,32 @@ echo "" echo "Copying $filename..." cp docker-compose.example.yaml "$filename" || send_error_message "Your user ($USER) needs to have permissions on the installation folder!" +cp .env.example "$env_file" || send_error_message "Your user ($USER) needs to have permissions on the installation folder!" # Set PUID -sed -i -e "s//$puid/g" "$filename" +sed -i -e "s//$puid/g" "$env_file" # Set PGID -sed -i -e "s//$pgid/g" "$filename" +sed -i -e "s//$pgid/g" "$env_file" # Set media_folder -sed -i -e "s;;$media_folder;g" "$filename" +sed -i -e "s;;$media_folder;g" "$env_file" # Set media_service +sed -i -e "s;;$media_service;g" "$env_file" sed -i -e "s;;$media_service;g" "$filename" if [ "$media_service" == "plex" ]; then sed -i -e "s;#network_mode: host # plex;network_mode: host # plex;g" "$filename" fi # Set config folder -sed -i -e "s;;$install_location;g" "$filename" +sed -i -e "s;;$install_location;g" "$env_file" # Set VPN if [ "$setup_vpn" == "y" ]; then - sed -i -e "s;;$vpn_service;g" "$filename" - sed -i -e "s;;$vpn_user;g" "$filename" - sed -i -e "s;;$vpn_password;g" "$filename" + sed -i -e "s;;$vpn_service;g" "$env_file" + sed -i -e "s;;$vpn_user;g" "$env_file" + sed -i -e "s;;$vpn_password;g" "$env_file" sed -i -e "s;#network_mode: \"service:gluetun\";network_mode: \"service:gluetun\";g" "$filename" sed -i -e "s;ports: # qbittorrent;#port: # qbittorrent;g" "$filename" sed -i -e "s;- 8080:8080 # qbittorrent;#- 8080:8080 # qbittorrent;g" "$filename" -- cgit v1.2.3