The 1000 steps program to MDriven Chapter 14
No edit summary
No edit summary
Line 1: Line 1:
Chapter 14
This is Chapter 14. If you are want to go back to the beginning, [[The 1000 steps program to MDriven|you can find it here: Chapter 1]].


Back to chapter 13:[[The_1000_steps_program_to_MDriven_Chapter_13]]
Go back to chapter 13:[[The_1000_steps_program_to_MDriven_Chapter_13]]


In this chapter we go over the installation and initial use of the MDrivenServer for development. The MDrivenServer makes your application enterprise grade and allows you to connect to your own database with a connection string. The MDrivenServer understands your model and offloads you of all the hassle to keep your db-schema compatible with your system needs.
In this chapter, we'll go over the installation and initial use of the MDrivenServer for development. The MDrivenServer makes your application enterprise-grade and allows you to connect to your own database with a connection string. The MDrivenServer understands your model and offloads you of all the hassle to keep your DB-schema compatible with your system needs.


Video: https://youtu.be/c7bTqDWC-bU
Here's the link for Chapter 14: https://youtu.be/c7bTqDWC-bU


407 Press play button - start Turnkey prototyper
'''Video 14: MDrivenEducationVideo Chapter 14'''


408 Find the xml file that stores the data
407. Press the play button and start the Turnkey prototyper.


409 Open the xml file with notepad and take a look to see that you recongnise it
408. Find the XML file that stores the data.


410 Open the Cloud-connection dialog from the toolbar
409. Open the XML file with notepad and take a look to see that you recognize it.


411 Download the latest for Local servers
410. Open the Cloud-connection dialog from the toolbar.


412 Add a server-pair - server1
411. Download the latest for Local servers.


413 Refresh the install to Server1
412. Add a server-pair - server1


414 Open the install folder and make sure you see the files
413. Refresh the install to Server1


415 Add another server-pair server2
414. Open the install folder and make sure you see the files.


416 Refresh install for server2
415. Add another server-pair: server2


417 Start Server1
416. Refresh the install for server2


418 Ensure you see 2 command windows, one for MDrivenServer and one for TurnkeyServer
417. Start Server1


419 Try and press start servers again to verify that the server pair re-starts
418. Ensure you see 2 command windows, one for the MDrivenServer and one for the TurnkeyServer.


420 Start Server2 - ensure you see 2 new cmd windows
419. Try to press start servers again to verify that the server pair re-starts.


421 Pick the Server1's MDrivenServer as the active MDrivenServer by first switching tab to "Active MDriven Server"
420. Start Server2. Ensure you see 2 new cmd windows.


422 Then type in the address of the MDrivenServer <nowiki>http://localhost:5000</nowiki>, also type user a and pwd 123456
421. Pick Server1's MDrivenServer as the active MDrivenServer by first switching the tab to "Active MDriven Server".


423 Press Check Server status - verify that it says "Never started, No current version"
422. Type in the address of the MDrivenServer <nowiki>http://localhost:5000</nowiki> - also, type user a and password: 123456


424 Head back to the "Local Servers" - tab, use the "Use above MDrivenServer" button to choose Active MDriven Server
423. Press Check Server status. Verify that it says "Never started, No current version".


425 Try to start the Server2-pair, choose it as Active - check its Server status
424. Head back to the "Local Servers" - tab and use the "Use above MDrivenServer" button to choose Active MDriven Server.


426 Stop the cmd-windows for the Server2-pair (port 5002 and 5003) - now press "Check server status" again
425. Try to start the Server2-pair. Choose it as Active and check its Server status.


427 Verify you get the expected Time out due to the server addressed being closed
426. Stop the cmd-windows for the Server2-pair (port 5002 and 5003). Now click on "Check server status" again.


428 Switch back to "Local servers"-tab, pick Server1 - click Use Above MDrivenServer
427. Verify you get the expected timeout due to the server address being closed.


429 Verify that the green indicator shows <nowiki>http://localhost:5000</nowiki>
428. Switch back to the "Local servers"-tab, pick Server1 - click Use Above MDrivenServer.


430 press "Upload model" button - this will upload your current model to the active MDrivenServer
429. Verify that the green indicator shows <nowiki>http://localhost:5000</nowiki>


431 press "Check Server Status" button - if you do it too quick after upload you will not get full result - if so click again
430. Press "Upload model" button. This will upload your current model to the active MDrivenServer.


432 Verify the returned result states that the database was created for us
431. Press "Check Server Status" button. If you do it too quickly after the upload, you will not get a full result. If you do so, click again.


433 Also press "Update serverside jobs" for good meassure, since we have not covered or defined server side jobs yet - the result will nothing
432. Verify the returned result states that the database was created for us.


