Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from janus-idp/main
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
malacourse authored Feb 21, 2023
2 parents 13e9cf5 + bf1407d commit c50a0bf
Show file tree
Hide file tree
Showing 22 changed files with 532 additions and 65 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: ci
on:
push:
branches:
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/cache@v2
with:
key: ${{ github.ref }}
path: .cache
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
45 changes: 0 additions & 45 deletions ansible/README.md

This file was deleted.

80 changes: 80 additions & 0 deletions ansible/cluster-setup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Assemble with Ansible

A guide to installing `Assemble with Ansible`

## Prerequisites

- Access to an Openshift 4+ deployment and logged in with the CLI
- Install the Following CLIs
- [ansible](https://www.ansible.com/)/[ansible-galaxy](https://galaxy.ansible.com/)
- [helm](https://helm.sh/)
- Please use the version included with your Openshift Deployment
- [pip3](https://pypi.org/project/pip/)
- Install ansible's `kubernetes.core` and `community.general` collections:

## Setup

1. The Ansible `kubernetes.core` collections needs to be installed before using this playbook.

``` sh
ansible-galaxy collection install kubernetes.core
```

1. The `kubernetes`, `openshift`, and `PyYAML` python packages need to be installed before using this playbook.

``` sh
pip3 install --user kubernetes openshift PyYAML
```

1. The `helm diff` plugin should to be installed before using this playbook.

``` sh
helm plugin install https://github.com/databus23/helm-diff
```

1. Login to OpenShift
1. If you want to use the GitHub integration, generate a Personal Access Token for GitHub and set the `GITHUB_TOKEN` environment variable.
See the official [Backstage Documentation](https://backstage.io/docs/getting-started/configuration#setting-up-a-github-integration) for information on how to create one. For the purposes of a demonstration, a Personal Access Token will do.
1. If you want to use GitHub as an IDP for backstage then create an GitHub app and set the `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` environment variables.
- Create a [GitHub OAuth Application](https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app) within the desired organization.
- Use the following commands to generate the sample values used for this demo and fill them in using the GitHub UI:

**Homepage URL:**

```sh
echo "https://assemble-demo.apps$(oc cluster-info | grep -Eo '.cluster(.*?).com')"
```

**Authorization Callback URL:**

```sh
echo "https://keycloak-backstage.apps$(oc cluster-info | grep -Eo '.cluster(.*?).com')/auth/realms/backstage/broker/github/endpoint"
```

2. OPTIONAL: If you would like setup to include GitOps configuration, create a [Github Organization](https://github.com/settings/organizations) and set the `GITHUB_ORGANIZATION` environment variable to the name of the Organization. You may also use any organization you are a member of, as long as you have the ability to create new repositories within it.

## Install

[Inventory values](inventory/group_vars/all.yml) can be changed, but not required

Run Command:

```sh
ansible-playbook site.yaml -i inventory
```

### FAQ

#### Failed on `Run RHSSO Backstage Helm Chart` during initial run `no matches for kind \"Keycloak\" in version...`

The RHSSO operator may not have completed installation, try rerunning the Ansible Playbook.

#### Failed on `Create Manifests Repo`

Most likely an environment variable is not set, or not set correctly. Validate, delete the Postgres Database Deployment and re-try the playbook.

> Note: If there is an issue post the Postgres database creation please delete the database (or the entire namespace) before attempting to rerun the ansible playbook.

#### Unable to login to Argo Cluster

Admin password can be found on `argocd-cluster` secret. And the username is `admin`
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@



env:
- namespace: "backstage"
companyname: "ACME Inc"
Expand Down
42 changes: 31 additions & 11 deletions ansible/site.yaml → ansible/cluster-setup/site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
state: present
name: rhsso-operator
namespace: "{{ item.namespace }}"
chart_ref: ../charts/operator
values_files: ["../charts/operator/values-rhsso-operator.yaml"]
chart_ref: ../../charts/operator
values_files: ["../../charts/operator/values-rhsso-operator.yaml"]
create_namespace: true
- name: Install OpenShift Pipelines Operator Chart.
hosts: 'localhost'
Expand All @@ -30,8 +30,8 @@
state: present
name: pipelines
namespace: "{{ item.pipelinesnamespace }}"
chart_ref: ../charts/pipelines-operator
values_files: ["../charts/pipelines-operator/values.yaml"]
chart_ref: ../../charts/pipelines-operator
values_files: ["../../charts/pipelines-operator/values.yaml"]
create_namespace: true
- name: Install RHSSO Backstage Chart.
hosts: 'localhost'
Expand All @@ -42,7 +42,7 @@
state: present
name: rhsso-backstage
namespace: "{{ item.namespace }}"
chart_ref: ../charts/rhsso-backstage
chart_ref: ../../charts/rhsso-backstage
values:
keycloak:
realm:
Expand All @@ -52,7 +52,7 @@
enabled: "{{ false if lookup('ansible.builtin.env', 'GITHUB_CLIENT_SECRET') == '' else true }}"
backstage:
host: "assemble-demo.apps{{ cluster_host }}"
values_files: ["../charts/rhsso-backstage/values.yaml"]
values_files: ["../../charts/rhsso-backstage/values.yaml"]
create_namespace: true
- name: Wait for Keycloak to be Ready
with_items: "{{ env }}"
Expand Down Expand Up @@ -121,16 +121,29 @@
state: present
name: argocd
namespace: "{{ item.gitopsnamespace }}"
chart_ref: ../charts/gitops-operator
chart_ref: ../../charts/gitops-operator
values:
namespaces:
- assemble-argocd
- infra-argocd
repositoryCredentials:
- name: "private-repo-creds"
username: "token"
password: "{{ lookup('ansible.builtin.env', 'GITHUB_TOKEN') }}"
url: "https://github.com/{{ lookup('ansible.builtin.env', 'GITHUB_ORGANIZATION') }}"
type: "git"
values_files: ["../charts/gitops-operator/values.yaml"]
values_files: ["../../charts/gitops-operator/values.yaml"]
create_namespace: true
- name: Install Dev Spaces Operator
with_items: "{{ env }}"
kubernetes.core.k8s:
state: present
src: ../../infra/argocd-applications/devspaces/devspaces-operator.yaml
- name: Install Dev Spaces Instance
with_items: "{{ env }}"
kubernetes.core.k8s:
state: present
src: ../../infra/argocd-applications/devspaces/devspaces-instance.yaml
- name: Install Backstage Chart.
hosts: 'localhost'
tasks:
Expand All @@ -147,7 +160,7 @@
state: present
name: assemble-dev
namespace: "{{ item.namespace }}"
chart_ref: ../charts/assemble-backstage
chart_ref: ../../charts/assemble-backstage
values:
rhsso:
baseUrl: "https://keycloak-{{ item.namespace }}.apps{{ cluster_host }}/auth"
Expand All @@ -156,6 +169,12 @@
backstagePluginEnabled: true
backstage:
baseUrl: "https://assemble-demo.apps{{ cluster_host }}"
catalog:
locations:
- type: url
target: https://github.com/{{ lookup('ansible.builtin.env', 'GITHUB_ORGANIZATION') }}/software-templates/blob/main/scaffolder-templates/quarkus-web-template/template.yaml
rules:
- allow: [Template]
oauth:
enabled: true
postgres:
Expand All @@ -169,5 +188,6 @@
password: "{{ argocd_admin_pwd }}"
waitCycles: 25
url: "https://argocd-server-{{ item.gitopsnamespace }}.apps{{ cluster_host }}"
values_files: ["../charts/assemble-backstage/values.yaml"]
create_namespace: true
values_files: ["../../charts/assemble-backstage/values.yaml"]
create_namespace: true

40 changes: 40 additions & 0 deletions ansible/software-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Customize Software Templates

These steps will customize the Janus software templates for use within your OpenShift cluster.

## Prerequisites

- Access to an Openshift 4+ deployment and logged in with the CLI
- A GitHub Organization for which you have access to

## Setup

1. Set the `GITHUB_ORGANIZATION` environment variable to the name of your organization.

``` sh
export GITHUB_ORGANIZATION= #set your Git Hub org name here
```

2. Fork the [Software Templates](https://github.com/janus-idp/software-templates) repository to your organization.

3. Run the ansible playbook to complete setup. This playbook with customize your fork of the Software Templates repo with relevant information pertaining to your cluster, mimicking the structure of a custom template being used in an enterprise IT environment.

```sh
ansible-playbook ./site.yaml
```

### FAQ

#### Failed on `Run RHSSO Backstage Helm Chart` during initial run `no matches for kind \"Keycloak\" in version...`

The RHSSO operator may not have completed installation, try rerunning the Ansible Playbook.

#### Failed on `Create Manifests Repo`

Most likely an environment variable is not set, or not set correctly. Validate, delete the Postgres Database Deployment and re-try the playbook.

> Note: If there is an issue post the Postgres database creation please delete the database (or the entire namespace) before attempting to rerun the ansible playbook.

#### Unable to login to Argo Cluster

Admin password can be found on `argocd-cluster` secret. And the username is `admin`
25 changes: 25 additions & 0 deletions ansible/software-template/site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
- name: Gather Cluster Info.
gather_facts: false
hosts: 'localhost'
tasks:
- name: Determine Host
shell: "oc cluster-info | grep -Eo '.cluster(.*?).com'"
register: cluster_response
- name: Set Dev Spaces Instance
set_fact:
dev_spaces_instance: "devspaces.apps{{ cluster_response.stdout }}"
- debug: var=cluster_response.stdout_lines
- name: Customize Software Template
gather_facts: false
hosts: 'localhost'
tasks:
- name: Insert Dev Spaces Instance Information
shell: |
cd ../../../
git clone https://github.com/{{ lookup('ansible.builtin.env', 'GITHUB_ORGANIZATION') }}/software-templates.git
cd software-templates
find . -type f -not -path '*/\.git/*' -exec sed -i '' -e "s/devspaces.apps.example-cluster.com/{{ dev_spaces_instance }}/g" {} +
git add -A
git commit -m "initial customization"
git push
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ rules:
resources:
- '*'
verbs:
- delete # supports deletion a live object in UI
- get # supports viewing live object manifest in UI
- patch # supports `argocd app patch`
- '*'
- apiGroups:
- ""
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ apiVersion: v1
kind: Namespace
metadata:
annotations:
openshift.io/description: ""
openshift.io/display-name: ""
"openshift.io/description": ""
"openshift.io/display-name": ""
"helm.sh/hook": pre-install,pre-upgrade
labels:
kubernetes.io/metadata.name: {{ $ns }}
openshift.io/cluster-monitoring: "true"
Expand Down
2 changes: 1 addition & 1 deletion charts/gitops-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespaces:
- assemble-argocd

# operator manages upgrades
operator:
operator:
channel: latest
installPlanApproval: Automatic
name: openshift-gitops-operator
Expand Down
3 changes: 3 additions & 0 deletions docs/docs/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Architecture

![Architecture](assets/architecture.drawio.png)
Binary file added docs/docs/assets/architecture.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/docs/demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Assemble Demo Setup

Assemble can also be evaluated using the new [demo.redhat.com](https://demo.redhat.com/catalog) demo.

More Information coming...
11 changes: 11 additions & 0 deletions docs/docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Getting Started

## Prerequisite

- Openshift 4.10+
- Ansible
- TBD

## Installation

Talk about installation through the playbook TBD
7 changes: 7 additions & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# :wrench: Assemble :wrench:

Assemble is a platform built on the back of [Janus IDP](https://github.com/janus-idp/redhat-backstage-build) and [Backstage](https://backstage.io/docs/overview/what-is-backstage), with the goal of helping application teams get started quicker.

## Why Should I use Assemble?

TBD
Loading

0 comments on commit c50a0bf

Please sign in to comment.