initial files

This commit is contained in:
C
2023-02-03 13:29:50 +05:00
parent 10c7d9163d
commit cc0821815e
10 changed files with 122 additions and 1 deletions
+15 -1
View File
@@ -1,2 +1,16 @@
# pixel-streaming-session-server-package
session server installation process:
all paths stored in config.py
1. install everything from "should_install" directory
2. setup session-server config files inside "session_server_config" directory
3. run "start_install_package.py" script with double click or run from powershell with "python" prefix
if everything OK package installed
you can check "session-server" status with following commands: "pm2 status", "pm2 monit", "pm2 logs"
session server configuration change process:
1. change config files inside "session_server_config" directory
2. run "reconfigure_package.py" script with double click or run from powershell with "python" prefix
+6
View File
@@ -0,0 +1,6 @@
deploy_path = 'C:/pixel-streaming'
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"
env_path = '/session_server_config/.env'
titles_path = '/session_server_config/titles.json'
+33
View File
@@ -0,0 +1,33 @@
import config
import lib.powershell as powershell
import shutil
import os
deploy_path = config.deploy_path
env_path = config.env_path
titles_path = config.titles_path
session_server_root_dir = deploy_path + '/pixel-streaming-session-server'
if not os.path.isdir(session_server_root_dir):
print('Package not installed')
exit()
powershell.run_command('pm2 stop app.js', session_server_root_dir)
# copy session server config to destination directory
current_directory_name = os.path.dirname(os.path.abspath(__file__))
session_server_config_file = (current_directory_name + env_path).replace('\\', '/')
session_server_config_destination = deploy_path + '/pixel-streaming-session-server/.env'
os.remove(session_server_config_destination)
shutil.copy(session_server_config_file, session_server_config_destination)
# copy session server titles config to destination directory
session_server_titles_file = (current_directory_name + titles_path).replace('\\', '/')
session_server_titles_destination = deploy_path + '/pixel-streaming-session-server/titles.json'
os.remove(session_server_titles_destination)
shutil.copy(session_server_titles_file, session_server_titles_destination)
powershell.run_command('pm2 restart app.js', session_server_root_dir)
print('\nPackage successfully reconfigured.\n')
+6
View File
@@ -0,0 +1,6 @@
[
{
"title":"only-dev-test-mosharov",
"path":"D:/shared/Builds/mosharov/mosharov-stream-v1/Masharovdev.exe"
}
]
Binary file not shown.
Binary file not shown.
Binary file not shown.
+51
View File
@@ -0,0 +1,51 @@
import config
import lib.powershell as powershell
import shutil
import os
# config
deploy_path = config.deploy_path
git_url_session_server = config.git_url_session_server
git_url_webrtc = config.git_url_webrtc
env_path = config.env_path
titles_path = config.titles_path
if os.path.isdir(deploy_path):
print('Package already installed in: ', deploy_path)
exit(1)
# clone required repositories
powershell.run_command_no_dir('mkdir ' + deploy_path)
powershell.run_command('git clone ' + git_url_session_server, deploy_path)
powershell.run_command('git clone ' + git_url_webrtc, deploy_path)
# clone submodules
session_server_library = deploy_path + '/pixel-streaming-session-server/lib'
powershell.run_command('git submodule init', session_server_library)
powershell.run_command('git submodule update', session_server_library)
# install node_modules
session_server_root_dir = deploy_path + '/pixel-streaming-session-server'
powershell.run_command('npm install', session_server_root_dir)
powershell.run_command('npm install', deploy_path + '/pixel-streaming-webrtc/WebServers/SignallingWebServer')
# copy session server config to destination directory
current_directory_name = os.path.dirname(os.path.abspath(__file__))
session_server_config_file = (current_directory_name + env_path).replace('\\', '/')
session_server_config_destination = deploy_path + '/pixel-streaming-session-server/.env'
shutil.copy(session_server_config_file, session_server_config_destination)
# copy session server titles config to destination directory
session_server_titles_file = (current_directory_name + titles_path).replace('\\', '/')
session_server_titles_destination = deploy_path + '/pixel-streaming-session-server/titles.json'
shutil.copy(session_server_titles_file, session_server_titles_destination)
# install pm2 for application management
powershell.run_command_no_dir('npm i -g pm2')
# start session server
powershell.run_command('pm2 start app.js', session_server_root_dir)
print('\nPackage successfully deployed to: ', deploy_path, '\n')
+11
View File
@@ -0,0 +1,11 @@
import config
import lib.powershell as powershell
import os
deploy_path = config.deploy_path
if os.path.isdir(deploy_path):
powershell.run_command_no_dir('pm2 delete all; rm "' + deploy_path + '" -r -force;')
print('Package successfully removed')
else:
print('Package not installed')