Refactored YAMS to literate #59

Merged
rogs merged 32 commits from feature/refactor-to-literate into v2 2023-10-21 19:17:08 -03:00
4 changed files with 80 additions and 62 deletions
Showing only changes of commit 48b9205da6 - Show all commits

11
.env.example Normal file
View File

@ -0,0 +1,11 @@
# Base configuration
PUID=<your_PUID>
PGID=<your_PGID>
MEDIA_FOLDER=<media_folder>
INSTALL_LOCATION=<install_location>
MEDIA_SERVICE=<media_service>
# VPN configuration
VPN_SERVICE=<vpn_service>
VPN_USER=<vpn_user>
VPN_PASSWORD=<vpn_password>

View File

@ -3,17 +3,17 @@ version: "3"
services:
# <media_service> is used to serve your media to the client devices
<media_service>:
image: lscr.io/linuxserver/<media_service>
container_name: <media_service>
image: lscr.io/linuxserver/${MEDIA_SERVICE}
container_name: ${MEDIA_SERVICE}
#network_mode: host # plex
environment:
- PUID=<your_PUID>
- PGID=<your_PGID>
- PUID=${PUID}
- PGID=${PGID}
- VERSION=docker
volumes:
- <media_folder>/movies:/data/movies
- <media_folder>/tvshows:/data/tvshows
- <install_location>/config/<media_service>:/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=<your_PUID>
- PGID=<your_PGID>
- PUID=${PUID}
- PGID=${PGID}
- WEB_UI_PORT=8080
volumes:
- <media_folder>/downloads:/downloads
- <install_location>/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=<your_PUID>
- PGID=<your_PGID>
- PUID=${PUID}
- PGID=${PGID}
volumes:
- <media_folder>/tvshows:/tv
- <media_folder>/downloads:/downloads
- <install_location>/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=<your_PUID>
- PGID=<your_PGID>
- PUID=${PUID}
- PGID=${PGID}
volumes:
- <media_folder>/movies:/movies
- <media_folder>/downloads:/downloads
- <install_location>/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=<your_PUID>
- PGID=<your_PGID>
- PUID=${PUID}
- PGID=${PGID}
volumes:
- <media_folder>/music:/music
- <media_folder>/downloads:/downloads
- <install_location>/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=<your_PUID>
- PGID=<your_PGID>
- PUID=${PUID}
- PGID=${PGID}
volumes:
- <media_folder>/books:/books
- <media_folder>/downloads:/downloads
- <install_location>/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=<your_PUID>
- PGID=<your_PGID>
- PUID=${PUID}
- PGID=${PGID}
volumes:
- <media_folder>/movies:/movies
- <media_folder>/tvshows:/tv
- <install_location>/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=<your_PUID>
- PGID=<your_PGID>
- PUID=${PUID}
- PGID=${PGID}
volumes:
- <install_location>/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:
- <install_location>/config/gluetun:/config
- ${INSTALL_LOCATION}/config/gluetun:/config
environment:
- VPN_SERVICE_PROVIDER=<vpn_service>
- VPN_SERVICE_PROVIDER=${VPN_SERVICE}
- VPN_TYPE=openvpn
- OPENVPN_USER=<vpn_user>
- OPENVPN_PASSWORD=<vpn_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
- <install_location>/config/portainer:/data
- ${INSTALL_LOCATION}/config/portainer:/data
restart: unless-stopped
# Watchtower is going to keep our instances updated

View File

@ -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/<your_PUID>/$puid/g" "$filename"
sed -i -e "s/<your_PUID>/$puid/g" "$env_file"
# Set PGID
sed -i -e "s/<your_PGID>/$pgid/g" "$filename"
sed -i -e "s/<your_PGID>/$pgid/g" "$env_file"
# Set media_folder
sed -i -e "s;<media_folder>;$media_folder;g" "$filename"
sed -i -e "s;<media_folder>;$media_folder;g" "$env_file"
# Set media_service
sed -i -e "s;<media_service>;$media_service;g" "$env_file"
sed -i -e "s;<media_service>;$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>;$install_location;g" "$filename"
sed -i -e "s;<install_location>;$install_location;g" "$env_file"
# Set VPN
if [ "$setup_vpn" == "y" ]; then
sed -i -e "s;<vpn_service>;$vpn_service;g" "$filename"
sed -i -e "s;<vpn_user>;$vpn_user;g" "$filename"
sed -i -e "s;<vpn_country>;$vpn_country;g" "$filename"
sed -i -e "s;<vpn_password>;$vpn_password;g" "$filename"
sed -i -e "s;<vpn_service>;$vpn_service;g" "$env_file"
sed -i -e "s;<vpn_user>;$vpn_user;g" "$env_file"
sed -i -e "s;<vpn_password>;$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

22
install.sh Executable file → Normal file
View File

@ -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/<your_PUID>/$puid/g" "$filename"
sed -i -e "s/<your_PUID>/$puid/g" "$env_file"
# Set PGID
sed -i -e "s/<your_PGID>/$pgid/g" "$filename"
sed -i -e "s/<your_PGID>/$pgid/g" "$env_file"
# Set media_folder
sed -i -e "s;<media_folder>;$media_folder;g" "$filename"
sed -i -e "s;<media_folder>;$media_folder;g" "$env_file"
# Set media_service
sed -i -e "s;<media_service>;$media_service;g" "$env_file"
sed -i -e "s;<media_service>;$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>;$install_location;g" "$filename"
sed -i -e "s;<install_location>;$install_location;g" "$env_file"
# Set VPN
if [ "$setup_vpn" == "y" ]; then
sed -i -e "s;<vpn_service>;$vpn_service;g" "$filename"
sed -i -e "s;<vpn_user>;$vpn_user;g" "$filename"
sed -i -e "s;<vpn_password>;$vpn_password;g" "$filename"
sed -i -e "s;<vpn_service>;$vpn_service;g" "$env_file"
sed -i -e "s;<vpn_user>;$vpn_user;g" "$env_file"
sed -i -e "s;<vpn_password>;$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"