From 6ccadbe2c2eab883b38862f411958b14f26336f9 Mon Sep 17 00:00:00 2001 From: Rohitesh Gupta <1429138+srkgupta@users.noreply.github.com> Date: Mon, 27 Mar 2023 10:18:06 +0530 Subject: [PATCH] Add Jira Docker development environment (#918) * Add steps to local JIRA server instance --- build/custom.mk | 7 +++++++ docker-compose.yml | 11 +++++++++-- docs/development/environment.md | 28 +++++++++++++++++++++++++--- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/build/custom.mk b/build/custom.mk index f0f4e030a..f2bfd32d7 100644 --- a/build/custom.mk +++ b/build/custom.mk @@ -1,4 +1,7 @@ # Include custom targets and environment variables here + +.DEFAULT_GOAL := all + ifndef MM_RUDDER_WRITE_KEY MM_RUDDER_WRITE_KEY = 1d5bMvdrfWClLxgK1FvV3s4U1tg endif @@ -13,3 +16,7 @@ LDFLAGS += -X "main.BuildHash=$(BUILD_HASH)" LDFLAGS += -X "main.BuildHashShort=$(BUILD_HASH_SHORT)" GO_BUILD_FLAGS = -ldflags '$(LDFLAGS)' + +.PHONY: jira +jira: + docker-compose up diff --git a/docker-compose.yml b/docker-compose.yml index 0e3fbbd0c..b86ec7ecb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,14 @@ version: '3' services: jira: - image: atlassian/jira-software:7 # It is recommended to test with version 7. Most, if not all, compatibility issues between Jira Server/Cloud exist in version 7. - # image: atlassian/jira-software:8 # Test with version 8 as well when adding new webhook handling logic, or introducing a new Jira API call. + container_name: mattermost-jira + image: atlassian/jira-software:latest # It is recommended to test with the latest version 9, as most of the customers are using this version. + # image: atlassian/jira-software:8 # Alternatively you can test with the previous stable version 8 as well. ports: - "8080:8080" + environment: + - JVM_MINIMUM_MEMORY=4096m + - JVM_MAXIMUM_MEMORY=8192m + - JVM_RESERVED_CODE_CACHE_SIZE=1024m + # - ATL_TOMCAT_SCHEME='https' # Enable this in case the Jira Server is being hosted with https + # - ATL_TOMCAT_SECURE='true' # Set 'true' if ATL_TOMCAT_SCHEME is 'https'. diff --git a/docs/development/environment.md b/docs/development/environment.md index 2acd2b6b4..478ff2fef 100644 --- a/docs/development/environment.md +++ b/docs/development/environment.md @@ -8,10 +8,32 @@ Read our documentation about the [Developer Workflow](https://developers.matterm This plugin supports both Jira Server (self-hosted) and Jira Cloud instances. There can be slight differences in behavior between the two systems, so it's best to test with both systems individually when introducing new webhook logic, or adding a new Jira API call. -To test your changes against a local instance of Jira Server, you need [Docker](https://docs.docker.com/install) installed, then you can use the `docker-compose.yml` file in this repository to create a Jira instance. Simply run `docker-compose up` in the directory of the repository, and a new Jira server should start up and be available at http://localhost:8080. It can take a few minutes to start up due to Jira Server's startup processes. If the container fails to start with `exit code 137`, you may need to increase the amount of RAM you are allowing docker to use. +To test your changes against a Jira Cloud instance, we recommend starting a 14-day trial, if you don't have a Jira project to test against. More information can be found here: https://www.atlassian.com/software/jira/try. If you are contributing to a feature that requires multiple Jira instances to be installed, please enable [ServiceSettings.EnableDeveloper](https://docs.mattermost.com/configure/configuration-settings.html#enable-developer-mode) in your server's config in order to circumvent the Enterprise license requirement. -**Note:** You cannot use LOCALHOST to connect the Jira plugin to your server, you can use a proxy if needed. +### Run a local instance of Jira server -To test your changes against a Jira Cloud instance, we recommend starting a 14-day trial, if you don't have a Jira project to test against. More information can be found here: https://www.atlassian.com/software/jira/try. +To test your changes against a local instance of Jira Server, you need [Docker](https://docs.docker.com/install) installed. + +**Pre-requisite** +As per the [sizing recommendations from Jira](https://confluence.atlassian.com/jirakb/jira-server-sizing-guide-975033809.html), it requires atleast a minimum memory of 8GB. Hence it is advised to increase the amount of resources allocated for your Docker to use. Here are the steps on how to do this using Docker Desktop: +- Click on the Settings icon on the Docker Desktop. +- Navigate to Resources section. +- Ensure that the Memory is set to at least to 8GB or more. +- Ensure that the CPUs is set to at least 4 or more. +- Click on Apply and Restart. + +**Setup your local Jira server** +- Run the command `make jira` in the root of the repository to spin up the Jira server. +Note: It can take a few minutes to start up due to Jira Server's startup processes. If the container fails to start with `exit code 137`, you may need to increase the amount of RAM you are allowing docker to use. + +- Once the above command completes, visit the URL http://localhost:8080 to start setting up the Jira Server. +- Select the option "Set it up for me" and click Continue to MyAtlassian. +- Select the option - "Jira Software (Data Center)" from the list of License Types. +- Enter any Organization Name and click on Generate License. +- Click on the "Yes" button on the Confirmation dialog `Please confirm that you wish to install the license key on the following server: localhost`. +- You will then be redirected to setup Administrator account. Enter all the details and click Next. +- Now sit back while the set up completes. It might take a few minutes to complete. + +**Note:** It's important to note that the Jira Server can use localhost, but your MM Site URL cannot be localhost