Hello! Alexey Matveev here.
If you develop a Jira app, you use Atlassian SDK. If you want to test your app, you run Atlassian Jira from Atlassian SDK. In this article, I’ll show you how to combine those steps and run a Jira instance from Atlassian SDK in a docker container.
To repeat the steps in this tutorial, you need to have docker installed on your PC.
Build docker image
To build a docker image, you need a Dockerfile. Here’s an example of a Dockerfile (you can find it here):
What is going on in this docker file?
This line says that I’m building this image from the openjdk:11 image, which means that I will have openjdk 11 installed. If you want to use another version of Java, then use something like this to use openjdk 8:
or something like this:
In this case, you will use Oracle JDK 8.
This line does the job. It installs the latest version of Atlassian SDK to our new image. If you want to use a certain version of Atlassian SDK, then change it to this one:
Ok. Done with the Dockerfile. Let’s build our image.
Move to the folder where this Dockerfile is placed and run the following command:
As a result of the command, an image with tag “atlassian-sdk” will be created. If you want to tag your image somehow else then replace Atlassian-SDK with your own name.
Here is the output of the build command in my PC:
Use this image
Let’s run a standalone Jira with this image:
After Jira is started you can see the following messages:
You can open http://localhost:2990/jira in your browser and see this Jira instance running in docker:
Now we can try to install our plugin to this instance.
Go to the folder of your plugin and run the following command:
After some time of working I have the following output:
Now open manage apps in your Jira instance and you should see the plugin there:
As you can see the sil-groovy-runner app is there. But why is it disabled?
I believe in your case it will be enabled. In my case, this app should be installed on a Jira instance with SIL® Engine available. I do have this dependency in the pom.xml, and I run my app, not through the atlas-run-standalone command but atlas-debug command. How do you do it?
Stop the current container and remove it.
Run with atlas-debug
Move to the folder of your app and run the following command:
Here we mount the folder of our app to the /opt/atlas folder in the container and run atlas-debug from this folder in the container. Also, we mount 2990 and 5005 ports so that you would be able to use those ports from the host. 5005 is needed to debug your app.
After Jira is launched, open http://localhost:2990/jira in your browser and go to Manage Apps.
Our plugin is installed and enabled.
Now, let’s try to make a change to our app and see if the change will be seen in the docker.
Let’s open Groovy Editor in my app:
Before the Groovy Editor text field, let’s write WELCOME!
I made changes to the code and saved the file. Note: I made changes to a soy template which is why I don’t have to package my app. The changes should be visible now. Like so:
Success! Everything works as expected. Reach out if you find any issues that you need help to resolve.
Last updated: 2023-02-01