MDriven on Synology
m ((username removed) (log details removed))
No edit summary
Line 1: Line 1:
== How to run MDriven on a Synology box ==
== How to run MDriven on a Synology box ==
This guide will help you to get up and running with MDriven server and MDriven Turnkey environment on a Synology DSM. Since the synology has the ability to run MariaDB with an easy install from the built-in package center we will assume this would be the best solution. There is also an option to run the database in docker then we can choose for ex PostgreSQL
This guide will help you get up and running with MDriven Server and MDriven Turnkey environment on a Synology DSM. Since the synology has the ability to run MariaDB with an easy install from the built-in package center, we will assume this would be the best solution. There is also an option to run the database in Docker - then we can choose for ex PostgreSQL.


=== Preparations ===
=== Preparations ===
Download the latest MDriven Core Server and Turnkey binaries for Linux from [[mdriven.net]] and [https://dotnet.microsoft.com/en-us/download/dotnet ASP.NET] Core Runtime x64 for Linux
Download the latest MDriven Core Server and Turnkey binaries for Linux from [https://mdriven.net/ mdriven.net] and [https://dotnet.microsoft.com/en-us/download/dotnet ASP.NET] Core Runtime x64 for Linux


Create a new share on the synology box ex [\\synology\webapp ] where we will run the MDriven application from.  
Create a new share on the synology box ex [\\synology\webapp ] where we will run the MDriven application from.  


If Maria DB is not installed add it from Package center or add your flavor of database as an docker image.
If Maria DB is not installed, add it from Package center, or add your flavor of database as an Docker image.


==== Install ASP.NET Core Runtime ====
==== Install ASP.NET Core Runtime ====
Connect to your synology thru SSH, this assume you have [https://kb.synology.com/sv-se/DSM/tutorial/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet enabled SSH] on you synology box
Connect to your synology through SSH. This assumes you have [https://kb.synology.com/sv-se/DSM/tutorial/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet enabled SSH] on you synology box.


You will now install asp.net by extract the tar.gz-file and add path to environment variable.<syntaxhighlight lang="bash">
You will now install asp.net by extracting the tar.gz-file and adding a path to environment variable.<syntaxhighlight lang="bash">
mkdir -p /usr/local/bin/dotnet && tar zxf aspnetcore-runtime-8.0.3-linux-x64.tar.gz -C /usr/local/bin/dotnet
mkdir -p /usr/local/bin/dotnet && tar zxf aspnetcore-runtime-8.0.3-linux-x64.tar.gz -C /usr/local/bin/dotnet
export DOTNET_ROOT=/usr/local/bin/dotnet
export DOTNET_ROOT=/usr/local/bin/dotnet
Line 36: Line 36:
dotnet /volume1/webapp/myApp/MDServer/AppCompleteGenericCore.dll -port=5010 -nohttps
dotnet /volume1/webapp/myApp/MDServer/AppCompleteGenericCore.dll -port=5010 -nohttps
dotnet /volume1/webapp/myApp/MDTurnkey/StreaminAppCoreWebApp.dll -port=5011 -nohttps
dotnet /volume1/webapp/myApp/MDTurnkey/StreaminAppCoreWebApp.dll -port=5011 -nohttps
</syntaxhighlight>''if using notepad++ be shore to end line in unix (LF), Edit -> EOL Conversion->Unix''Configuration
</syntaxhighlight>''If you're using Notepad++, be sure to end line in unix (LF), Edit -> EOL Conversion->Unix''Configuration


Create a Triggered Task that will run at boot time in your Synology box by navigating to Controll Panel -> Task Scheduler
Create a Triggered Task that will run at boot time in your Synology box by navigating to Controll Panel -> Task Scheduler


Run your script as follow <code>/bin/bash /volume1/webapp/myApp/run.sh</code>
Run your script as follows: <code>/bin/bash /volume1/webapp/myApp/run.sh</code>


==== Configure MDriven Server ====
==== Configure MDriven Server ====
Now you are ready to browse to your MDriven server on https://synology:5010 and set up your MySQL database with connection string.
Now you are ready to browse to your MDriven Server on https://synology:5010 and set up your MySQL database with connection string.


<code>Server=localhost;Port=3306;Database=myApp;Uid=myAppUser;Pwd=myPassword;</code>
<code>Server=localhost;Port=3306;Database=myApp;Uid=myAppUser;Pwd=myPassword;</code>


As always we have to configure MdrivenServerOverride.xml and TurnkeySettingsOverride.xml to make sure we have smooth process of upgrading the servers.
As always, we have to configure MdrivenServerOverride.xml and TurnkeySettingsOverride.xml to make sure we have a smooth process of upgrading the servers.


''MySQL/MariaDB: unfortunately, there may be a bug between some versions of the MySQL connector and MySQL server. which may result in an error when uploading your model.''
MySQL/MariaDB: ''Unfortunately, there may be a '''bug''' between <u>some</u> versions of the MySQL connector and MySQL server which may result in an error when uploading your model.''


 
<nowiki>*</nowiki>Extended run.sh that will restart the application if it is currently running:<syntaxhighlight lang="bash">
 
<nowiki>*</nowiki>Extended run.sh that will restart the application if it currently running<syntaxhighlight lang="bash">
#!/bin/bash /volume1/webapp/myApp/run.sh
#!/bin/bash /volume1/webapp/myApp/run.sh
clear
clear

Revision as of 07:45, 22 April 2024

How to run MDriven on a Synology box

This guide will help you get up and running with MDriven Server and MDriven Turnkey environment on a Synology DSM. Since the synology has the ability to run MariaDB with an easy install from the built-in package center, we will assume this would be the best solution. There is also an option to run the database in Docker - then we can choose for ex PostgreSQL.

Preparations

Download the latest MDriven Core Server and Turnkey binaries for Linux from mdriven.net and ASP.NET Core Runtime x64 for Linux

Create a new share on the synology box ex [\\synology\webapp ] where we will run the MDriven application from.

If Maria DB is not installed, add it from Package center, or add your flavor of database as an Docker image.

Install ASP.NET Core Runtime

Connect to your synology through SSH. This assumes you have enabled SSH on you synology box.

You will now install asp.net by extracting the tar.gz-file and adding a path to environment variable.

mkdir -p /usr/local/bin/dotnet && tar zxf aspnetcore-runtime-8.0.3-linux-x64.tar.gz -C /usr/local/bin/dotnet
export DOTNET_ROOT=/usr/local/bin/dotnet
export PATH=$PATH:/usr/local/bin/dotnet

Initiate a database

For mySQL: Create database MyApp and user myAppUser in mySQL

mysql -p -u root

CREATE DATABASE myApp;
CREATE USER myAppUser@localhost IDENTIFIED BY 'myPassword'; GRANT ALL PRIVILEGES ON myApp.* TO myAppUser@localhost;

Setup MDriven

Extract Mdriven Turnkey Core for Linux into \\synology\webapp\myApp\MDTurnkey

Extract Mdriven Server Core for Linux into \\synology\webapp\myApp\MDServer

Create a scriptfile run.sh* that will be used to start the MDriven environment.

Save it together with your application on \\synology\webapp\myApp\

dotnet /volume1/webapp/myApp/MDServer/AppCompleteGenericCore.dll -port=5010 -nohttps
dotnet /volume1/webapp/myApp/MDTurnkey/StreaminAppCoreWebApp.dll -port=5011 -nohttps

If you're using Notepad++, be sure to end line in unix (LF), Edit -> EOL Conversion->UnixConfiguration

Create a Triggered Task that will run at boot time in your Synology box by navigating to Controll Panel -> Task Scheduler

Run your script as follows: /bin/bash /volume1/webapp/myApp/run.sh

Configure MDriven Server

Now you are ready to browse to your MDriven Server on https://synology:5010 and set up your MySQL database with connection string.

Server=localhost;Port=3306;Database=myApp;Uid=myAppUser;Pwd=myPassword;

As always, we have to configure MdrivenServerOverride.xml and TurnkeySettingsOverride.xml to make sure we have a smooth process of upgrading the servers.

MySQL/MariaDB: Unfortunately, there may be a bug between some versions of the MySQL connector and MySQL server which may result in an error when uploading your model.

*Extended run.sh that will restart the application if it is currently running:

#!/bin/bash /volume1/webapp/myApp/run.sh
clear
BLUE='\033[0;34m'
printf "${BLUE}STARTING MDRIVEN ENVIRONMENT\n\n"
APPNAME=myApp
TURNKEYPORT=5011
SERVERPORT=5010

# Kill process to restart webapplications
netstat -lpn | grep ":$TURNKEYPORT" | awk '{sub(/\/.*/, "", $NF); print $NF}' | xargs -i kill -kill {}
netstat -lpn | grep ":$SERVERPORT" | awk '{sub(/\/.*/, "", $NF); print $NF}' | xargs -i kill -kill {}

# Start MDriven Environment
sleep 1s
cd /volume1/webapp/myApp/MDServer
/usr/local/bin/dotnet/dotnet /volume1/webapp/myApp/MDServer/AppCompleteGenericCore.dll -port=$SERVERPORT -nohttps &
sleep 15s
cd /volume1/webapp/myApp/MDTurnkey
/usr/local/bin/dotnet/dotnet /volume1/webapp/myApp/MDTurnkey/StreaminAppCoreWebApp.dll -port=$TURNKEYPORT -nohttps &
printf "${BLUE}RUNNING IN BACKGROUND\n\n"
This page was edited 12 days ago on 04/22/2024. What links here