How so serve static files in Jira?

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2013

I am looking for a way to serve static files from Jira instance, files that would be stored somewhere inside Jira installation directory.

I was a solution that would not require another web server (like nginx or apache), as they are running on a different machine.

Also, I don't want to include these files inside some custom plugins, as it would be to hard to update them.

3 answers

1 accepted

1 vote
Answer accepted
Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2013

JIRA runs in tomcat. Tomcat is able to serve htm files.

So I would not pollute with html jira application directory but modify it's configuration to also load another empty webapp. On this, configured as a directory near atlassian-jira, I would put all my static files.

Something like (server.xml)

<Context path="" docBase="${catalina.home}/staticwebapp" reloadable="false" useHttpOnly="true">

.....

</Context>

(staticwebapp is a dir near atlassian-jira containing a simple WEB-INF/web.xml)

WARN: not tested, check the tomcat documentation for details.

Jiannan Tang January 21, 2013

Hi, I want to know how do your nginx config.

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2013

The problem is that I am trying to find a solution that will persist across Jira upgrades. As we already know tomcat configuration is lost for each Jira upgrade. Anyway, considering that I am already manually saving the server.xml due to mandatory configuration changes made there (like proxy settings), it should work.

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2013

Not part of the original question: I do want to add some javascript code, so I'm missing another part: hot to inject this file into Jira, without a custom plugin. I am open to suggestions! Thanks Radu!

2 votes
Renjith Pillai
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2013

How about this? Create a project in JIRA with read permission for Anonymous. Add an issue in that project and add your files as attachment. Use the attachment links :)

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2013

That's not a very bad idea, and I could also add a symlink from JIRA_HOME/static/myfile.js to the location of the attachment so I can easily edit the file from the shell, without having to upload the attachment again. The location on disk of the attachment is quite... ugly.

1 vote
Anatoly Mikhaylov February 3, 2014

I've optimized Tomcat by requests multiplexing wiht SPDY, SSL offload and other stuff: https://gist.github.com/mikhailov/8562320

Suggest an answer

Log in or Sign up to answer