diff --git a/.gitignore b/.gitignore index 7419e12..791457b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,9 @@ src/main/resources/application-local.yaml src/main/resources/application-dev.yaml src/**/monitored-environments-dev.yaml -pulumi/node_modules +/compose/data +/compose/application.yaml +/compose/monitored-environments.yaml /data/ /secrets/ diff --git a/README.md b/README.md index e7e2c0e..600049c 100644 --- a/README.md +++ b/README.md @@ -194,118 +194,17 @@ flowchart LR ## How to run -Here is a sample docker-compose local setup for: - -* Wombat app -* local BoaviztAPI & Ecologits instances -* a temporary sqlite + periodic S3 backup *(this is a demo ; on a local setup you would rather swap that out for an sqlite db file written to a docker volume and do away with the backup)* - - -```yaml -services: - wombat: - image: illuin/wombat:latest - ports: - - "8080:8080" - volumes: - - ./application.yaml:/deployments/config/application.yaml:ro - - ./monitored-environments.yaml:/deployments/monitored/monitored-environments.yaml:ro - - ./k8s:/deployments/monitored/k8s:ro - - boavizta: - image: ghcr.io/boavizta/boaviztapi:2.4.1 - - ecologits: - image: ghcr.io/mlco2/ecologits-api:0.0.2 - - seaweedfs: - image: chrislusf/seaweedfs - command: mini -dir=/data - ports: - - "8333:8333" # S3 endpoint - - "8888:8888" # Filer UI - - "9333:9333" # Master - - "23646:23646" # Admin UI - environment: - AWS_ACCESS_KEY_ID: admin - AWS_SECRET_ACCESS_KEY: secret - S3_BUCKET: wombat-bucket - volumes: - - seaweedfs-data:/data - -volumes: - seaweedfs-data: -``` +You can find a sample docker compose file for a basic local setup [here](compose/compose.yaml). -With the following `application.yaml` file: - -```yaml -quarkus: - datasource: - jdbc: - url: "jdbc:sqlite:/tmp/local.db" # if you disable the backup below, you can use a volume or local file instead, and remove seaweedfs from your compose file - -connector: - boavizta: - uri: "http://boavizta:5000/v1/" - ecologits: - uri: "http://ecologits:80/" - -backup: - enabled: true - cron: "0 */10 * * * ?" # every 10 minutes - cleanup: - cron: "0 */10 * * * ?" # every 10 minutes - retain-last: 10 - s3: - key-prefix: sqlite/local/ - endpoint: http://seaweedfs:8333 - region: "eu-west-1" - bucket: wombat-bucket - access-key: admin - secret-key: secret -``` +It will let you run: +* a Wombat app with an sqlite storage backend +* local Boavizta & Ecologits APIs -And the following `monitored-environments.yaml` file: - -```yaml -environments: - production: - id: production - assets: - # This type works by querying the kubernetes metrics API and gathering CPU/RAM load factors for each deployed container. - - type: tech.illuin.wombat-module.kubernetes-api - id: prod-cluster - environment-id: production - name: Production Cluster - namespace: my-project-namespace - config-path: /deployments/monitored/k8s/my-kube.config - profile: - provider: aws - instance-type: c5.xlarge - location: FRA - lifespan: 43800 - # This type works with a request yearly estimate and will prorate it dynamically. - # This is the bare minimum available in some situations. - - type: tech.illuin.wombat-module.llm-static - id: prod-llm - environment-id: production - name: LLM Services - profile: - models: - - provider: mistralai - model: mistral-large-latest - location: FRA - request-profile: - output-token-count: 500 - request-per-year: 500000 - - provider: openai - model: mistral-large-latest - location: SWE - request-profile: - output-token-count: 150 - request-per-year: 8000000 -``` +You will also find [`application.yaml.dist`](compose/application.yaml.dist) and [`monitored-environments.yaml.dist`](compose/monitored-environments.yaml.dist) files that you can use to create the required `application.yaml` and `monitored-environments.yaml`. + +The `application.yaml` template can be used as is, it's a basic setup that will simply override the connectors to use local Boavizta and Ecologits APIs, and enable the SQLite backend. + +The `monitored-environments.yaml` template however needs to be tweaked, you will find comments on the parts requiring your input. And a valid kubeconfig in `k8s/`, in the configuration above we've named it `my-kube.config`. diff --git a/compose/application.yaml.dist b/compose/application.yaml.dist new file mode 100644 index 0000000..a441c15 --- /dev/null +++ b/compose/application.yaml.dist @@ -0,0 +1,36 @@ +quarkus: + datasource: + jdbc: + url: "jdbc:sqlite:/var/data/local.db" + +# Alternative PostgreSQL Datasource for dev: +# quarkus: +# datasource: +# db-kind: postgresql +# username: wombat +# password: wombat +# jdbc: +# url: "jdbc:postgresql://localhost:5432/wombat" + +connector: + boavizta: + uri: "http://boavizta:5000/v1/" + ecologits: + uri: "http://ecologits:80/" + +# Local S3 Backup setup (e.g. SeaweedFS service) +# backup: +# enabled: false +# cron: "0 0 * * * ?" # hourly +# s3: +# key-prefix: sqlite/ +# endpoint: http://localhost:8333 +# bucket: wombat-bucket +# access-key: admin +# secret-key: secret + +# Optional Secret resolution directory: +# wombat: +# secret: +# directory: +# path: /secrets diff --git a/compose/compose.yaml b/compose/compose.yaml new file mode 100644 index 0000000..023e434 --- /dev/null +++ b/compose/compose.yaml @@ -0,0 +1,37 @@ +services: + wombat: + container_name: wombat + image: illuin/wombat:latest + ports: + - "8080:8080" + volumes: + - ./application.yaml:/deployments/config/application.yaml:ro + - ./monitored-environments.yaml:/deployments/monitored/monitored-environments.yaml:ro + - ~/.kube:/deployments/monitored/k8s:ro # you can load them from another local directory + - ./data:/var/data:rw + + boavizta: + container_name: boavizta + image: ghcr.io/boavizta/boaviztapi:2.4.1 + + ecologits: + container_name: ecologits + image: ghcr.io/mlco2/ecologits-api:0.0.2 + +# seaweedfs: +# image: chrislusf/seaweedfs +# command: mini -dir=/data +# ports: +# - "8333:8333" # S3 endpoint +# - "8888:8888" # Filer UI +# - "9333:9333" # Master +# - "23646:23646" # Admin UI +# environment: +# AWS_ACCESS_KEY_ID: admin +# AWS_SECRET_ACCESS_KEY: secret +# S3_BUCKET: wombat-bucket +# volumes: +# - seaweedfs-data:/data +# +#volumes: +# seaweedfs-data: \ No newline at end of file diff --git a/compose/monitored-environments.yaml.dist b/compose/monitored-environments.yaml.dist new file mode 100644 index 0000000..8574c28 --- /dev/null +++ b/compose/monitored-environments.yaml.dist @@ -0,0 +1,36 @@ +environments: + demo: + id: demo + assets: + # This type works by querying the kubernetes metrics API and gathering CPU/RAM load factors for each deployed container. + - type: tech.illuin.wombat-module.kubernetes-api + id: prod-cluster + environment-id: demo + name: Demo Cluster + namespace: my-project-namespace # this should match the namespace you deployed your applications to ; you can create several assets of the same time if multiple namespaces are monitored + config-path: /deployments/monitored/k8s/my-kube.config # this should point at your kubeconfig file ; note that the path coincides with the mounting point in the compose.yaml file + profile: # this should be tweaked to match the node your workloads is running on + provider: aws + instance-type: c5.xlarge + location: FRA + lifespan: 43800 + # This type works with a request yearly estimate and will prorate it dynamically. + # This is the bare minimum available in some situations. + - type: tech.illuin.wombat-module.llm-static + id: demo-llm + environment-id: demo + name: LLM Services + profile: + models: # this should be tweaked to match your model & model usage mix + - provider: mistralai + model: mistral-large-latest + location: FRA + request-profile: + output-token-count: 500 + request-per-year: 500000 + - provider: openai + model: mistral-large-latest + location: SWE + request-profile: + output-token-count: 150 + request-per-year: 8000000 \ No newline at end of file diff --git a/doc/docker/README.md b/doc/docker/README.md index 1b28274..d06f8ba 100644 --- a/doc/docker/README.md +++ b/doc/docker/README.md @@ -27,41 +27,26 @@ Here is a sample docker-compose local setup for: * local boavizta & ecologits APIs * temporary sqlite + periodic S3 backup (this is a demo ; on a local setup you would rather swap that out for an sqlite db file written to a docker volume and do away with the backup) - ```yaml services: wombat: + container_name: wombat image: illuin/wombat:latest ports: - "8080:8080" volumes: - ./application.yaml:/deployments/config/application.yaml:ro - ./monitored-environments.yaml:/deployments/monitored/monitored-environments.yaml:ro - - ./k8s:/deployments/monitored/k8s:ro + - ~/.kube:/deployments/monitored/k8s:ro # you can load them from another local directory + - ./data:/var/data:rw boavizta: + container_name: boavizta image: ghcr.io/boavizta/boaviztapi:2.4.1 ecologits: + container_name: ecologits image: ghcr.io/mlco2/ecologits-api:0.0.2 - - seaweedfs: - image: chrislusf/seaweedfs - command: mini -dir=/data - ports: - - "8333:8333" # S3 endpoint - - "8888:8888" # Filer UI - - "9333:9333" # Master - - "23646:23646" # Admin UI - environment: - AWS_ACCESS_KEY_ID: admin - AWS_SECRET_ACCESS_KEY: secret - S3_BUCKET: wombat-bucket - volumes: - - seaweedfs-data:/data - -volumes: - seaweedfs-data: ``` With the following `application.yaml` file: @@ -70,27 +55,13 @@ With the following `application.yaml` file: quarkus: datasource: jdbc: - url: "jdbc:sqlite:/tmp/local.db" # if you disable the backup below, you can use a volume or local file instead, and remove seaweedfs from your compose file + url: "jdbc:sqlite:/var/data/local.db" connector: boavizta: uri: "http://boavizta:5000/v1/" ecologits: uri: "http://ecologits:80/" - -backup: - enabled: true - cron: "0 */10 * * * ?" # every 10 minutes - cleanup: - cron: "0 */10 * * * ?" # every 10 minutes - retain-last: 10 - s3: - key-prefix: sqlite/local/ - endpoint: http://seaweedfs:8333 - region: "eu-west-1" - bucket: wombat-bucket - access-key: admin - secret-key: secret ``` And the following `monitored-environments.yaml` file: @@ -100,26 +71,26 @@ environments: demo: id: demo assets: - # This type works by querying the kubernetes metrics API and gathering CPU/RAM load factors for each deployed container. + # This type works by querying the kubernetes metrics API and gathering CPU/RAM load factors for each deployed container. - type: tech.illuin.wombat-module.kubernetes-api id: prod-cluster environment-id: demo name: Demo Cluster - namespace: my-project-namespace - config-path: /deployments/monitored/k8s/my-kube.config - profile: + namespace: my-project-namespace # this should match the namespace you deployed your applications to ; you can create several assets of the same time if multiple namespaces are monitored + config-path: /deployments/monitored/k8s/my-kube.config # this should point at your kubeconfig file ; note that the path coincides with the mounting point in the compose.yaml file + profile: # this should be tweaked to match the node your workloads is running on provider: aws instance-type: c5.xlarge location: FRA lifespan: 43800 - # This type works with a request yearly estimate and will prorate it dynamically. + # This type works with a request yearly estimate and will prorate it dynamically. # This is the bare minimum available in some situations. - type: tech.illuin.wombat-module.llm-static id: demo-llm environment-id: demo name: LLM Services profile: - models: + models: # this should be tweaked to match your model & model usage mix - provider: mistralai model: mistral-large-latest location: FRA @@ -134,7 +105,7 @@ environments: request-per-year: 8000000 ``` -And a valid kubeconfig in `k8s/`, in the configuration above we've named it `my-kube.config`. +And a valid kubeconfig in `~/.kube`, in the configuration above we've named it `my-kube.config`. ### Custom Extensions