-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1555 from Hyperkid123/update-csc-docs
Update cloud services documentation.
- Loading branch information
Showing
5 changed files
with
154 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Local development | ||
|
||
## Setup UI proxy for /config | ||
|
||
Testing local changes is straightforward. First, add a routes config proxy settings. Proxy settings are usually in `fec.config.js` or `dev.webpack.config.js` files. Config is exactly the same in both config files. | ||
|
||
Read more about proxy routes config [here](/proxies/webpack-proxy#Customroutes). | ||
|
||
```diff | ||
diff --git a/fec.config.js b/fec.config.js | ||
index af17b44..acf7204 100644 | ||
--- a/fec.config.js | ||
+++ b/fec.config.js | ||
@@ -11,4 +11,12 @@ module.exports = { | ||
* Add additional webpack plugins | ||
*/ | ||
plugins: [], | ||
+ routes: { | ||
+ '/config': { | ||
+ host: 'http://localhost:8889', | ||
+ }, | ||
+ '/beta/config': { | ||
+ host: 'http://localhost:8889', | ||
+ }, | ||
+ }, | ||
}; | ||
|
||
``` | ||
|
||
## Host config repo locally | ||
|
||
1. Create a `config` directory inside of `cloud-services-config` and create a sym link (or copy) to `/chrome` directory in it. You can also create a `beta` directory and symlink the `config` in it if you need `/beta` environment. | ||
|
||
2. From the `cloud-services-config` dir, run `npx http-server -p 8889`. In your browser, go to `https://ci.foo.redhat.com:1337/beta/rhel/dashboard`. You should see something logged like this from npx: | ||
|
||
```shell | ||
$ npx http-server -p 8889 | ||
npx: installed 25 in 2.484s | ||
Starting up http-server, serving ./ | ||
Available on: | ||
http://127.0.0.1:8889 | ||
http://192.168.0.25:8889 | ||
http://10.10.122.158:8889 | ||
Hit CTRL-C to stop the server | ||
``` | ||
|
||
## Check if the proxy is working | ||
|
||
Make sure you can make a simple change and see it in the browser. Try renaming "Dashboard" link title to "XDashboardX" in `/chrome/rhel-navigation.json`. | ||
|
||
```diff | ||
diff --git a/chrome/rhel-navigation.json b/chrome/rhel-navigation.json | ||
index 67237cc..4485daa 100644 | ||
--- a/chrome/rhel-navigation.json | ||
+++ b/chrome/rhel-navigation.json | ||
@@ -4,7 +4,7 @@ | ||
"navItems": [ | ||
{ | ||
"appId": "dashboard", | ||
- "title": "Dashboard", | ||
+ "title": "XDashboardX", | ||
"filterable": false, | ||
"href": "/insights/dashboard", | ||
"product": "Red Hat Insights" | ||
|
||
``` | ||
|
||
Go to `/insights/dashboard` in the UI and refresh the browser. If you don't see the changes, go to the terminal in which your config server is running. You should see similar HTTP logs: | ||
|
||
```shell | ||
[Tue Nov 05 2019 09:50:55 GMT-0500 (Eastern Standard Time)] "GET /beta/config/chrome/insights-navigation.json" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:69.0) Gecko/20100 | ||
101 Firefox/69.0" | ||
``` | ||
|
||
If you don't see any logs, your proxy setup is incorrect. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# New application | ||
|
||
## Add deployment_repo to main.yml | ||
|
||
```yaml | ||
moduleId: | ||
title: Module title | ||
deployment_repo: https://github.com/RedHatInsights/<build-repository> | ||
``` | ||
## Register new chrome module | ||
In the CSC repository, open `chrome/fed-modules.json` file and add a new module configuration: | ||
|
||
```js | ||
{ | ||
"moduleId": { | ||
"manifestLocation": "/apps/moduleId/fed-mods.json", // the manifest path depends on app deployment | ||
"modules": [ | ||
{ | ||
"id": "arbitrary-unique-id", | ||
"module": "./RootApp", // federated module entry point | ||
"routes": [ | ||
"/bundle/module-route" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
## Add a new navigation config (optional) | ||
|
||
In the CSC repository open a navigation file. Choose navigation file, based on your application bundle. | ||
|
||
*Example: `chrome/settings-navigation.json`* | ||
|
||
Add new navigation entry | ||
|
||
```js | ||
{ | ||
{ | ||
"appId": "moduleId", | ||
"title": "New top level link", | ||
"href": "/bundle/module-route" | ||
}, | ||
} | ||
``` | ||
|
||
For more examples and guides, visit the <a href="https://github.com/RedHatInsights/cloud-services-config/blob/ci-beta/docs/chrome/docs.md" target="_blank">CSC repository</a>. |