Run java code when Jira server is starting up

Oded Mozesh August 23, 2022

Is it possible to run a code on Jira server startup?

I wrote an addon and when Jira server start running (and the addon is loaded) I need to run a java code that run a process that will run on the server.

 

If I write REST addon, is it run only as a response to REST API calls, or I can run a code at the addon loading such it will store information for the REST responses once required?

I need to collect data before the REST addon is running and available to the users & other part of the addon uses those calls

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 23, 2022

This is probably a bad idea because of the way apps are loaded into the Jira framework.

What problem are you trying to solve with this idea?

Oded Mozesh August 24, 2022

I wrote a python service that run NLP analysis and I want to use it in my addon (for internal use).

So I want that it will start run on Jira server when Jira start running.

I prefer the addon will handle/control/deploy/... all/most of the component in use, by itself without additional installations configurations and customization.

 

I would like to run a Java code that run the Python service on the server.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 24, 2022

This service is separate from Jira, so you don't want to be trying to start it from Jira.

You should be setting up the operating system to start the service when it is needed.

Oded Mozesh August 24, 2022

Thanks Nic,

I aware to this option but I don't agree with you.

I think that if it is possible the addon should be responsible to all the parts it uses.

When an admin user install an addon she/he should not do any additional configurations and customizations outside of Jira except in the configuration page in the Manage Apps section..

 

Of course acceptable solution, if possible, is that during the addon installation it will setup the OS to start the service automatically and won't let Jira do it by itself .... 

 

Other challenge now is to add the addon files that will be deployed to the server (the service) such the user won't do it manually.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 25, 2022

I think there is some confusion about what you are trying to do here, and hence how.

There are two pieces of software interacting here.

  • You have an app (plugin) for Jira that needs to talk to a service to do its job.
  • You have an application, running a service, the one that the app talks to.

The service is not part of Jira, it is external, despite the fact it's going to be talking to something within your Jira, it is an independent entity.

If you were to try to start it from within Jira, you've got a whole pile of problems you'll need to think about - does the Jira user have the right to control other services?  (Your security people will give you the answer "no", a Jira user should never have permissions beyond "running Jira").  How are you going to make the call to shut the service down when Jira halts?  Or if it halts?  Do you really want to make a service dependent on another internally? (again, no, you don't)

>When an admin user install an addon she/he should not do any additional configurations and customizations outside of Jira except in the configuration page in the Manage Apps section..

Yep, I agree.  But your app and service are installed and configured in different ways.  Your app is inside Jira, and that's fine, but your service should be installed (and configured, if it needs it) by an admin on the server that is going to host it

In short, for installing the service, you will need to talk to your server administrators about how best they would like to install and configure it, and then how they would like you to be able to control it in the services setup.

Suggest an answer

Log in or Sign up to answer