|
|
%!s(int64=2) %!d(string=hai) anos | |
|---|---|---|
| .. | ||
| src | %!s(int64=2) %!d(string=hai) anos | |
| .babelrc | %!s(int64=3) %!d(string=hai) anos | |
| .dockerignore | %!s(int64=3) %!d(string=hai) anos | |
| .nvmrc | %!s(int64=3) %!d(string=hai) anos | |
| Dockerfile | %!s(int64=2) %!d(string=hai) anos | |
| Dockerfile.cross | %!s(int64=2) %!d(string=hai) anos | |
| README.md | %!s(int64=2) %!d(string=hai) anos | |
| default.nginx.conf.template | %!s(int64=2) %!d(string=hai) anos | |
| docker-entrypoint.sh | %!s(int64=2) %!d(string=hai) anos | |
| justfile | %!s(int64=2) %!d(string=hai) anos | |
| nginx.conf | %!s(int64=3) %!d(string=hai) anos | |
| package-lock.json | %!s(int64=2) %!d(string=hai) anos | |
| package.json | %!s(int64=2) %!d(string=hai) anos | |
See https://www.opencost.io/docs/install for the full instructions.
helm install prometheus --repo https://prometheus-community.github.io/helm-charts prometheus \
--namespace prometheus-system --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
After following the installation instructions, access the UI by port forwarding:
kubectl port-forward --namespace opencost service/opencost 9090
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>
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