mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-11-12 00:19:15 +00:00
More dynamic app updates
This commit is contained in:
parent
16f8485b0d
commit
5a00109683
|
@ -2,9 +2,16 @@
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from application_info import *
|
from application_info import *
|
||||||
import json
|
import logging
|
||||||
|
from systemd import journal
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
log = logging.getLogger('mynode_manage_apps')
|
||||||
|
log.addHandler(journal.JournaldLogHandler())
|
||||||
|
log.setLevel(logging.INFO)
|
||||||
|
set_logger(log)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = ArgumentParser(prog='mynode-manage-apps')
|
parser = ArgumentParser(prog='mynode-manage-apps')
|
||||||
action_choices = (
|
action_choices = (
|
||||||
|
|
|
@ -506,6 +506,9 @@ cp -f /usr/share/mynode/netdata.conf /opt/mynode/netdata/netdata.conf
|
||||||
mkdir -p /opt/mynode/webssh2
|
mkdir -p /opt/mynode/webssh2
|
||||||
cp -f /usr/share/mynode/webssh2_config.json /opt/mynode/webssh2/config.json
|
cp -f /usr/share/mynode/webssh2_config.json /opt/mynode/webssh2/config.json
|
||||||
|
|
||||||
|
# Initialize Dynamic Apps
|
||||||
|
mynode-manage-apps init || true
|
||||||
|
|
||||||
# Backup Tor files
|
# Backup Tor files
|
||||||
for f in /var/lib/tor/mynode*; do
|
for f in /var/lib/tor/mynode*; do
|
||||||
rsync --ignore-existing -r -avh $f /mnt/hdd/mynode/tor_backup/ || true
|
rsync --ignore-existing -r -avh $f /mnt/hdd/mynode/tor_backup/ || true
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
{
|
{
|
||||||
"name": "LNDg",
|
"name": "LNDg",
|
||||||
"short_name": "lndg",
|
"short_name": "lndg",
|
||||||
|
"latest_version": "v0.0.1",
|
||||||
"requires_lightning": true,
|
"requires_lightning": true,
|
||||||
"hide_status_icon": false,
|
"hide_status_icon": false,
|
||||||
"app_tile_default_status_text": "Lightning Tool",
|
"app_tile_default_status_text": "Lightning Tool",
|
||||||
|
"app_tile_running_status_text": "Running",
|
||||||
"app_tile_button_href": "/lndg",
|
"app_tile_button_href": "/lndg",
|
||||||
"app_tile_button_text": "Info",
|
"app_tile_button_text": "Info",
|
||||||
"can_uninstall": true,
|
"can_uninstall": true,
|
||||||
"can_enable_disable": false,
|
"can_enable_disable": true,
|
||||||
"show_on_homepage": true,
|
"show_on_application_page": false,
|
||||||
|
"show_on_homepage": false,
|
||||||
|
"port": 3000,
|
||||||
"homepage_order": 99
|
"homepage_order": 99
|
||||||
}
|
}
|
Binary file not shown.
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.8 KiB |
|
@ -0,0 +1,28 @@
|
||||||
|
# LNDg Service
|
||||||
|
# /etc/systemd/system/lndg.service
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=LNDg
|
||||||
|
Wants=www.service docker_images.service
|
||||||
|
After=www.service docker_images.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||||
|
ExecStartPre=/bin/bash -c 'if [ -f /usr/bin/service_pre/pre_lndg.sh ]; then /bin/bash /usr/bin/service_pre/pre_lndg.sh; fi'
|
||||||
|
ExecStart=/usr/bin/docker run --rm --name webssh2 -p 2222:2222 -v /opt/mynode/webssh2/config.json:/usr/src/config.json webssh2
|
||||||
|
ExecStartPost=/bin/bash -c 'if [ -f /usr/bin/service_post/post_lndg.sh ]; then /bin/bash /usr/bin/service_post/post_lndg.sh; fi'
|
||||||
|
ExecStop=/usr/bin/docker stop -t 2 webssh2
|
||||||
|
|
||||||
|
# Need new user
|
||||||
|
User=root
|
||||||
|
Group=root
|
||||||
|
Type=simple
|
||||||
|
TimeoutSec=120
|
||||||
|
Restart=always
|
||||||
|
RestartSec=60
|
||||||
|
StandardOutput=syslog
|
||||||
|
StandardError=syslog
|
||||||
|
SyslogIdentifier=lndg
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -159,10 +159,21 @@ def initialize_applications():
|
||||||
for index, app in enumerate(apps):
|
for index, app in enumerate(apps):
|
||||||
apps[index] = initialize_application_defaults(app)
|
apps[index] = initialize_application_defaults(app)
|
||||||
|
|
||||||
mynode_applications = copy.deepcopy(apps)
|
# Load dynamic app JSON files
|
||||||
|
dynamic_app_dir = get_dynamic_app_dir()
|
||||||
|
dynamic_app_names = get_dynamic_app_names()
|
||||||
|
for app_name in dynamic_app_names:
|
||||||
|
try:
|
||||||
|
app_dir = dynamic_app_dir + "/" + app_name
|
||||||
|
with open(app_dir + "/" + app_name + ".json", 'r') as app_info_file:
|
||||||
|
app = json.load(app_info_file)
|
||||||
|
apps.append(initialize_application_defaults(app))
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
log_message("ERROR: Could not initialize dynamic app {} - {}".format(app_name, str(e)))
|
||||||
|
|
||||||
|
mynode_applications = copy.deepcopy(apps)
|
||||||
|
|
||||||
# TODO: Load all app-specific JSON files
|
|
||||||
# ...
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def update_applications(include_status=False):
|
def update_applications(include_status=False):
|
||||||
|
@ -470,6 +481,11 @@ def init_dynamic_app(app_info):
|
||||||
log_message(" TODO: Build dockerfile???")
|
log_message(" TODO: Build dockerfile???")
|
||||||
log_message(" TODO: Install dockerfile???")
|
log_message(" TODO: Install dockerfile???")
|
||||||
|
|
||||||
|
# Other init
|
||||||
|
log_message(" TODO: Other init")
|
||||||
|
log_message(" TODO: Open Port")
|
||||||
|
log_message(" TODO: More???")
|
||||||
|
|
||||||
log_message(" Done.")
|
log_message(" Done.")
|
||||||
|
|
||||||
def init_dynamic_apps():
|
def init_dynamic_apps():
|
||||||
|
@ -488,4 +504,8 @@ def init_dynamic_apps():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_message(" ERROR: Error loading app.json file ({})".format(str(e)))
|
log_message(" ERROR: Error loading app.json file ({})".format(str(e)))
|
||||||
|
|
||||||
os.system("systemctl daemon-reload")
|
# Reload systemctl files
|
||||||
|
os.system("systemctl daemon-reload")
|
||||||
|
|
||||||
|
# Mark app db for needing reload
|
||||||
|
# TODO: Need to mark this? all json files should be found early
|
BIN
rootfs/standard/var/www/mynode/static/images/app_icons/lndg.png
Normal file
BIN
rootfs/standard/var/www/mynode/static/images/app_icons/lndg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
Loading…
Reference in New Issue
Block a user