Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fabric8-launcher/launcher-application

The fabric8-launcher application
https://github.com/fabric8-launcher/launcher-application

github-client keycloak-client openshift-client quarkus

Last synced: 8 days ago
JSON representation

The fabric8-launcher application

Awesome Lists containing this project

README

        

# Fabric8-Launcher Application

[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&identifier=111528311)](https://dependabot.com)
[![Project Chat](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://launcher.zulipchat.com/)

This is a [Quarkus](https://quarkus.io) application exposing a Web front-end and several JAX-RS endpoints to handle launching of application into Openshift. This application collects from an end user the information needed to generate a Zip file containing a project populated for any runtime
(see https://github.com/fabric8-launcher/launcher-booster-catalog for the full list).

The OpenAPI 3.0 descriptor for these services is available at https://editor.swagger.io/?url=https://forge.api.openshift.io/openapi

How to install
--------------

If you want to install a stable release of the Launcher in your OpenSHift environment read the
[instructions here](https://github.com/fabric8-launcher/launcher-charts).

The rest of the README is for those wanting to build from source and/or contribute.

Chat
-----
We're in ZulipChat! Join us now at https://launcher.zulipchat.com/

Contributions
-------------

Contributions are welcome!

Please read the [Contributing Guide](./CONTRIBUTING.md) to help you make a great contribution.

Setting up the environment
--------------------------

* You have to setup environment variables before you start the back-end.

> You can source, or use as an example, the environment script template located there: [./launcher-env-template.sh](./launcher-env-template.sh)

```bash
$ source ./launcher-env-template.sh
```

> You can select the development mode to use by setting the `LAUTH` environemnt variable to either `TOKEN` (the default), `OAUTH` or `KEYCLOAK` before sourcing the script.

> [KeyCloak](http://www.keycloak.org/) adds authentication to the Launcher and secures services with minimum fuss. No need to deal with storing users or authenticating users. It's all available out of the box.
> For development only, you can choose to work without KeyCloak by changing the option in the environment script.
> If you are not using KeyCloak, you can find information on how to [setup your git providers default credentials](README.md#setup-git-providers-default-credentials-no-keycloak-mode).


IDE Setup
---------

* *Immutables* - Setup your IDE for dealing with generated immutable classes see the
[online documentation](https://immutables.github.io/apt.html). You have to build the project at least
once for the classes to be generated or you will still get errors in the IDE.

Build and Run the Application
-----------------------------

* First follow the environment setup [instructions](README.md#setting-up-the-environment).

* Build this project:
```bash
$ mvn clean install
```

* Run:
```bash
$ java -jar web/target/launcher-runner.jar
```

Build and Run the Unit Tests
----------------------------

* First follow the environment setup [instructions](README.md#setting-up-the-environment).

* Execute:
```bash
$ mvn clean install
```

Build and Run the Unit and Integration Tests
--------------------------------------------

* First follow the environment setup [instructions](README.md#setting-up-the-environment).

* To build the project and run the integration tests, allowing Maven to start the server:
```bash
$ mvn clean install -Pit
```

* To skip building and just run the integration tests, allowing Maven to start the server:
```bash
$ mvn integration-test -Pit
```

Reindex the booster catalog
---------------------------

Run the following command, replace TOKEN with the value defined in the environment variable `LAUNCHER_BACKEND_CATALOG_REINDEX_TOKEN`. Doesn't need to be specified if the environment variable doesn't exist in the running environment:

$ curl -v -H "Content-Type: application/json" -d '{}' -X POST https://localhost:8180/api/booster-catalog/reindex\?token\=TOKEN


Setup git providers default credentials (TOKEN mode)
----------------------------------------------------------

#### GitHub

* Log into GitHub and generate an access token for use here:
-- https://github.com/settings/tokens
* Set scopes
* `repo`
* `admin:repo_hook`
* `delete_repo`
* Run the following commands:
```bash
git config --global github.user ""
git config --global github.token ""
```

#### GitLab

* Log into GitLab and generate an access token for use here:
-- https://gitlab.com/profile/personal_access_tokens
* Set scopes
* `api`
* `read_user`
* Run the following commands:
```bash
git config --global gitlab.user ""
git config --global gitlab.token ""
```

#### BitBucket

* Log into Bitbucket and generate an application password for use here:
-- https://bitbucket.org/account/admin/app-passwords
* Activate permissions:
* Account: Email, Read
* Team: Read
* Projects: Read
* Repositories: Read, Write, Admin, Delete
* Pull requests: Read
* Issue: Read
* Webhook: Read and write
* Run the following commands:
```bash
git config --global bitbucket.user ""
git config --global bitbucket.password ""
```

#### Gitea

Launcher accesses Gitea using the [Sudo](https://docs.gitea.io/en-us/api-usage/) feature, so make sure that the user referenced in the `Authorization` HTTP Header also exists in the Gitea server

* Logged as an admin user, generate an access token (eg. https://try.gitea.com/user/settings/applications).
* You need to provide 3 environment variables when running the backend:

|Environment |Description|
|------------|-----------|
|`LAUNCHER_GIT_PROVIDER`|The default Git provider to use, should be `Gitea`|
|`LAUNCHER_MISSIONCONTROL_GITEA_URL`|The URL where the Gitea server is running|
|`LAUNCHER_MISSIONCONTROL_GITEA_USERNAME`| The admin username|
|`LAUNCHER_MISSIONCONTROL_GITEA_TOKEN`|The admin access token|

Setup using OAuth (OAUTH mode)
------------------------------

You can set the proper environment variables for local development with OAuth like this:

```bash
$ LAUTH=OAUTH source ./launcher-env-template.sh
```

But you also need to add an `OAuthClient` to your OpenShift cluster. You can run the following command while being logged in with a user that has cluster admin rights:

```bash
$ cat <