<commit_before># opensource-portal

> Microsoft's GitHub-at-scale management portal

This Node.js application is a part of the suite of services provided by
the Open Source Programs Office at Microsoft to enable large-scale GitHub
management experiences.

Key features center around opinionated takes on at-scale management, with an emphasis on _relentless automation_ and _delegation_:

- __Linking__: the concept of associating a GitHub identity with an authenticated identity in another provider, for example an Azure Active Directory user
- __Self-service GitHub organization join__: one-click GitHub organization joining for authorized users
- __Cross-organization functionality__: consolidated views across a set of managed GitHub organizations including people, repos, teams

Before providing GitHub management functionality to all of Microsoft, this
application started within Azure.

> An introduction to this project is available in this 2015 post by <NAME>:   [http://www.jeff.wilcox.name/2015/11/azure-on-github/](http://www.jeff.wilcox.name/2015/11/azure-on-github/)

The app is a GitHub OAuth application; with the May 2017 release of
GitHub Apps (formerly called Integrations), this app over time may be
refactored to support the integration concept, removing the need to
dedicate a user seat to a machine account.

## Node app

- Node.js LTS (v10+)
- TypeScript
- Mixed callback and Q promises and async and whoa at this time

## Service Dependencies

- At least one of your own GitHub organizations
- Bring your own Redis server, or use Azure Redis Cache
- Azure Active Directory, or hack your own Passport provider in
- Data storage for links, etc.: either Azure Storage _or_ Postgres

## LICENSE

[MIT License](LICENSE)

## Dev prep, build, deploy

### Prereqs

#### Install Node packages

Make sure to include dev dependencies

```
$ npm install
```

### Build

```
$ npm run-script build
```

### Building the Docker image

You need to set the NPM_TOKEN parameter to the NPM token to the private registry.

```
$ docker build --build-arg NPM_TOKEN="<PASSWORD>TOKENHERE" .
```

### Test

This project is starting to get improved testability. But it will be a long slog.

```
$ npm test
```

Which is equivalent to running:

```
$ mocha
```

## Contributions welcome

Happy to have contributions, though please consider reviewing the CONTRIBUTING.MD file, the code of conduct,
and then also open a work item to help discuss the features or functionality ahead of kicking off any such
work.

This project has adopted the [Microsoft Open Source Code of<commit_msg>Add documentation on how to troubleshoot Docker image<commit_after># opensource-portal

> Microsoft's GitHub-at-scale management portal

This Node.js application is a part of the suite of services provided by
the Open Source Programs Office at Microsoft to enable large-scale GitHub
management experiences.

Key features center around opinionated takes on at-scale management, with an emphasis on _relentless automation_ and _delegation_:

- __Linking__: the concept of associating a GitHub identity with an authenticated identity in another provider, for example an Azure Active Directory user
- __Self-service GitHub organization join__: one-click GitHub organization joining for authorized users
- __Cross-organization functionality__: consolidated views across a set of managed GitHub organizations including people, repos, teams

Before providing GitHub management functionality to all of Microsoft, this
application started within Azure.

> An introduction to this project is available in this 2015 post by <NAME>x:   [http://www.jeff.wilcox.name/2015/11/azure-on-github/](http://www.jeff.wilcox.name/2015/11/azure-on-github/)

The app is a GitHub OAuth application; with the May 2017 release of
GitHub Apps (formerly called Integrations), this app over time may be
refactored to support the integration concept, removing the need to
dedicate a user seat to a machine account.

## Node app

- Node.js LTS (v10+)
- TypeScript
- Mixed callback and Q promises and async and whoa at this time

## Service Dependencies

- At least one of your own GitHub organizations
- Bring your own Redis server, or use Azure Redis Cache
- Azure Active Directory, or hack your own Passport provider in
- Data storage for links, etc.: either Azure Storage _or_ Postgres

## LICENSE

[MIT License](LICENSE)

## Dev prep, build, deploy

### Prereqs

#### Install Node packages

Make sure to include dev dependencies

```
$ npm install
```

### Build

```
$ npm run-script build
```

### Building the Docker image

You need to set the NPM_TOKEN parameter to the NPM token to the private registry.

```
$ docker build --build-arg NPM_TOKEN="<PASSWORD>" .
```

#### Troubleshooting

If the docker image doesn't start you can debug the image using an interactive shell session. This allows you to browse the folders, update the files to test things and run the portal.

```bash
$ docker run --rm -it opensource-portal sh
/usr/src/repos $ ls
app.js                   data                     lib                      package.json             tsconfig.tsbuildinfo     webhooks
app.js.map               entities                 localEnvironment.js      routes                   user
bin                      features                 localEnvironment.js.map  test                     utils.js
business                 github                   middleware               transitional.js          utils.js.map
config                   jobs                     node_modules             transitional.js.map      views
/usr/src/repos $ npm run start-in-container
```

### Test

This project is starting to get improved testability. But it will be a long slog.

```
$ npm test
```

Which is equivalent to running:

```
$ mocha
```

## Contributions welcome

Happy to have contributions, though please consider reviewing the CONTRIBUTING.MD file, the code of conduct,
and then also open a work item to help discuss the features or functionality ahead of kicking off any such
work.

This project has adopted the [Microsoft Open Source Code of
{'fraction_non_alphanumeric': 0.0629003120381015, 'fraction_numerical': 0.007226145508293644, 'mean_word_length': 3.5011086474501107, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1929100', 'n_tokens_mistral': 1632, 'n_tokens_neox': 1487, 'n_words': 765}