diff --git a/.env b/.env index 92cc9da..b8ebb34 100644 --- a/.env +++ b/.env @@ -74,3 +74,7 @@ PROXYLITE_USER_ID=yourPROXYLITEUserID # SHOUTRRR_URL should be like this ://@ # REGISTER ON DISCORD AND CREATE A NEW SERVER, GO TO SERVER SETTINGS>INTEGRATIONS AND CREATE A WEBHOOK, THEN INSERT IT BELOW THE SAME FORMAT WRITTEN ABOVE. (YOU CAN ALSO USE OTHER APPS) # SHOUTRRR_URL=yourApp:yourToken@yourWebHook + +## CONFIGURATION STATUSES ## DO NOT MODIFY MANUALLY +ENV_CONFIGURATION_STATUS=0 +NOTIFICATIONS_CONFIGURATION_STATUS=0 \ No newline at end of file diff --git a/.resources/.www/.configs/config.json b/.resources/.www/.configs/config.json index fd5da05..dc8ea33 100644 --- a/.resources/.www/.configs/config.json +++ b/.resources/.www/.configs/config.json @@ -21,13 +21,6 @@ "image": "iproyal/pawns-cli", "flags": ["--email", "--password"] }, - { - "name": "PEER2PROFIT", - "dashboard": "https://dashboard.peer2profit.app/dashboard", - "link": "https://p2pr.me/165849012262da8d0aa13c8", - "image": "peer2profit/peer2profit_linux", - "flags": ["--email"] - }, { "name": "PACKETSTREAM", "dashboard": "https://packetstream.io/dashboard", @@ -70,5 +63,23 @@ "image": "bitping/bitping-node", "flags": ["--customScript", "bitpingSetup"] } + ], + "extra-apps":[ + { + "name": "MYSTNODE", + "dashboard": "https://mystnodes.com/nodes", + "link": "https://mystnodes.com/onboarding", + "image": "mysteriumnetwork/myst", + "flags": ["--manual"] + } + ], + "removed-apps":[ + { + "name": "PEER2PROFIT", + "dashboard": "https://dashboard.peer2profit.app/dashboard", + "link": "https://p2pr.me/165849012262da8d0aa13c8", + "image": "peer2profit/peer2profit_linux", + "flags": ["--email"] + } ] } diff --git a/docker-compose.yaml b/docker-compose.yaml index 5c2e088..2e3f7d7 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,6 +6,7 @@ services: +### APPS ### # EARNAPP CONTAINER #EARNAPP_ENABLE earnapp: @@ -38,15 +39,6 @@ services: #IPROYALPAWNS_ENABLE # network_mode: service:tun2socks #IPROYALPAWNS_ENABLE restart: always -# PEER2PROFIT CONTAINER -#PEER2PROFIT_ENABLE peer2profit: -#PEER2PROFIT_ENABLE container_name: peer2profit -#PEER2PROFIT_ENABLE image: peer2profit/peer2profit_linux:latest -#PEER2PROFIT_ENABLE environment: -#PEER2PROFIT_ENABLE - P2P_EMAIL=$PEER2PROFIT_EMAIL -#PEER2PROFIT_ENABLE # network_mode: service:tun2socks -#PEER2PROFIT_ENABLE restart: always - # PACKETSTREAM CONTAINER #PACKETSTREAM_ENABLE packetstream: #PACKETSTREAM_ENABLE container_name: packetstream @@ -110,6 +102,38 @@ services: #BITPING_ENABLE # network_mode: service:tun2socks #BITPING_ENABLE restart: always +### EXTRA APPS ### + +# MYSTERIUM CONTAINER +#MYSTNODE_ENABLE mysterium: +#MYSTNODE_ENABLE container_name: mystnode +#MYSTNODE_ENABLE image: mysteriumnetwork/myst:latest +#MYSTNODE_ENABLE environment: +#MYSTNODE_ENABLE - MYSTNODE_DUMMY='' +#MYSTNODE_ENABLE command: service --agreed-terms-and-conditions +#MYSTNODE_ENABLE cap_add: +#MYSTNODE_ENABLE - NET_ADMIN +#MYSTNODE_ENABLE ports: +#MYSTNODE_ENABLE - 4449:4449 +#MYSTNODE_ENABLE volumes: +#MYSTNODE_ENABLE # You have 2 options +#MYSTNODE_ENABLE - ./.data/mysterium-node:/var/lib/mysterium-node # Bind an host folder to the container (more insecure but simplier to port and backup) this option mount a new identity or a backed up one from the host file system +#MYSTNODE_ENABLE # OR +#MYSTNODE_ENABLE #- myst-data:/var/lib/mysterium-node # if you use this also uncomment the relative volume in volumes section, this Use docker volumes (more secure harder to access, backup and restore) you'll need to do backups using 'docker cp myst:/var/lib/mysterium-node .' and then when you need to restore the identity first delete the automatically created and not needed identities using 'sudo docker exec -it myst sh' and then in the container shell use 'sudo rm -rf /var/lib/mysterium-node/*' then stop the container and use docker cp to copy the backed-up identity in the container, ther restart the container. +#MYSTNODE_ENABLE # network_mode: service:tun2socks +#MYSTNODE_ENABLE restart: always + +# PEER2PROFIT CONTAINER +#PEER2PROFIT_ENABLE peer2profit: +#PEER2PROFIT_ENABLE container_name: peer2profit +#PEER2PROFIT_ENABLE image: peer2profit/peer2profit_linux:latest +#PEER2PROFIT_ENABLE environment: +#PEER2PROFIT_ENABLE - P2P_EMAIL=$PEER2PROFIT_EMAIL +#PEER2PROFIT_ENABLE # network_mode: service:tun2socks +#PEER2PROFIT_ENABLE restart: always + +### TOOLS AND SERVICES ### + # TUN2SOCKS CONTAINER #PROXY_ENABLE tun2socks: #PROXY_ENABLE image: xjasonlyu/tun2socks @@ -124,6 +148,7 @@ services: #PROXY_ENABLE cap_add: #PROXY_ENABLE - NET_ADMIN + # WATCHTOWER AUTO-UPDATER AND NOTIFICATIONS watchtower: container_name: watchtower @@ -153,3 +178,4 @@ services: volumes: earnapp-data: #bitping-data: # uncomment this if in bitping volumes you choose to use docker volumes instead of binding an host folder + #myst-data: # uncomment this if in myst volumes you choose to use docker volumes instead of binding an host folder diff --git a/runme.ps1 b/runme.ps1 index e517638..9ab3a3e 100644 --- a/runme.ps1 +++ b/runme.ps1 @@ -353,6 +353,7 @@ function fn_setupApp { $cid = $false $token = $false $customScript = $null + $manual = $false #Write-Output "passed parameters: APP: $app, IMG: $image, FLAGS: $flags" #Read-Host -Prompt "This is for debug Press enter to continue" @@ -372,6 +373,7 @@ function fn_setupApp { $customScript = $flags[$i+1] # consider the element after --customScript as the script name $i++ # increment the index to skip the next element } + "--manual" {$manual = $true} default {colorprint "RED" "Unknown flag: $($flags[$i])"} } } @@ -484,6 +486,10 @@ function fn_setupApp { colorprint "RED" "Custom script '$SCRIPT_NAME' not found in the scripts directory." } } + if($manual){ + colorprint "DEFAULT" "${CURRENT_APP} requires further manual configuration." + colorprint "DEFAULT" "Please after completing this automated setup follow the manual steps described on the app's website." + } # App Docker image architecture adjustments $TAG = 'latest' diff --git a/runme.sh b/runme.sh index fdf8b04..41f22f4 100644 --- a/runme.sh +++ b/runme.sh @@ -519,6 +519,10 @@ fn_setupApp() { colorprint "RED" "Custom script '$SCRIPT_NAME' not found in the scripts directory." fi ;; + --manual) + colorprint "DEFAULT" "${CURRENT_APP} requires further manual configuration." + colorprint "DEFAULT" "Please after completing this automated setup follow the manual steps described on the app's website." + ;; *) colorprint "RED" "Unknown flag: $1" exit 1 @@ -597,7 +601,15 @@ fn_setupProxy() { } fn_setupEnv(){ - debug "Starting setupEnv function" + local app_type="$1" # Accept the type of apps as an argument + debug "Starting setupEnv function for $app_type" + + # Check if .env file is already configured + ENV_CONFIGURATION_STATUS=$(grep -oP 'ENV_CONFIGURATION_STATUS=\K[^#]+' .env) + debug "Current ENV_CONFIGURATION_STATUS: $ENV_CONFIGURATION_STATUS" + NOTIFICATIONS_CONFIGURATION_STATUS=$(grep -oP 'NOTIFICATIONS_CONFIGURATION_STATUS=\K[^#]+' .env) + debug "Current NOTIFICATIONS_CONFIGURATION_STATUS: $NOTIFICATIONS_CONFIGURATION_STATUS" + while true; do colorprint "YELLOW" "Do you wish to proceed with the .env file guided setup Y/N? (This will also adapt the $DKCOM_FILENAME file accordingly)" read -r yn @@ -605,12 +617,30 @@ fn_setupEnv(){ [Yy]* ) clear debug "User chose to proceed with the .env file guided setup" - if ! grep -q "DEVICE_NAME=${DEVICE_NAME}" .env ; then - print_and_log "DEFAULT" "The current .env file appears to have already been modified. A fresh version will be downloaded and used."; - curl -fsSL $ENV_SRC -o ".env" - curl -fsSL $DKCOM_SRC -o "$DKCOM_FILENAME" - clear + + if [ "$ENV_CONFIGURATION_STATUS" == "1" ] && [ "$app_type" == "apps" ]; then + colorprint "YELLOW" "The current .env file appears to have already been configured. Do you want to reset it? (Y/N)" + read -r yn + case $yn in + [Yy]* ) + print_and_log "DEFAULT" "Downloading a fresh .env file."; + curl -fsSL $ENV_SRC -o ".env" + curl -fsSL $DKCOM_SRC -o "$DKCOM_FILENAME" + sed -i 's/ENV_CONFIGURATION_STATUS=1/ENV_CONFIGURATION_STATUS=0/' .env + clear + ;; + [Nn]* ) + print_and_log "BLUE" "Keeping the existing .env file." + ;; + * ) + colorprint "RED" "Invalid input. Please answer yes or no." + return 1 + ;; + esac + elif [ "$app_type" == "extra-apps" ]; then + print_and_log "BLUE" "Proceeding with extra-apps setup without resetting .env file." fi + colorprint "YELLOW" "beginnning env file guided setup"$'\n' CURRENT_APP=''; colorprint "YELLOW" "PLEASE ENTER A NAME FOR YOUR DEVICE:" @@ -619,9 +649,9 @@ fn_setupEnv(){ clear ; fn_setupProxy ; clear ; - debug " Loading apps from config.json..." - apps=$(jq -c '.apps[]' "$CONFIG_DIR/config.json") - debug " Apps loaded from config.json" + debug " Loading $app_type from config.json..." + apps=$(jq -c ".${app_type}[]" "$CONFIG_DIR/config.json") + debug " $app_type loaded from config.json" for app in $apps; do clear @@ -658,23 +688,28 @@ fn_setupEnv(){ # Notifications setup clear; - debug "Asking user if they want to setup notifications" - while true; do - colorprint "YELLOW" "Do you wish to setup notifications about apps images updates (Yes to receive notifications and apply updates, No to just silently apply updates) Y/N?" - read -r yn - case $yn in - [Yy]* ) - debug "User chose to setup notifications" - fn_setupNotifications; - break;; - [Nn]* ) - debug "User chose not to setup notifications" - colorprint "BLUE" "Noted: all updates will be applied automatically and silently"; - break;; - * ) colorprint "RED" "Invalid input. Please answer yes or no.";; - esac - done + if [ "$NOTIFICATIONS_CONFIGURATION_STATUS" == "1" ]; then + print_and_log "BLUE" "Notifications are already set up. Skipping notifications setup. Reset the .env file and do a new complete setup to set up different notification settings." + else + debug "Asking user if they want to setup notifications" + while true; do + colorprint "YELLOW" "Do you wish to setup notifications about apps images updates (Yes to receive notifications and apply updates, No to just silently apply updates) Y/N?" + read -r yn + case $yn in + [Yy]* ) + debug "User chose to setup notifications" + fn_setupNotifications; + break;; + [Nn]* ) + debug "User chose not to setup notifications" + colorprint "BLUE" "Noted: all updates will be applied automatically and silently"; + break;; + * ) colorprint "RED" "Invalid input. Please answer yes or no.";; + esac + done + fi + sed -i 's/ENV_CONFIGURATION_STATUS=0/ENV_CONFIGURATION_STATUS=1/' .env print_and_log "GREEN" "env file setup complete."; read -n 1 -s -r -p "Press any key to go back to the menu"$'\n' break @@ -690,6 +725,14 @@ fn_setupEnv(){ done } +fn_setupApps(){ + fn_setupEnv "apps" # Call fn_setupEnv with "apps" +} + +fn_setupExtraApps(){ + fn_setupEnv "extra-apps" # Call fn_setupEnv with "extra_apps" +} + fn_startStack(){ clear debug "Starting startStack function" @@ -829,7 +872,7 @@ mainmenu() { PS3="Select an option and press Enter "$'\n' debug "Loading menu options" - options=("Show supported apps' links" "Install Docker" "Setup .env file" "Start apps stack" "Stop apps stack" "Reset .env File" "Reset $DKCOM_FILENAME file" "Quit") + options=("Show supported apps' links" "Install Docker" "Setup Apps" "Setup Extra Apps" "Start apps stack" "Stop apps stack" "Reset .env File" "Reset $DKCOM_FILENAME file" "Quit") debug "Menu options loaded. Showing menu options, ready to select" select option in "${options[@]}" @@ -837,11 +880,12 @@ mainmenu() { case $REPLY in 1) clear; fn_showLinks; break;; 2) clear; fn_dockerInstall; break;; - 3) clear; fn_setupEnv; break;; - 4) clear; fn_startStack; break;; - 5) clear; fn_stopStack; break;; - 6) clear; fn_resetEnv; break;; - 7) clear; fn_resetDockerCompose; break;; + 3) clear; fn_setupApps; break;; + 4) clear; fn_setupExtraApps; break;; + 5) clear; fn_startStack; break;; + 6) clear; fn_stopStack; break;; + 7) clear; fn_resetEnv; break;; + 8) clear; fn_resetDockerCompose; break;; ${#options[@]}) fn_bye; break;; *) clear; fn_unknown; break;; esac