How to bundle multiple apps in a single file with no system image

Our code consists of 5 apps that communicate with each other via shared memory. We currently do updates by sending down 5 .update files, each one made with mkapp. We’d like to have just one file that contains the 5 apps.

I tried specifying the 5 programs in the “executable” section of the adef file, and also specifying those same programs in the “processes->run” section of the adef file. That worked, but it looks like a single app to the Legato system. I am unable to use “app stop” to stop just one component of our system.

I tried using mksys, and that did provide 5 separate apps, but it also included a system image which makes the file 40 times bigger!

Is there a way to build a .update file which contains 5 separate apps, and no system image?

Thanks!

Ken

you can combine those 5 apps into one legato app, just like what you did to specify 5 programs in the “executable” section of the adef file, but also specify “start: manual” to manually start the application.

After that you can run each component by “app runProc”
e.g.
app runProc hello1 hello1 --exe=hello1 &
app runProc hello1 hello2 --exe=hello1 &

To stop the component, you can find out the pid and kill the process.




root@swi-mdm9x28-wp:~# app runProc hello1 hello1 --exe=hello1 &
root@swi-mdm9x28-wp:~# ps aux | grep hello
root      4439  0.1  0.6   3156  1036 pts/0    S    08:14   0:00 app runProc hello1 hello1 --exe=hello1
root      4440  0.1  0.6   3048  1072 ?        S    08:14   0:00 hello1
root      4524  0.0  0.3   2324   516 pts/0    S+   08:14   0:00 grep hello
root@swi-mdm9x28-wp:~# app runProc hello1 hello2 --exe=hello1 &
root@swi-mdm9x28-wp:~# ps aux | grep hello
root      4439  0.0  0.6   3156  1036 pts/0    S    08:14   0:00 app runProc hello1 hello1 --exe=hello1
root      4440  0.0  0.6   3048  1072 ?        S    08:14   0:00 hello1
root      4532  0.3  0.6   3156  1036 pts/0    S    08:15   0:00 app runProc hello1 hello2 --exe=hello1
root      4533  0.3  0.6   3048  1076 ?        S    08:15   0:00 hello2
root      4555  0.0  0.3   2324   516 pts/0    S+   08:15   0:00 grep hello
root@swi-mdm9x28-wp:~# kill 4533
[2]+  Done                       app runProc hello1 hello2 --exe=hello1

root@swi-mdm9x28-wp:~# ps aux | grep hello
root      4439  0.0  0.6   3156  1036 pts/0    S    08:14   0:00 app runProc hello1 hello1 --exe=hello1
root      4440  0.0  0.6   3048  1072 ?        S    08:14   0:00 hello1
root      4850  0.0  0.3   2324   516 pts/0    S+   08:15   0:00 grep hello


root@swi-mdm9x28-wp:~# app status
[running] atAirVantage
[running] atQmiLinker
[running] atService
[running] audioService
[running] avcService
[running] cellNetService
[running] dataConnectionService
[running] fwupdateService
[running] gpioService
[running] modemService
[running] portService
[running] positioningService
[running] powerMgr
[running] qmiAirVantage
[running] secStore
[stopped] smsInboxService
[stopped] spiService
[stopped] tools
[stopped] voiceCallService
[stopped] wifi
[stopped] wifiApTest
[stopped] wifiClientTest
[running] wifiService
[stopped] wifiWebAp
[stopped] atServerIntegrationTest
[running] hello1

Thanks for the reply. I tried using app runProc on my system, but it doesn’t exist. Is it a new feature in the R15 release? We haven’t moved to that yet.

Also, the start:manual step is not what we want. Unless your’e suggesting start:manual when doing a debugging build? But we were hoping for a way to do this for debugging on a production system. We also specify faultAction: restartApp for the processes, so I’m guessing if I kill them, they will just restart.

Our dream would be something like the output of mksys, but without the system update part. But my testing seems to indicate that is not possible.

Let me know if you have any other nuggets of information to share.

Thanks!.

Ken

“app runProc” is basic command in legato

Btw, for your original trial, have you tried the kill the pid of your 5 components? Can it be stopped?

In my test, I don’t see problem to just kill one component:


root@swi-mdm9x28-wp:~# ps aux | grep hello
apphell+  2373  0.0  0.6   3048  1068 ?        S    08:04   0:00 hello1
apphell+  2374  0.0  0.6   3048  1060 ?        S    08:04   0:00 hello2
root      2611  0.0  0.3   2324   516 pts/0    S+   08:04   0:00 grep hello
root@swi-mdm9x28-wp:~# killall hello2
root@swi-mdm9x28-wp:~# ps aux | grep hello
apphell+  2373  0.0  0.6   3048  1068 ?        S    08:04   0:00 hello1
root      2788  0.0  0.3   2324   516 pts/0    S+   08:05   0:00 grep hello
root@swi-mdm9x28-wp:~# app status
[running] atAirVantage
[running] atQmiLinker
[running] atService
[running] audioService
[running] avcService
[running] cellNetService
[running] dataConnectionService
[running] fwupdateService
[running] gpioService
[running] modemService
[running] portService
[running] positioningService
[running] powerMgr
[running] qmiAirVantage
[running] secStore
[stopped] smsInboxService
[stopped] spiService
[stopped] tools
[stopped] voiceCallService
[stopped] wifi
[stopped] wifiApTest
[stopped] wifiClientTest
[running] wifiService
[stopped] wifiWebAp
[stopped] atServerIntegrationTest
[running] hello1

Here is my .adef file:



//start: manual
executables:
{
	hello1 = ( hello1Component )
	hello2 = ( hello1Component )
}

processes:
{
	envVars:
	{
		LE_LOG_LEVEL = DEBUG
	}

	run:
	{
		( hello1 )
		( hello2)
	}

	maxCoreDumpFileBytes: 512K
	maxFileBytes: 512K
	
	
	//faultAction: reboot
	faultAction: restartApp 
}

version: 1.0.0
maxFileSystemBytes: 512K

sandboxed: true

Hi Ken, did you find a solution? We have 4 apps to deploy; and would like to deploy as a set (without the system image).
I have been trying to see if AirVantage might support this somehow; but no joy yet. “Workflow” shows “Install Application” step-types in the manual… that appeared promising; but that step isn’t available when I login.
Regards, Mike

Mike,

We ended up going with a single .adef file that listed all 5 of our apps, in both the “executables” section and the “processes->run” section. We also changed the faultAction: flag from “restartApp” to “restart”. That way, if one of the 5 executables crashes, it just restarts that process, not all 5 processes.

After some internal discussion, we decided we really liked the fact that all 5 executables get installed and restarted as a unit. It really simplified deployment and versioning of our software. The only downsides are we can no longer just stop one of the processes, which we would sometimes do when debugging a problem. If we kill the executable with the kill command, it will get just restarted, so we now have to to “app stop <app_name>” to stop all 5 processes when debugging certain problems. But that’s not a issue for us. We just need to remember to use a different command now when we need to stop our app.

That other downside is we cannot update just one of the executables via AirVantage. We have to send down the entire combined app, even is only one executable is different. But it does make building a release easier, and there is much less of a chance of installing different releases of the 5 executables in our app.

Pros and cons to both.
We can’t do single ADEF, because one of the “control” app is set to reboot-if-fail… last ditch attempt to recover. The other 3 send the “control” app heartbeats; they only have restartApp behaviour… and are optional… and etc…
Pity. The rest of Legato is wonderfully architected, so this seems to be a rare oversight.