Matt Ray ebaed2d94d Merge branch 'develop' into readme_video 2 роки тому
..
src ebaed2d94d Merge branch 'develop' into readme_video 2 роки тому
.babelrc 0aa63fb1f2 A few housekeeping updates for the opencost UI: 3 роки тому
.dockerignore 3734cd3618 Update opencost ui doc 3 роки тому
.nvmrc 0aa63fb1f2 A few housekeeping updates for the opencost UI: 3 роки тому
Dockerfile 25039598e8 Sync Dockerfile and Dockerfile.cross and run as non-root user 2 роки тому
Dockerfile.cross 25039598e8 Sync Dockerfile and Dockerfile.cross and run as non-root user 2 роки тому
README.md 7c046a3ebb Updated dependencies and instructions for building 2 роки тому
default.nginx.conf 5980817e4c Routing to Cloud cost page 2 роки тому
docker-entrypoint.sh 08e3e47a07 Updating script in dockerfile entrypoint to run parent containers entrypoint script 3 роки тому
justfile 519c78fa72 Run builds locally before containerizing and add multi-arch support (#1941) 3 роки тому
nginx.conf a07a4f451c Allow ui to run from non privileged 3 роки тому
package-lock.json 9787553c75 Fixed capitalization in files. 2 роки тому
package.json ed928002a8 Modified to use new Cloud cost View Endpoints 2 роки тому

README.md

OpenCost UI

Installing

See https://www.opencost.io/docs/install for the full instructions.

helm install my-prometheus --repo https://prometheus-community.github.io/helm-charts prometheus \
  --namespace prometheus --create-namespace \
  --set pushgateway.enabled=false \
  --set alertmanager.enabled=false \
  -f https://raw.githubusercontent.com/opencost/opencost/develop/kubernetes/prometheus/extraScrapeConfigs.yaml

kubectl apply --namespace opencost -f https://raw.githubusercontent.com/opencost/opencost/develop/kubernetes/opencost.yaml

Using

After following the installation instructions, access the UI by port forwarding:

kubectl port-forward --namespace opencost service/opencost 9090

Running Locally

The UI can be run locally using the npm run serve command.

$ npm install
...
$ npm run serve
> opencost-ui@0.1.0 serve
> npx parcel serve src/index.html

Server running at http://localhost:1234
✨ Built in 1.96s

And can have a custom URL backend prefix.

BASE_URL=http://localhost:9090/test npm run serve

> opencost-ui@0.1.0 serve
> npx parcel serve src/index.html

Server running at http://localhost:1234
✨ Built in 772ms

In addition, similar behavior can be replicated with the docker container:

$ docker run -e BASE_URL_OVERRIDE=test -p 9091:9090 -d opencost-ui:latest
$ curl localhost:9091
<html gibberish>

Overriding the Base API URL

For some use cases such as the case of OpenCost deployed behind an ingress controller, it is useful to override the BASE_URL variable responsible for requests sent from the UI to the API. This means that instead of sending requests to <domain>/model/allocation/compute/etc, requests can be sent to <domain>/{BASE_URL_OVERRIDE}/allocation/compute/etc. To do this, supply the environment variable BASE_URL_OVERRIDE to the docker image.

$ docker run -p 9091:9090 -e BASE_URL_OVERRIDE=anything -d opencost-ui:latest