Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the most concise set of instructions for self hosting #4

Open
dabeeeenster opened this issue Nov 23, 2023 · 6 comments
Open
Assignees

Comments

@dabeeeenster
Copy link
Contributor

People self hosting Flagsmith will need to push their own Forge application with the approriate whitelisted domains.

We should add concise documentation on how to achieve this, starting from:

  • A SaaS Jira project and user account
  • A SaaS Flagsmith Organisation and Project.

i.e. with no Jira marketplace/developer accounts.

@nishant-shah-social
Copy link

nishant-shah-social commented Jul 15, 2024

@dabeeeenster @riceyrice I can help with documenting this as I am currently trying to setup the forge app for our jira organization.
I made following changes in the codebase before deploying and installing the app:-

  • I changed this to our self-hosted flagsmith backend api url
  • I changed this to our self-hosted flagsmith portal url
  • I changed this as well to our self-hosted flagsmith url

With these changes I tried deploying the forge app into our jira site. The installation was successful. I then configured the jira app providing our api token, which was also successful.
Then I tried to map one of our jira projects to a flagsmith project via jira project settings. While trying to do so I received an error saying There was an error in the jira api response
Further I tried debugging the app via forge debug, and saw this error:-

DEBUG   13:01:25.873  8a315e5e-0a78-426f-ab8f-bd8955df554f  {
  "errors": {},
  "errorMessages": [
    "The property flagsmith.project does not exist."
  ],
  "httpStatusCode": {
    "empty": false,
    "present": true
  }
}

If you have any pointers for me around how to fix this, I would highly appreciate it.
Once fixed, I can document all the steps I had to perform to get it working so that others can benefit.

@riceyrice
Copy link
Collaborator

Hi @nishant-shah-social sorry for the delayed response. It looks like you've changed all the necessary places for connecting self-hosted Flagsmith to what I assume is self-hosted Jira? If deploying to SaaS Jira I'd expect you to also need to change the app ID in manifest.yaml - or did you also do that?

The error you're seeing seems like a bug in the Jira integration, though I'm surprised nobody else has seen this. It should not error if the property hasn't been set yet. I can't find anywhere in the code that would output the exact error message you provide. Perhaps something has changed in SaaS Jira, or are you deploying to some other Jira?

I think the relevant code is here if you want to try to add some more debugging:

export const readProjectId = async (jiraContext: JiraContext): Promise<string | undefined> =>
await getEntityProperty("project", jiraContext, PROJECT_ID);

Ultimately this passes through to a checkResponse function call which should handle a 404 response. If Jira is returning something else, it will output Unexpected Jira API response: followed by the HTTP status of the response. I would expect this to be a 404 if the property doesn't exist, but maybe something has changed:

throw new ApiError("Unexpected Jira API response:", response.status);

Hope that helps!

@nishant-shah-social
Copy link

Thanks for responding @riceyrice !
We are using Cloud Jira. Yes, I did change the appId as well in the manifest.yaml to a sample app I created. Sorry, I missed mentioning about it.
I will try to debug this further in the code.

Regards,
Nishant Shah

@nishant-shah-social
Copy link

@riceyrice I found the problem and we managed to fix it and install+ configure the app successfully.
We required these headers to be present for the PUT call to be successful here

headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    }

I tried raising a PR but somehow I wasn't able to create a branch and push my commit.

Thanks,
Nishant Shah

@matthewelwell
Copy link
Contributor

Hi @nishant-shah-social,

Thanks for letting us know, that's very helpful!

In order to create a PR you'll need to fork the repo and submit it that way, we'd love to receive it if you're happy to do that.

Thanks,
Matt

@nishant-shah-social
Copy link

Sure @matthewelwell
I have created a PR
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants