How to start instances at payara launch or after a reboot

30 views
Skip to first unread message

theirman

unread,
Aug 30, 2019, 8:57:38 AM8/30/19
to Payara Forum
Hello

I would like to know how to make sure that my instances in payara are started at the same time as the payara service is restarted (at reboot for example). 
Currently, after a reboot, they remain in the "stopped" state

Thank you in advance
Thierry

theirman

unread,
Sep 2, 2019, 5:41:51 AM9/2/19
to Payara Forum
I try to start my domain as follows:

${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} start-domain --postbootcommandfile=/apps/payara/scripts/postbootcommandfile.asa ${DOMAIN_NAME}

In my /data/apps/payara/scripts/postbootcommandfile.asa, i write :

start-local-instance --node localhost-production --sync normal instance-production-1
start
-local-instance --node localhost-production --sync normal instance-production-2
start
-local-instance --node localhost-production --sync normal instance-production-3
start
-local-instance --node localhost-production --sync normal instance-production-4
start
-local-instance --node localhost-production --sync normal instance-recette-1
start
-local-instance --node localhost-production --sync normal instance-recette-2

Am I on the right track according to you?

theirman

unread,
Sep 2, 2019, 7:55:33 AM9/2/19
to Payara Forum

[#|2019-09-02T13:52:08.145+0200|AVERTISSEMENT|Payara 5.192|fish.payara.boot.runtime.BootCommand|_ThreadID=1;_ThreadName=main;_TimeMillis=1567425128145;_LevelValue=900;|
  Boot Command start-local-instance failed Exception while executing command. |#]

[#|2019-09-02T13:52:08.146+0200|AVERTISSEMENT|Payara 5.192|fish.payara.boot.runtime.BootCommand|_ThreadID=1;_ThreadName=main;_TimeMillis=1567425128146;_LevelValue=900;|
  Boot Command start-local-instance failed Exception while executing command. |#]

[#|2019-09-02T13:52:08.146+0200|AVERTISSEMENT|Payara 5.192|fish.payara.boot.runtime.BootCommand|_ThreadID=1;_ThreadName=main;_TimeMillis=1567425128146;_LevelValue=900;|
  Boot Command start-local-instance failed Exception while executing command. |#]

[#|2019-09-02T13:52:08.146+0200|AVERTISSEMENT|Payara 5.192|fish.payara.boot.runtime.BootCommand|_ThreadID=1;_ThreadName=main;_TimeMillis=1567425128146;_LevelValue=900;|
  Boot Command start-local-instance failed Exception while executing command. |#]

[#|2019-09-02T13:52:08.147+0200|AVERTISSEMENT|Payara 5.192|fish.payara.boot.runtime.BootCommand|_ThreadID=1;_ThreadName=main;_TimeMillis=1567425128147;_LevelValue=900;|
  Boot Command start-local-instance failed Exception while executing command. |#]

[#|2019-09-02T13:52:08.147+0200|AVERTISSEMENT|Payara 5.192|fish.payara.boot.runtime.BootCommand|_ThreadID=1;_ThreadName=main;_TimeMillis=1567425128147;_LevelValue=900;|
  Boot Command start-local-instance failed Exception while executing command. |#]

Matt Gill

unread,
Sep 3, 2019, 5:46:59 AM9/3/19
to Payara Forum
Hi Thierry,

You're definitely on the right track, although due to the order in which the domain starts up, the correct command to run is `start-instance`. As far as I am aware, the `start-local-instance` command runs without a server and the post boot commands have been sent directly to the server. This means that the server isn't actually aware of the `start-local-instance` command, so won't be able to find it. Let me know if this works for you.

This did however lead me to a bug: the server doesn't seem to be printing the exception. Because of this, I've made a PR here: https://github.com/payara/Payara/pull/4193.

Kind regards,

Matt

theirman

unread,
Sep 4, 2019, 5:34:13 AM9/4/19
to Payara Forum
Hi Matt,

I tried to replace my start-local-instance commands with start-instance commands but it doesn't work any better. 
My instances remain stopped at the reboot

theirman

unread,
Sep 4, 2019, 5:53:08 AM9/4/19
to Payara Forum
[#|2019-09-04T11:52:28.602+0200|AVERTISSEMENT|Payara 5.192|fish.payara.boot.runtime.BootCommand|_ThreadID=1;_ThreadName=main;_TimeMillis=1567590748602;_LevelValue=900;|
  Boot Command start-instance failed Exception while executing command. |#]

[#|2019-09-04T11:52:28.605+0200|AVERTISSEMENT|Payara 5.192|fish.payara.boot.runtime.BootCommand|_ThreadID=1;_ThreadName=main;_TimeMillis=1567590748605;_LevelValue=900;|
  Boot Command start-instance failed Exception while executing command. |#]

[#|2019-09-04T11:52:28.606+0200|AVERTISSEMENT|Payara 5.192|fish.payara.boot.runtime.BootCommand|_ThreadID=1;_ThreadName=main;_TimeMillis=1567590748606;_LevelValue=900;|
  Boot Command start-instance failed Exception while executing command. |#]

[#|2019-09-04T11:52:28.606+0200|AVERTISSEMENT|Payara 5.192|fish.payara.boot.runtime.BootCommand|_ThreadID=1;_ThreadName=main;_TimeMillis=1567590748606;_LevelValue=900;|
  Boot Command start-instance failed Exception while executing command. |#]

[#|2019-09-04T11:52:28.607+0200|AVERTISSEMENT|Payara 5.192|fish.payara.boot.runtime.BootCommand|_ThreadID=1;_ThreadName=main;_TimeMillis=1567590748607;_LevelValue=900;|
  Boot Command start-instance failed Exception while executing command. |#]

[#|2019-09-04T11:52:28.607+0200|AVERTISSEMENT|Payara 5.192|fish.payara.boot.runtime.BootCommand|_ThreadID=1;_ThreadName=main;_TimeMillis=1567590748607;_LevelValue=900;|
  Boot Command start-instance failed Exception while executing command. |#]

theirman

unread,
Sep 4, 2019, 6:04:27 AM9/4/19
to Payara Forum
I did it !!!

I have created two deployment groups:
- group-recette containing instances from instance-recette-1 to instance-recette-2
- group-production containing instances from instance-production-1 to instance-production-2

in my postbootcommandfile.asa file, I now only have :


start
-deployment-group group-recette
start
-deployment-group group-production



and it works !!
Reply all
Reply to author
Forward
0 new messages