mirror of
https://github.com/KevinMidboe/infra-map.git
synced 2025-10-29 17:40:28 +00:00
81 lines
1.9 KiB
Markdown
81 lines
1.9 KiB
Markdown
# infra-map
|
|
|
|
## Configuration setup
|
|
|
|
set the following env variables during runtime or update `.env` file.
|
|
|
|
### Kubernetes
|
|
|
|
Required parameters:
|
|
|
|
```bash
|
|
KUBERNETES_SERVICE_HOST=https://IP_ADDRESS:16443
|
|
KUBERNETES_CA_CART_PATH=kube-ca.crt
|
|
KUBERNETES_SA_TOKEN=LKdgk34l...
|
|
```
|
|
|
|
The `KUBERNETES_SERVICE_HOST` is the api server, [microk8s documentation](https://microk8s.io/docs/services-and-ports#services-binding-to-the-default-host-interface) describes that API server is running at port `16443`. Runtime in a pod this will be set by kubernetes.
|
|
|
|
Get ca_cert from the any running pod at: `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt`.
|
|
|
|
### Proxmox
|
|
|
|
Required parameters:
|
|
|
|
```bash
|
|
PROXMOX_URL=https://apollo.schleppe:8086/api2/json/
|
|
PROXMOX_TOKEN=PVEAPITOKEN=USER@pve!USER=TOKEN_VALUE
|
|
```
|
|
|
|
`PROXMOX_TOKEN` should contain the sub-variable `PVEAPITOKEN` that describes a proxmox API token.
|
|
|
|
Create api token:
|
|
|
|
- Create Users
|
|
- user name: infra-map
|
|
- realm: pve
|
|
- expire: never
|
|
- Add API tokens
|
|
- user: infra-map@pve
|
|
- token ID: infra-map
|
|
- Permissions
|
|
- add: API Token permissions
|
|
- path: /
|
|
- api-token: infra-map@pve!infra-map
|
|
- role: Administrator
|
|
- propagate: true
|
|
|
|
## Home Assistant
|
|
|
|
Required parameters:
|
|
|
|
```bash
|
|
HOMEASSISTANT_URL=http://homeassistant.schleppe:8123/api/states
|
|
HOMEASSISTANT_TOKEN=
|
|
```
|
|
|
|
Follow hass documentation on generating a api token: https://developers.home-assistant.io/docs/auth_api/#long-lived-access-token.
|
|
|
|
## Developing
|
|
|
|
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
|
|
```bash
|
|
npm run dev
|
|
|
|
# or start the server and open the app in a new browser tab
|
|
npm run dev -- --open
|
|
```
|
|
|
|
## Building
|
|
|
|
To create a production version of your app:
|
|
|
|
```bash
|
|
npm run build
|
|
```
|
|
|
|
You can preview the production build with `npm run preview`.
|
|
|
|
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|