Skip to content

Commit 29a1909

Browse files
authored
Adds some ui-dev docs (#267)
* Adds so ui-dev docs * how to kubectl the test cluster
1 parent 82be005 commit 29a1909

File tree

2 files changed

+72
-6
lines changed

2 files changed

+72
-6
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# weave-gitops-enterprise
22

3-
👋
3+
Information
4+
5+
- Dev guide in [docs/developing.md](./docs/developing.md)
6+
- User docs at https://docs.gitops.weave.works

docs/developing.md

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ When making code modifications see if you can write a test first!
2222

2323
Sometimes its nice to demo / experiment with the service(s) you're changing locally.
2424

25-
### The `capi-service`
25+
### The `clusters-service`
2626

2727
_Note: the following instructions will use a new local database, you can probably reconcile the internal cluster database with the local one with some fancy fs mounting, tbd..._
2828

29-
The `capi-service` requires the presence of a valid entitlement secret for it to work. Make sure an entitlement secret has been added to the cluster and that the `capi-service` has been configured to look for it using the correct namespace/name. By default, entitlement secrets are named `weave-gitops-enterprise-credentials` and are added to the `wego-system` namespace. If that's not the case, you will need to point the service to the right place by explicitly specifying the relevant environment variables (example below).
29+
The `clusters-service` requires the presence of a valid entitlement secret for it to work. Make sure an entitlement secret has been added to the cluster and that the `clusters-service` has been configured to look for it using the correct namespace/name. By default, entitlement secrets are named `weave-gitops-enterprise-credentials` and are added to the `wego-system` namespace. If that's not the case, you will need to point the service to the right place by explicitly specifying the relevant environment variables (example below).
3030

3131
An existing entitlement secret that you can use can be found [here](../test/utils/scripts/entitlement-secret.yaml). Alternatively, you can generate your own entitlement secret by using the `wge-credentials` binary.
3232

@@ -56,7 +56,7 @@ Run the server:
5656
export KUBECONFIG=test-server-kubeconfig
5757

5858
# Run the server configured using lots of env vars
59-
DB_URI=/tmp/wge.db CAPI_CLUSTERS_NAMESPACE=default CAPI_TEMPLATES_NAMESPACE=default GIT_PROVIDER_TOKEN=$GITHUB_TOKEN GIT_PROVIDER_TYPE=github GIT_PROVIDER_HOSTNAME=github.com CAPI_TEMPLATES_REPOSITORY_URL=https://github.com/my-org/my-repo CAPI_TEMPLATES_REPOSITORY_BASE_BRANCH=main ENTITLEMENT_SECRET_NAMESPACE=wego-system ENTITLEMENT_SECRET_NAME=weave-gitops-enterprise-credentials go run cmd/capi-service/main.go
59+
DB_URI=/tmp/wge.db CAPI_CLUSTERS_NAMESPACE=default CAPI_TEMPLATES_NAMESPACE=default GIT_PROVIDER_TYPE=github GIT_PROVIDER_HOSTNAME=github.com CAPI_TEMPLATES_REPOSITORY_URL=https://github.com/my-org/my-repo CAPI_TEMPLATES_REPOSITORY_BASE_BRANCH=main ENTITLEMENT_SECRET_NAMESPACE=wego-system ENTITLEMENT_SECRET_NAME=weave-gitops-enterprise-credentials go run cmd/clusters-service/main.go
6060
```
6161

6262
You can query the local capi-server:
@@ -90,6 +90,46 @@ cd ui-cra
9090
GITOPS_HOST=http://localhost:8090 yarn start
9191
```
9292

93+
## Developing the UI
94+
95+
We usually develop the UI against the test server and by default the UI dev server will use that.
96+
97+
```bash
98+
cd ui-cra
99+
yarn
100+
yarn start
101+
```
102+
103+
Open up http://localhost:3000. Changes to code will be hot-reloaded.
104+
105+
### UI against a local clusters-service
106+
107+
When you need to develop the UI against new features that haven't made to the test cluster yet you can run your own clusters-service locally and point the UI dev server at it with:
108+
109+
```bash
110+
CAPI_SERVER_HOST=http://localhost:8000 yarn start
111+
```
112+
113+
### Testing changes to an unreleased weave-gitops locally
114+
115+
Maybe you need to add an extra export or tweak a style in a component in weave-gitops:
116+
117+
```bash
118+
# build the weave-gitops ui-library
119+
cd weave-gitops
120+
git checkout cool-new-ui-feature
121+
make ui-lib
122+
123+
# use it in wge
124+
cd weave-gitops-enterprise/ui-cra
125+
126+
# optionally clean up node_modules a bit if changes don't seem to be coming through
127+
rm -rf node_modules/@weaveworks/weave-gitops/
128+
129+
# install local copy of weave-gitops ui-lib
130+
yarn add ../../weave-gitops/dist
131+
```
132+
93133
## How to update the version of `weave-gitops`
94134

95135
[`weave-gitops-enterprise`](https://github.com/weaveworks/weave-gitops-enterprise) depends on [`weave-gitops`](https://github.com/weaveworks/weave-gitops). When WG makes a new release we'll want to update the version WGE depends on. It goes a little something like this:
@@ -107,9 +147,32 @@ cd ui-cra && yarn add @weaveworks/weave-gitops@$WG_VERSION
107147
open "https://github.com/weaveworks/weave-gitops/tree/v${WG_VERSION}/manifests/crds"
108148
```
109149

110-
## How to update the demo cluster
150+
## The test cluster
151+
152+
The test cluster currently lives at a static ip but will hopefully move behind a DNS address with auth _soon_.
153+
154+
Hit up http://34.67.250.163:30080
155+
156+
### `kubectl` access
157+
158+
The private ssh key to the server lives in the `pesto test cluster ssh key` secret in 1Password.
159+
160+
1. Grab it and save it to `~/.ssh/cluster-key`
161+
2. Copy `kubeconfig` using this ssh key
162+
```
163+
scp -i ~/.ssh/cluster-key wks@$34.67.250.163:.kube/config demokubeconfig.txt
164+
```
165+
3. Port forward the api-server port (6443) in another tab
166+
```
167+
ssh -i ~/.ssh/cluster-key wks@$34.67.250.163 -L 6443:localhost:6443
168+
```
169+
4. Use the `kubeconfig`:
170+
```
171+
export KUBECONFIG=demokubeconfig.txt
172+
kubectl get pods -A
173+
```
111174

112-
The demo cluster currently lives at http://34.67.250.163:30080/ but will hopefully move behind a DNS address with auth _soon_.
175+
### How to update the test cluster
113176

114177
1. Figure out the version of chart you want to deploy. If we've done a release recently you can change it to `0.0.8` or a major version like that. To deploy a unreleased version from `main` or a `branch` we need to figure out the git ref version:
115178

0 commit comments

Comments
 (0)