Skip to content

Commit

Permalink
feat(app-config): add PACKETSHARE, DAWN, and TENEO apps; new ports su…
Browse files Browse the repository at this point in the history
…pport for each app, update project version to 4.6.0
  • Loading branch information
MRColorR committed Feb 21, 2025
1 parent 9c12cf0 commit 5cd2fb5
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 18 deletions.
93 changes: 82 additions & 11 deletions config/app-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,37 @@
"mfa": {}
}
},
{
"name": "PACKETSHARE",
"dashboard": "https://packetshare.io/ucenter.html",
"link": "https://www.packetshare.io/?code=A260871CFD822E35",
"compose_config": {
"container_name": "${DEVICE_NAME}_packetshare",
"hostname": "${DEVICE_NAME}_packetshare",
"image": "packetshare/packetshare:latest",
"command": "-accept-tos -email=${PACKETSHARE_EMAIL} -password=${PACKETSHARE_PASSWORD}",
"environment": ["PACKETSHARE_DUMMY=''"],
"restart": "always",
"cpus": "${APP_CPU_LIMIT_MEDIUM}",
"mem_reservation": "${APP_MEM_RESERV_MEDIUM}",
"mem_limit": "${APP_MEM_LIMIT_MEDIUM}",
"logging": {
"driver": "json-file",
"options": {
"max-size": "10m",
"max-file": "3"
}
}
},
"compose_config_proxy": {
"network_mode": "service:proxy",
"hostname": null
},
"flags": {
"email": {},
"password": {}
}
},
{
"name": "GRASS",
"dashboard": "https://app.getgrass.io/dashboard",
Expand All @@ -334,6 +365,7 @@
"USER_EMAIL=$GRASS_EMAIL",
"USER_PASSWORD=$GRASS_PASSWORD"
],
"volumes": [".data/.grass:/app/chrome_user_data"],
"restart": "always",
"cpus": "${APP_CPU_LIMIT_BIG}",
"mem_reservation": "${APP_MEM_RESERV_BIG}",
Expand Down Expand Up @@ -367,6 +399,7 @@
"GRADIENT_EMAIL=$GRADIENT_EMAIL",
"GRADIENT_PASS=$GRADIENT_PASSWORD"
],
"volumes": [".data/.gradient:/app/chrome_user_data"],
"restart": "always",
"cpus": "${APP_CPU_LIMIT_BIG}",
"mem_reservation": "${APP_MEM_RESERV_BIG}",
Expand All @@ -389,19 +422,57 @@
}
},
{
"name": "PACKETSHARE",
"dashboard": "https://packetshare.io/ucenter.html",
"link": "https://www.packetshare.io/?code=A260871CFD822E35",
"name": "DAWN",
"dashboard": "https://dawninternet.com",
"link": "https://dawninternet.com?code=xo23vynw",
"compose_config": {
"container_name": "${DEVICE_NAME}_packetshare",
"hostname": "${DEVICE_NAME}_packetshare",
"image": "packetshare/packetshare:latest",
"command": "-accept-tos -email=${PACKETSHARE_EMAIL} -password=${PACKETSHARE_PASSWORD}",
"environment": ["PACKETSHARE_DUMMY=''"],
"container_name": "${DEVICE_NAME}_dawn",
"hostname": "${DEVICE_NAME}_dawn",
"image": "carbon2029/dockweb:latest",
"environment": [
"DAWN_EMAIL=$DAWN_EMAIL",
"DAWN_PASS=$DAWN_PASSWORD"
],
"volumes": [".data/.dawn:/app/chrome_user_data"],
"ports": ["${DAWN_PORT}:5000"],
"restart": "always",
"cpus": "${APP_CPU_LIMIT_MEDIUM}",
"mem_reservation": "${APP_MEM_RESERV_MEDIUM}",
"mem_limit": "${APP_MEM_LIMIT_MEDIUM}",
"cpus": "${APP_CPU_LIMIT_BIG}",
"mem_reservation": "${APP_MEM_RESERV_BIG}",
"mem_limit": "${APP_MEM_LIMIT_BIG}",
"logging": {
"driver": "json-file",
"options": {
"max-size": "10m",
"max-file": "3"
}
}
},
"compose_config_proxy": {
"network_mode": "service:proxy",
"hostname": null
},
"flags": {
"email": {},
"password": {}
}
},
{
"name": "TENEO",
"dashboard": "https://dashboard.teneo.pro/",
"link": "https://dashboard.teneo.pro/?code=qPgLn",
"compose_config": {
"container_name": "${DEVICE_NAME}_teneo",
"hostname": "${DEVICE_NAME}_teneo",
"image": "carbon2029/dockweb:latest",
"environment": [
"TENO_EMAIL=$TENEO_EMAIL",
"TENO_PASS=$TENEO_PASSWORD"
],
"volumes": [".data/.teneo:/app/chrome_user_data"],
"restart": "always",
"cpus": "${APP_CPU_LIMIT_BIG}",
"mem_reservation": "${APP_MEM_RESERV_BIG}",
"mem_limit": "${APP_MEM_LIMIT_BIG}",
"logging": {
"driver": "json-file",
"options": {
Expand Down
2 changes: 1 addition & 1 deletion config/m4b-config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"project": {
"project_version": "4.5.5",
"project_version": "4.6.0",
"compose_project_name": "money4band",
"ds_project_server_url": "https://discord.com/invite/Fq8eeazBAD"
},
Expand Down
20 changes: 17 additions & 3 deletions template/user-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@
"email": "yourBITPINGMail",
"password": "yourBITPINGPw"
},
"packetshare": {
"enabled": false,
"docker_platform": "linux/amd64",
"email": "yourPACKETSHAREMail",
"password": "yourPACKETSHAREPw"
},
"speedshare": {
"enabled": false,
"docker_platform": "linux/amd64",
Expand All @@ -83,11 +89,19 @@
"email": "yourGRADIENTMail",
"password": "yourGRADIENTPw"
},
"packetshare": {
"dawn": {
"enabled": false,
"docker_platform": "linux/amd64",
"email": "yourPACKETSHAREMail",
"password": "yourPACKETSHAREPw"
"email": "yourDAWNMail",
"password": "yourDAWNPw",
"ports": 5000

},
"teneo": {
"enabled": false,
"docker_platform": "linux/amd64",
"email": "yourTENEOMail",
"password": "yourTENEOPw"
},
"mystnode": {
"enabled": false,
Expand Down
27 changes: 27 additions & 0 deletions utils/dockweb_WIP.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from typing import Dict, Any


def enable_dockweb_if_needed(user_config: Dict[str, Any]) -> Dict[str, Any]:
"""
Enable DockWeb if any of the associated apps is enabled and disable the associated apps.
Args:
user_config (dict): The user configuration dictionary.
Returns:
Dict[str, Any]: The updated user configuration dictionary.
"""
dockweb_enabled = False
associated_apps = ['grass', 'gradient', 'dawn', 'teno']

for app_name in associated_apps:
if user_config['apps'].get(app_name, {}).get('enabled', False):
dockweb_enabled = True
user_config['apps'][app_name]['enabled'] = False

if dockweb_enabled:
user_config['apps']['dockweb']['enabled'] = True
else:
user_config['apps']['dockweb']['enabled'] = False

return user_config
12 changes: 10 additions & 2 deletions utils/fn_setupApps.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def configure_uuid(app: Dict, flag_config: Dict, config: Dict):
except Exception as e:
logging.error(f'Error writing claim instructions to file: {e}')
input('Press enter to continue...')

prefix = flag_config.get('prefix', '')
uuid = f'{prefix}{uuid}'
config['uuid'] = uuid
Expand Down Expand Up @@ -216,7 +216,7 @@ def _configure_apps(user_config: Dict[str, Any], apps: Dict, m4b_config: Dict):
print(f'{key}: {value}')
if not ask_question_yn(''):
continue

config['enabled'] = ask_question_yn(f'Do you want to run {app["name"].title()}?')
if not config['enabled']:
continue
Expand All @@ -228,6 +228,14 @@ def _configure_apps(user_config: Dict[str, Any], apps: Dict, m4b_config: Dict):
flag_function_mapper[flag_name](app, flag_config, config)
else:
logging.error(f'Flag {flag_name} not recognized')

# Port configuration for apps with defined ports (should have a 'ports' key in the compose_config and a <app_name>_port key in the user_config)
if 'ports' in app['compose_config']:
starting_port = config.get('ports', 50000)
available_port = find_next_available_port(starting_port)
config['ports'] = available_port
logging.info(f"Port for {app_name} set to: {available_port}")

user_config['apps'][app_name] = config


Expand Down
4 changes: 3 additions & 1 deletion utils/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,11 @@ def generate_env_file(m4b_config_path_or_dict: Any, app_config_path_or_dict: Any
env_var_value = app_user_config[flag_name]
env_lines.append(f"{env_var_name}={env_var_value}")

# Add app dashboard port if it exists
# Add ports configurations for apps that have them
if 'dashboard_port' in app_user_config:
env_lines.append(f"{app_name.upper()}_DASHBOARD_PORT={app_user_config['dashboard_port']}")
if 'ports' in app_user_config:
env_lines.append(f"{app_name.upper()}_PORT={app_user_config['ports']}")

# Write to .env file
with open(env_output_path, 'w') as f:
Expand Down
1 change: 1 addition & 0 deletions utils/networker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import socket


def is_port_in_use(port):
"""Check if a port is already in use."""
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
Expand Down

0 comments on commit 5cd2fb5

Please sign in to comment.