|
1 | | -# GitLab-GitHub Proxy [](https://travis-ci.org/dka23/gitlab-github-proxy) |
| 1 | +# GitLab-GitHub Proxy (glghproxy) [](https://travis-ci.org/dka23/gitlab-github-proxy) |
| 2 | + |
2 | 3 | Proxy to provide GitHub-like API on top of Gitlab. Especially designed to use the **JIRA DVCS connector** with Gitlab. |
3 | 4 |
|
4 | | -WORK IN PROGRESS: Completely unfinished and untested at the moment. |
| 5 | +**VERY IMPORTANT CONFIGURATION REQUIREMENTS:** |
5 | 6 |
|
| 7 | +1. The address of glghproxy on your network MUST be DNS resolvable AND routable from BOTH a) JIRA server, and b) end-user browsers. |
| 8 | +2. Additionally, glghproxy MUST operate on tcp/80. |
6 | 9 |
|
| 10 | +## Setup |
7 | 11 |
|
8 | | -## Use it |
9 | | -### 1. Execute the proxy |
10 | | -It needs to be reachable from the JIRA installation as well as the end-user browsers using the same DNS name and on port 80. |
11 | | -``` |
12 | | -mvn spring-boot:run -DgitlabUrl=http://yourgitlabserver.yourcompany.com |
13 | | -``` |
| 12 | +### Step 1. Launch glghproxy using Maven and Spring boot from CLI |
14 | 13 |
|
15 | | -### 2. Configure authorization in GitLab |
16 | | -In the Admin Area, at Applications, create a new application. The callback url should be set to the address where you run the proxy like the following |
| 14 | +**NOTICE:** The default Spring listen port is tcp/8080, |
| 15 | +so specifying it again as a java argument is redundant, |
| 16 | +but makes the problem explicit. |
| 17 | +You can choose to setup a port forward in front of it, |
| 18 | +or (not recommended) run the service as root so you can listen on tcp/80. |
| 19 | + |
| 20 | +```bash |
| 21 | +mvn spring-boot:run -DgitlabUrl="http://yourgitlabserver.yourcompany.com" -Dserver.port=8080 |
17 | 22 | ``` |
18 | | -http://glproxy/login/oauth/authorize_callback |
| 23 | + |
| 24 | +Alternatively, you can launch using Docker, and its resident service will proxy tcp/80 -> tcp/8080 for you: |
| 25 | +```bash |
| 26 | +docker build -t glghproxy . |
| 27 | +docker run -p 80:8080 glghproxy |
19 | 28 | ``` |
20 | 29 |
|
21 | | -### 3. Add DVCS account in JIRA |
22 | | -Create a GitHub Enterprise account with the following data: |
23 | | -* Team or User Account = Gitlab namespace you want to synchronize |
24 | | -* Host URL = URL of the proxy, e.g. http://glproxy |
25 | | -* OAuth Key = Application Id (generated by Gitlab) |
26 | | -* OAuth Secret = Secret (generated by Gitlab) |
| 30 | +For the hostname (ie. `glghproxy`) you'll need to add a DNS entry or a `/etc/hosts` override. |
| 31 | +However the latter will only work if glghproxy, JIRA, and the browser are operating on the same machine. |
| 32 | +That can be nice for testing, (e.g., with a locally installed [containerized] trial version of JIRA) but |
| 33 | +be aware that if you are using docker containers you'll need to ensure the hostname resolves to an IP that |
| 34 | +is resolvable from all sides--in that case, the `docker0` interface ip is recommended. |
| 35 | + |
| 36 | +**WARNING:** By default, JIRA and glghproxy want to operate on the same tcp/8080 port. If you are not |
| 37 | +using containers, you'll have to resolve this conflict yourself. |
| 38 | + |
| 39 | +### Step 2. Generate new Application in GitLab |
| 40 | + |
| 41 | +- Browse to your Gitlab Applications tab (`/profile/applications`) |
| 42 | +- On the `Add New Application` tab, fill in the `Name` field with your choice (ie. `glghproxy`) |
| 43 | +- Fill in the `Redirect URI` with the address you've chosen for this proxy service. |
| 44 | + |
| 45 | + ``` |
| 46 | + http://glghproxy/login/oauth/authorize_callback |
| 47 | + ``` |
| 48 | +- Click the `Save application` button. |
| 49 | +- Make note of the `Application Id` and `Secret` on the following page. |
| 50 | + |
| 51 | + |
| 52 | +### Step 3. Add a new DVCS account in JIRA |
| 53 | + |
| 54 | +- Browse to your JIRA Administration > DVCS accounts page (`/secure/admin/ConfigureDvcsOrganizations.jspa`) |
| 55 | +- Click the `Link Bitbucket Cloud or Github account` button. |
| 56 | +- On the `Add New Account` popup, select `Github Enterprise` from the `Host` dropdown menu. |
| 57 | +- Fill in `Team or User Account` field with the name of the Gitlab group or username containing the repositories you want JIRA to integrate. |
| 58 | + **NOTICE:** You will need to add multiple DVCS accounts if your repositories are spread across more than one group or username. |
| 59 | +- Fill in `Host URL` with the address you've chosen for this proxy service. (ie. `http://glghproxy`) |
| 60 | +- Fill in `Client ID` with the *Application Id* generated for you by Gitlab earlier. |
| 61 | +- Fill in `Client Secret` with the *Secret* generated for you by Gitlab earlier. |
| 62 | +- The `Auto Link New Repositories` and `Enable Smart Commits` checkboxes are compatible and are safe to configure to your liking. |
| 63 | +- Click the `Add` button and then the `Continue` button when prompted. |
| 64 | +- It should say `Connecting to Github Enterprise to configure your account...`. |
| 65 | +- Then it should say `Linking new account ...`. |
| 66 | +- Then you should see your newly added account listed and the JIRA DVCS feature should operate normally from here. |
0 commit comments