Skip to content

Commit 30e77a5

Browse files
NONE: Simplify the project setup by using ngrok static domains (#48)
1 parent be094e5 commit 30e77a5

File tree

10 files changed

+62
-137
lines changed

10 files changed

+62
-137
lines changed

.env.example

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
1-
# [AUTOFILLED] This URL is automatically filled
1+
# A URL of the app reachable by Jira.
2+
# For local development, consider using ngrok:
3+
# 1. Create an ngrok account: https://dashboard.ngrok.com
4+
# 2. Create your own static domain: https://dashboard.ngrok.com/cloud-edge/domains
5+
# 3. Use the created domain for `APP_URL` (e.g., https://foo-bar-baz.ngrok-free.app)
26
APP_URL=
37

4-
# Auth Token for ngrok: https://dashboard.ngrok.com/get-started/setup
8+
###############################################################
9+
## The env variables below are required for development only ##
10+
###############################################################
11+
12+
# These variables are needed for creating up an ngrok tunnel.
13+
# An ngrok auth token.
14+
# 1. Go to https://dashboard.ngrok.com/get-started/setup
15+
# 2. Find your ngrok auth token
516
NGROK_AUTHTOKEN=
17+
# An ngrok static domain. This is the same domain used in `APP_URL` (e.g., `foo-bar-baz.ngrok-free.app`).
18+
# 1. Go to https://dashboard.ngrok.com/cloud-edge/domains or check the `APP_URL` value
19+
# 2. Find the created domain name
20+
NGROK_DOMAIN=
621

7-
# These variables are needed for the auto-app installation
8-
# Atlassian Jira URL eg. https://example-app.atlassian.net
22+
# These variables are needed for the app auto-installation.
23+
# An Atlassian site URL (e.g. https://example-app.atlassian.net)
924
ATLASSIAN_URL=
10-
# Your Jira login email
25+
# Your Jira login email. You have to be the admin of a Jira instance.
1126
JIRA_ADMIN_EMAIL=
12-
# Create a new API token in Jira [https://id.atlassian.com/manage-profile/security/api-tokens]
27+
# An Atlassian API token.
28+
# 1. Go to https://id.atlassian.com/manage-profile/security/api-tokens
29+
# 2. Create a new API token
1330
JIRA_ADMIN_API_TOKEN=

.eslintignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
/**/*.js
2-
prestart.ts
3-
postinstall.ts
42
playwright.config.ts

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
run: |
5151
echo "APP_URL=https://${{ secrets.NGROK_DOMAIN }}" > .env
5252
echo "NGROK_AUTHTOKEN=${{ secrets.NGROK_AUTHTOKEN }}" >> .env
53+
echo "NGROK_DOMAIN=${{ secrets.NGROK_DOMAIN }}" >> .env
5354
echo "ATLASSIAN_URL=${{ secrets.E2E_ATLASSIAN_URL }}" >> .env
5455
echo "JIRA_ADMIN_EMAIL=${{ secrets.E2E_JIRA_ADMIN_USERNAME }}" >> .env
5556
echo "JIRA_ADMIN_API_TOKEN=${{ secrets.E2E_JIRA_ADMIN_PASSWORD }}" >> .env

README.md

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,50 +8,56 @@ This app is aimed to help you to easily add your integration in Jira.
88
- [Pre-requisites](#pre-requisites)
99
- [Getting started](#getting-started)
1010
- [Manual Install](#manually-installing-the-app)
11-
- [Running your application](#running-your-application)
1211
- [Testing](#testing)
1312
- [Getting help](#getting-help)
1413
- [License](#license)
1514

1615
## Pre-requisites
17-
- [Node](https://nodejs.org)
18-
- [yarn](https://yarnpkg.com/getting-started/install)(recommended) or npm
19-
- [docker & docker-compose](https://docs.docker.com/engine/install/)
20-
- [ngrok account](https://ngrok.com/)
16+
- Install [Node.js](https://nodejs.org).
17+
- Install [yarn](https://yarnpkg.com/getting-started/install) (optional).
18+
- Install [Docker & Docker Compose](https://docs.docker.com/engine/install/).
19+
- Create an [ngrok](https://ngrok.com/) account.
20+
- Create an [Atlassian development site](http://go.atlassian.com/cloud-dev).
2121

2222
## Getting started
23-
You can run this app in 3 simple steps:
24-
- **Installing dependencies**
25-
- Run `yarn install` (recommended) or `npm install` for installing all the dependencies for this app.
2623

27-
- **Configuration**
28-
- We are using [ngrok](https://ngrok.com/docs/getting-started) for tunnelling. You'll need to create an ngrok
29-
account to get access to the auth token.
30-
- Open your .env file and fill in *all the missing fields*
31-
32-
- **Running docker compose**
33-
- Then simply run `docker-compose up`.
34-
- Please be patient as it will take a few minutes for everything to be setup. When everything is setup, you should see the URL in the terminal as in the picture below. ![img.png](static/images/tunnel-output.png)
35-
36-
> **Note:** _If you are using a free version of ngrok, please open the tunneled URL first. This needs to be done to bypass the ngrok browser warning. Just visit the ngrok warning page and just click on the Visit button._
24+
1. Install the dependencies.
25+
```shell
26+
# If use Yarn (recommended)...
27+
yarn install
28+
# If use npm...
29+
npm install
30+
```
31+
2. Create `.env` file based on `.env.example` and set the environment variables.
32+
3. Start the app and install it on Jira. Please be patient as it will take a few minutes for everything to be setup. When everything is set up, you should see the URL in the terminal as in the picture below.
33+
```shell
34+
docker-compose up
35+
```
36+
![img.png](static/images/tunnel-output.png)
3737

3838
At the very end, you can see the URL the index page of your app. Just open the URL and that's it, you're ready!
3939

40+
> **Note:** _If you are using a free version of ngrok, please open the tunneled URL first. This needs to be done to bypass the ngrok browser warning. Just visit the ngrok warning page and just click on the "Visit" button._
41+
4042
## Manually Installing the App
41-
The above steps automatically installs the app, however you can only install one app at a time.
42-
43-
If you want to install the app in multiple Jira instances, please do it manually. Go to your Jira instances and do
44-
the following steps:
45-
- From the header menu, select Apps -> Manage your apps.
46-
- Verify the filter is set to User-installed, and select Settings beneath the User-installed apps table.
47-
- On the Settings pop-up, add Enable development mode and click Apply. Refresh the page.
48-
- On the right side of the header, there should now appear a button Upload app. Click it and enter the app URL
49-
`/atlassian-connect.json`(`https://${APP_URL}/atlassian-connect.json`)
50-
- Click Upload.
51-
- That's it! You're done. 🎉
43+
44+
The above steps automatically installs the app, however you can only install one app at a time.
45+
46+
1. Go to your Jira instance.
47+
2. Enable the installation of apps that are not listed on the Atlassian Marketplace.
48+
1. Go to **Apps** > **Manage your apps**.
49+
2. Click **User-installed apps** > **Settings**.
50+
3. Check **Enable development mode** and click **Apply**.
51+
3. Reload the page.
52+
4. Install the app.
53+
1. Click **Upload app**.
54+
2. Paste the link to your Connect descriptor (`${APP_URL}/atlassian-connect.json`) and
55+
click **Upload**.
56+
57+
That's it! You're done. 🎉
5258

5359
## Testing
54-
We have added a basic end to end test for installing and uninstalling the app, using [playwright](https://playwright.dev/docs/intro). You can add your own test cases on top of it.
60+
We have added a basic end to end test for installing and uninstalling the app, using [playwright](https://playwright.dev/docs/intro). You can add your own test cases on top of it.
5561

5662
To run the end to end test, please add the values for `ATLASSIAN_URL`, `JIRA_ADMIN_EMAIL` and `JIRA_ADMIN_API_TOKEN` in the `.env` file. Then simply run `yarn test:e2e` in the terminal.
5763

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
image: wernight/ngrok
66
ports:
77
- "4040:4040"
8-
command: ngrok http -log stdout --authtoken $NGROK_AUTHTOKEN app:3000
8+
command: ngrok http -log stdout -hostname=$NGROK_DOMAIN --authtoken $NGROK_AUTHTOKEN app:3000
99

1010
app:
1111
container_name: connect-example-app-node

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
"clean:db": "rimraf db.json",
1212
"lint": "eslint . --ext .ts,.tsx",
1313
"build": "tsc --project .",
14-
"postinstall": "ts-node postinstall.ts",
15-
"prestart": "run-p clean prestart:wait",
16-
"prestart:wait": "ts-node prestart.ts",
1714
"start": "tsnd --watch=.env,**/*.squirrelly --inspect=0.0.0.0:9229 --respawn --transpile-only -- src/server.ts",
1815
"test:e2e": "run-s test:e2e:install test:e2e:start",
1916
"test:e2e:debug": "PWDEBUG=1 run-s test:e2e:install test:e2e:headed",

postinstall.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

prestart.ts

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/routes/atlassian-connect.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ export const connectAppDescriptor = {
2727

2828
/**
2929
* The base url of the server, which is used for all communications between Connect and the app.
30-
*
31-
* The tunneled URL which is set in the `prestart.ts`
3230
*/
3331
baseUrl: envVars.APP_URL,
3432

src/views/content/config.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ app descriptor is:
66
- `name`: the name of the Connect app
77
- `description`: description for the Connect app
88
- `key`: a unique key to identify your Connect app. This key must be <= 64 characters
9-
- `baseUrl`: The base url of the remote app, which is used for all communications back to the app instance. For this
10-
example app, this is the tunneled URL which is set in the `prestart.ts`
9+
- `baseUrl`: The base url of the remote app, which is used for all communications back to the app instance.
1110
- `vendor`: the vendor who is offering this Connect app
1211
- `authentication`: this defines the authentication type to use when signing requests between the host application
1312
and the Connect app. The supported types include `jwt`, `JWT`, `none`, `NONE`. We'll go into more detail around

0 commit comments

Comments
 (0)