434 Go to the MDrivenServer Web-ui by entering <nowiki>http://localhost:5000</nowiki>  in a browser
433. Also, press "Update serverside jobs" for good measure. Since we have not covered or defined server-side jobs yet, the result will be nothing.


435 Log in with a and 12345 (the weak pwd is ok since this server is on localhost and can only be reached by users allowed on your machine )
434. Go to the MDrivenServer Web-UI by entering <nowiki>http://localhost:5000</nowiki> in a browser.


436 Go to Running/Model
435. Login with a and 12345 (the weak password is okay since this server is on localhost and can only be reached by users allowed on your machine).


437 Go to Running in Data in A0, choose Car, Search - verify that there is no data
436. Go to Running/Model.


438 Migrate data into the db , start by pressing play
437. Go to Running in Data in A0, choose Car, Search - verify that there is no data.


439 Start the system with xml persistence
438. Migrate data into the DB. Start by pressing play.


440 Press Migrate, then the Green button inside the migrate window, save the data to migrateToDB.xml
439. Start the system with XML persistence.


441 Close Migrate dialog, switch to MDrivenServer persistence, start the system, press migrate button again
440. Press Migrate, then the Green button inside the migrate window. Save the data to migrateToDB.xml


442 Now choose the pink button - choose the migrateToDB.xml file - the choose the yellow button to save the data.
441. Close Migrate dialog, switch to MDrivenServer persistence, and start the system. Press the migrate button again.  


443 Head back to MDrivenServer web ui, Running/Data in A0/Car search - verify that you now have data
442. Now click on the pink button, choose the migrateToDB.xml file, then select the yellow button to save the data.


444 Double click one of the Cars in the search result - verify you get an AutoForm displaying the data
443. Head back to the MDrivenServer web UI, Running/Data in A0/Car search - verify that you now have the data.


445 Click the "Open" behind BrandOfCar single-link and verify you get the Brand-autoform - showing the data including the image of the brand
444. Double-click one of the Cars in the search result. Verify that you get an AutoForm displaying the data.


446 In the Play- LocalTurnkeyPrototyper-tab switch the "Data" from "Use xml" to "Use MDriven server"
445. Click the "Open" behind BrandOfCar single-link and verify that you get the Brand-AutoForm, showing the data including the image of the brand.


447 Press re-start to apply the changed settings to the Turnkey-prototyper
446. In the Play- LocalTurnkeyPrototyper-tab, switch the "Data" from "Use XML" to "Use MDriven server".


448 In the web-page spawned we may now see an error "Singleton class SysSingleton has multiple instances"
447. Press restart to apply the changed settings to the Turnkey-prototyper.


449 If you see this error use the following steps to fix it - if you do not have the error - follow the steps but avoid any data
448. In the spawned web page, we may now see an error: "Singleton class SysSingleton has multiple instances".


450 The error is an effect of the migration migrated in one instance of SysSingleton, and the system already had one instances of SysSingleton - totalling to 2 - the Singleton-concept does however force us to have only 1 object. In order to fix we much reach in and delete one of the instances of the SysSingleton - leaving only 1 , or zero, because if zero the oclSingleton operator will recreate it for us when first asked for.
449. If you see this error, use the following steps to fix it. If you do not have the error, follow the steps but avoid any data.


451 To remove the extra SysSingleton: Play/MDrivenServer persistence/ start the system - click debugger. Find the SysSingleton in the classes picker - click "Seeker" - search and see the 2 objects, select one of them , click "delete selected" , head back to main debugger form and click save
450. The error is an effect of the migration migrated in one instance of SysSingleton, and the system already had instances of SysSingleton - totalling to 2;  the Singleton-concept does, however, force us to have only 1 object. In order to fix that, we much reach in and delete one of the instances of the SysSingleton, leaving only 1, or 0, because if 0, the oclSingleton operator will recreate it for us when we first ask for it.


452 Now go back to the failed web page and press F5, verify that the app now works as before
451. To remove the extra SysSingleton: Play/MDrivenServer persistence/ start the system - click the debugger. Find the SysSingleton in the classes picker, click "Seeker", search and see the 2 objects. Select one of them, click "delete selected", and head back to the main debugger form. Click save.


453 We are now running against a relational database controlled by the MDrivenServer - this means that we must change the schema (definition of db tables and db columns) in the database whenever we change things in our model. Start by adding a new class Class1 , head over to cload-connection dialog. click "Upload Model"
452. Now go back to the failed web page and press F5. Verify that the app now works as before.


454 Click "Check Server status" - if you get no new feedback - wait 1 second then press again
453. We are now running against a relational database controlled by the MDrivenServer. This means that we must change the schema (definition of DB tables and DB columns) in the database whenever we change things in our model. Start by adding a new class Class1, and head over to the cloud-connection dialog. Click "Upload Model".


455 Verify that the feedback from the server states that a table for storing objects of Class1 has been added to the database for us
454. Click "Check Server status". If you get no new feedback, wait 1 second, then press again.


456 Add a few attributes to the Class1, then upload model again, and verify that the MDrivenServer status says the database schema was changed to accomodate the new attributes
455. Verify that the feedback from the server states that a table for storing objects of Class1 has been added to the database for us.


457 Delete some of the attributes, upload model again - verify that MDrivenServerSTatus indicates that the MDrivenServer has removed columns from the table
456. Add a few attributes to the Class1, then upload the model again, and verify that the MDrivenServer status says the database schema was changed to accommodate the new attributes.


458 Add an association between Class1 and BrandOfCar for example, upload model, verify that MDrivenServerSTatus indicates that the MDrivenServer has added columns to store the foreign key - that will hold the primary key of an object-  that consitutes the association on database level
457. Delete some of the attributes and upload the model again. Verify that MDrivenServerSTatus indicates that the MDrivenServer has removed columns from the table.


459 Now delete this experiment Class1 , upload model and verify that MDrivenServerSTatus indicates that the MDrivenServer has dropped the table for Class1 and also drops the column for the foreign key in BrandOfCar
458. Add an association between Class1 and BrandOfCar, for example. Upload the model and verify that MDrivenServerSTatus indicates that the MDrivenServer has added columns to store the foreign key - which will hold the primary key of an object-  that constitutes the association on database level.


460 To learn more about the mdrivenserver - go to wiki.mdriven.net and look it up by searching MDriven Server
459. Now delete this experimental Class1, upload the model and verify that MDrivenServerSTatus indicates that the MDrivenServer has dropped the table for Class1 and also drops the column for the foreign key in BrandOfCar.


461 When you are ready to deploy your application to a wider audience you will want to run the MDrivenServer and MDrivenTurnkey on a server where your users has access - this may be a companies internal network or on the internet. You can always refer to the wiki.mdriven.net to find out how to install the software on Microsoft Internet Server, or a Azure web application, or run the core servers from linux based servers.
460. To learn more about the MDriven Server, go to: wiki.mdriven.net and look it up by searching MDriven Server.


Next chapter [[The_1000_steps_program_to_MDriven_Chapter_15]]
461. When you are ready to deploy your application to a wider audience, you will want to run the MDrivenServer and MDrivenTurnkey on a server where your users have access. This may be a company's internal network or on the internet. You can always refer to wiki.mdriven.net to find out how to install the software on either a Microsoft Internet Server or an Azure web application or run the core servers from Linux-based servers.
 
'''Next chapter:'''
 
[[The_1000_steps_program_to_MDriven_Chapter_15]]


[[Category:1000 Steps Program]]
[[Category:1000 Steps Program]]

Revision as of 09:41, 24 January 2023

This is Chapter 14. If you are want to go back to the beginning, you can find it here: Chapter 1.

Go back to chapter 13:The_1000_steps_program_to_MDriven_Chapter_13

In this chapter, we'll go over the installation and initial use of the MDrivenServer for development. The MDrivenServer makes your application enterprise-grade and allows you to connect to your own database with a connection string. The MDrivenServer understands your model and offloads you of all the hassle to keep your DB-schema compatible with your system needs.

Here's the link for Chapter 14: https://youtu.be/c7bTqDWC-bU

Video 14: MDrivenEducationVideo Chapter 14

407. Press the play button and start the Turnkey prototyper.

408. Find the XML file that stores the data.

409. Open the XML file with notepad and take a look to see that you recognize it.

410. Open the Cloud-connection dialog from the toolbar.

411. Download the latest for Local servers.

412. Add a server-pair - server1

413. Refresh the install to Server1

414. Open the install folder and make sure you see the files.

415. Add another server-pair: server2

416. Refresh the install for server2

417. Start Server1

418. Ensure you see 2 command windows, one for the MDrivenServer and one for the TurnkeyServer.

419. Try to press start servers again to verify that the server pair re-starts.

420. Start Server2. Ensure you see 2 new cmd windows.

421. Pick Server1's MDrivenServer as the active MDrivenServer by first switching the tab to "Active MDriven Server".

422. Type in the address of the MDrivenServer http://localhost:5000 - also, type user a and password: 123456

423. Press Check Server status. Verify that it says "Never started, No current version".

