startup added to install script and config.py.example added

This commit is contained in:
C
2023-02-13 16:30:09 +05:00
parent 5b43eba14f
commit 2898bea6d2
4 changed files with 56 additions and 2 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ cython_debug/
*.conf
#example files
*.example
#*.example
#nginx conf
nginx/
+38
View File
@@ -0,0 +1,38 @@
# deploy location
deploy_path = 'C:/pixel-streaming'
# git source
git_url_session_server = 'http://212.220.216.185:3000/EgorSuv/pixel-streaming-session-server.git'
git_url_webrtc = 'http://212.220.216.185:3000/EgorSuv/pixel-streaming-webrtc.git'
git_url_lib = 'http://212.220.216.185:3000/EgorSuv/pixel-streaming-lib'
# session server config
env_file_name = '.env'
titles_file_name = 'titles.json'
# coordinator
coordinator_url = 'https://a1.coord.graff.tech'
# local database
local_database_url = 'mongodb://127.0.0.1:27017'
local_database_name = 'pixel_streaming'
# nginx and session server config
session_server_domain = 'a2.sess.graff.tech'
session_server_postfix = 's2'
session_server_ip = '192.168.0.11'
session_server_port = 3005
session_begin_port = 14000
session_limit = 5
webrtc_server_path = '../pixel-streaming-webrtc/WebServers/SignallingWebServer/cirrus.js'
#app format ['title', 'path']
applications = [
['mosharov', 'D:/shared/Builds/mosharov/mosharov-stream-v1/Masharovdev.exe'],
['ivazowsky', 'D:/shared/Builds/mosharov/mosharov-stream-v1/Masharovdev.exe']
]
pm2_name = 'session-server'
+15 -1
View File
@@ -1,6 +1,18 @@
import config
import powershell
import os
import getpass
import pathlib
# startup function
USER_NAME = getpass.getuser()
def add_to_startup(file_path="", file_name=''):
if file_path == "":
file_path = os.path.dirname(os.path.realpath(__file__))
bat_path = r'C:\Users\%s\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup' % USER_NAME
with open(bat_path + '\\' + file_name + ".bat", "w+") as bat_file:
bat_file.write(r'python "%s" %%*' % file_path)
# config
deploy_path = config.deploy_path
@@ -36,8 +48,10 @@ powershell.run_command_no_dir('npm i -g pm2')
# start session server
powershell.run_command('pm2 start app.js --no-treekill --name ' + pm2_name, session_server_root_dir)
powershell.run_command_no_dir('pm2 save')
# add to startup
#################################################################################################################
add_to_startup(os.path.dirname(os.path.abspath(__file__)).replace('\\', '/') + '/startup_script.py', pm2_name)
print('\nPackage added to startup.\n')
print('\nPackage successfully deployed to: ', deploy_path, '\n')
+2
View File
@@ -0,0 +1,2 @@
import powershell
powershell.run_command_no_dir('pm2 resurrect --no-treekill')