-
Notifications
You must be signed in to change notification settings - Fork 2
Add local dev command to run backend and plugin #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,3 +53,5 @@ install-state.gz | |
| # Built binaries | ||
| /bin | ||
| pages/plugin.yaml | ||
| /public | ||
| backend/main | ||
|
Comment on lines
+56
to
+57
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, why are those two added? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,7 +55,9 @@ Available image tags are listed in the [container registry](https://github.com/f | |
| In one terminal window, run: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you update the entire Option 1 (rename to Setup) section to say that init.sh should be used to start the dev env? A few more things:
|
||
|
|
||
| 1. `yarn install` | ||
| 2. `yarn run start` | ||
| 2. `yarn dev` | ||
|
|
||
| This starts both the Go backend server (port 8080) and the webpack dev server (port 9001) in a single process. | ||
|
|
||
| In another terminal window, run: | ||
|
|
||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're having an Maybe you can wire it all up in the init.sh script, so the pages assets are build every time we start the development environment? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # Build pages assets into backend/static so the embedded FS serves them | ||
| echo "Building pages assets..." | ||
| helm template console-functions-plugin charts/openshift-console-plugin \ | ||
| -n console-functions-plugin \ | ||
| --set plugin.image=ghcr.io/functions-dev/console-functions-plugin:latest \ | ||
| > backend/static/plugin.yaml | ||
| cp pages/index.html backend/static/index.html | ||
|
|
||
| # Track background PIDs for cleanup | ||
| PIDS=() | ||
| cleanup() { | ||
| echo "" | ||
| echo "Stopping dev servers..." | ||
| for pid in "${PIDS[@]}"; do | ||
| kill "$pid" 2>/dev/null || true | ||
| done | ||
| rm -f backend/static/plugin.yaml backend/static/index.html | ||
| wait | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| # Start backend API server (also serves pages via embedded static files) | ||
| echo "Starting backend server on :8080..." | ||
| (cd backend && go run ./main.go -http-port 8080) & | ||
| PIDS+=($!) | ||
|
|
||
| # Start webpack dev server | ||
| echo "Starting webpack dev server..." | ||
| yarn webpack serve --progress & | ||
| PIDS+=($!) | ||
|
|
||
| echo "" | ||
| echo "Dev environment running:" | ||
| echo " Backend: http://localhost:8080" | ||
| echo " Plugin: http://localhost:9001" | ||
| echo "" | ||
|
|
||
| wait |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably should ignore those too:
backend/static/plugin.yamlbackend/static/index.htmlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, it's leftover from my experiments. I'll clean it up.