424. Head back to the "Local Servers" - tab and use the "Use above MDrivenServer" button to choose Active MDriven Server.

425. Try to start the Server2-pair. Choose it as Active and check its Server status.

426. Stop the cmd-windows for the Server2-pair (port 5002 and 5003). Now click on "Check server status" again.

427. Verify you get the expected timeout due to the server address being closed.

428. Switch back to the "Local servers"-tab, pick Server1 - click Use Above MDrivenServer.

429. Verify that the green indicator shows http://localhost:5000

430. Press "Upload model" button. This will upload your current model to the active MDrivenServer.

431. Press "Check Server Status" button. If you do it too quickly after the upload, you will not get a full result. If you do so, click again.

432. Verify the returned result states that the database was created for us.

433. Also, press "Update serverside jobs" for good measure. Since we have not covered or defined server-side jobs yet, the result will be nothing.

434. Go to the MDrivenServer Web-UI by entering http://localhost:5000 in a browser.

435. Login with a and 12345 (the weak password is okay since this server is on localhost and can only be reached by users allowed on your machine).

436. Go to Running/Model.

437. Go to Running in Data in A0, choose Car, Search - verify that there is no data.

438. Migrate data into the DB. Start by pressing play.

439. Start the system with XML persistence.

440. Press Migrate, then the Green button inside the migrate window. Save the data to migrateToDB.xml

441. Close Migrate dialog, switch to MDrivenServer persistence, and start the system. Press the migrate button again.

442. Now click on the pink button, choose the migrateToDB.xml file, then select the yellow button to save the data.

443. Head back to the MDrivenServer web UI, Running/Data in A0/Car search - verify that you now have the data.

444. Double-click one of the Cars in the search result. Verify that you get an AutoForm displaying the data.

445. Click the "Open" behind BrandOfCar single-link and verify that you get the Brand-AutoForm, showing the data including the image of the brand.

446. In the Play- LocalTurnkeyPrototyper-tab, switch the "Data" from "Use XML" to "Use MDriven server".

447. Press restart to apply the changed settings to the Turnkey-prototyper.

448. In the spawned web page, we may now see an error: "Singleton class SysSingleton has multiple instances".

449. If you see this error, use the following steps to fix it. If you do not have the error, follow the steps but avoid any data.

450. The error is an effect of the migration migrated in one instance of SysSingleton, and the system already had instances of SysSingleton - totalling to 2; the Singleton-concept does, however, force us to have only 1 object. In order to fix that, we much reach in and delete one of the instances of the SysSingleton, leaving only 1, or 0, because if 0, the oclSingleton operator will recreate it for us when we first ask for it.

451. To remove the extra SysSingleton: Play/MDrivenServer persistence/ start the system - click the debugger. Find the SysSingleton in the classes picker, click "Seeker", search and see the 2 objects. Select one of them, click "delete selected", and head back to the main debugger form. Click save.

452. Now go back to the failed web page and press F5. Verify that the app now works as before.

453. We are now running against a relational database controlled by the MDrivenServer. This means that we must change the schema (definition of DB tables and DB columns) in the database whenever we change things in our model. Start by adding a new class Class1, and head over to the cloud-connection dialog. Click "Upload Model".

454. Click "Check Server status". If you get no new feedback, wait 1 second, then press again.

455. Verify that the feedback from the server states that a table for storing objects of Class1 has been added to the database for us.

456. Add a few attributes to the Class1, then upload the model again, and verify that the MDrivenServer status says the database schema was changed to accommodate the new attributes.

457. Delete some of the attributes and upload the model again. Verify that MDrivenServerSTatus indicates that the MDrivenServer has removed columns from the table.

458. Add an association between Class1 and BrandOfCar, for example. Upload the model and verify that MDrivenServerSTatus indicates that the MDrivenServer has added columns to store the foreign key - which will hold the primary key of an object-  that constitutes the association on database level.

459. Now delete this experimental Class1, upload the model and verify that MDrivenServerSTatus indicates that the MDrivenServer has dropped the table for Class1 and also drops the column for the foreign key in BrandOfCar.

460. To learn more about the MDriven Server, go to: wiki.mdriven.net and look it up by searching MDriven Server.

461. When you are ready to deploy your application to a wider audience, you will want to run the MDrivenServer and MDrivenTurnkey on a server where your users have access. This may be a company's internal network or on the internet. You can always refer to wiki.mdriven.net to find out how to install the software on either a Microsoft Internet Server or an Azure web application or run the core servers from Linux-based servers.

Next chapter:

The_1000_steps_program_to_MDriven_Chapter_15

This page was edited 20 days ago on 04/29/2024. What links here