From 23c7e2b7854e42afa4e2a86a24ae6dedc99a6ad7 Mon Sep 17 00:00:00 2001 From: augustus Date: Thu, 12 Mar 2026 18:03:22 +0300 Subject: [PATCH] Added Spring Cloud Gateway --- kilimo-gateway-localhost.yml | 17 +++++++++ kilimo-gateway-production.yml | 17 +++++++++ kilimo-service-localhost.yml | 8 ++-- kilimo-service-production.yml | 10 +++-- kilimo-service-staging.yml | 72 ----------------------------------- 5 files changed, 45 insertions(+), 79 deletions(-) create mode 100644 kilimo-gateway-localhost.yml create mode 100644 kilimo-gateway-production.yml delete mode 100644 kilimo-service-staging.yml diff --git a/kilimo-gateway-localhost.yml b/kilimo-gateway-localhost.yml new file mode 100644 index 0000000..e835fdd --- /dev/null +++ b/kilimo-gateway-localhost.yml @@ -0,0 +1,17 @@ +server: + port: 9080 +spring: + application: + name: kilimo-gateway + cloud: + gateway: + httpclient: + connect-timeout: 5000 + response-timeout: 10s + routes: + - id: kilimo_service_route + uri: http://localhost:9081 + predicates: + - Path=/users/** + filters: + - StripPrefix=1 \ No newline at end of file diff --git a/kilimo-gateway-production.yml b/kilimo-gateway-production.yml new file mode 100644 index 0000000..e835fdd --- /dev/null +++ b/kilimo-gateway-production.yml @@ -0,0 +1,17 @@ +server: + port: 9080 +spring: + application: + name: kilimo-gateway + cloud: + gateway: + httpclient: + connect-timeout: 5000 + response-timeout: 10s + routes: + - id: kilimo_service_route + uri: http://localhost:9081 + predicates: + - Path=/users/** + filters: + - StripPrefix=1 \ No newline at end of file diff --git a/kilimo-service-localhost.yml b/kilimo-service-localhost.yml index 7b56aef..f81d028 100644 --- a/kilimo-service-localhost.yml +++ b/kilimo-service-localhost.yml @@ -1,5 +1,5 @@ server: - port: 9080 + port: 9081 spring: application: name: farm-kilimo-ms-core @@ -36,8 +36,10 @@ jwt: assistant: base: "You are Kilimo Assistant, an expert in farm and agriculture questions only." generateJson: "Return a JSON with fields: content (string), violate (bool if outside your expertise)." - generateTitle: "Add a short title field in the JSON." - generateActions: "Add an actions field in the JSON with relevant actions from the list below." + generateTitle: "Add a short 'title' field in the JSON." + generateActions: "Add an 'actions' field in the JSON with relevant actions from the list below." + userMemory: "Consider these facts about user and generate any new(max 3) and add to 'userFacts' field in json" + chatMemory: "Consider these facts about this chat and generate any new(max 3) and add to 'chatFacts' field in json" models: - name: deepseek-gpt-4 url: https://api.deepseek.com/chat/completions diff --git a/kilimo-service-production.yml b/kilimo-service-production.yml index 6aa5b18..a5e68fd 100644 --- a/kilimo-service-production.yml +++ b/kilimo-service-production.yml @@ -1,5 +1,5 @@ server: - port: 9080 + port: 9081 spring: application: name: farm-kilimo-ms-core @@ -35,9 +35,11 @@ jwt: expiration: 86400000 assistant: base: "You are Kilimo Assistant, an expert in farm and agriculture questions only." - generateJson: "Return a JSON with fields: content (string), violate (bool if outside your expertise)." - generateTitle: "Add a short title field in the JSON." - generateActions: "Add an actions field in the JSON with relevant actions from the list below." + generateJson: "Return a JSON with fields: 'content'(string) and 'violate'(bool) if outside your expertise)." + generateTitle: "Add a short 'title' field in the JSON." + generateActions: "Add an 'actions'(string array) field in the JSON with relevant actions from below." + userMemory: "Consider these facts about user and generate any new(max 3) and add to 'userFacts'(string array) field in json" + chatMemory: "Consider these facts about this chat and generate any new(max 3) and add to 'chatFacts'(string array) field in json" models: - name: deepseek-gpt-4 url: https://api.deepseek.com/chat/completions diff --git a/kilimo-service-staging.yml b/kilimo-service-staging.yml deleted file mode 100644 index db0d48d..0000000 --- a/kilimo-service-staging.yml +++ /dev/null @@ -1,72 +0,0 @@ -server: - port: 9080 -spring: - application: - name: farm-kilimo-ms-core - data: - redis: - host: localhost - port: 6379 - datasource: - url: jdbc:postgresql://145.241.246.130:5432/kilimo - username: apiuser - password: 4hKiOnTqbP2kLwR - driver-class-name: org.postgresql.Driver - jpa: - show-sql: false - hibernate: - ddl-auto: update - database-platform: org.hibernate.dialect.PostgreSQLDialect -logging: - pattern: - console: "%d{HH:mm:ss.SSS} [%X{requestId}] %-5level %logger{36} - %msg%n" -cors: - allowed-origins: - - https://zp1v56uxy8rdx5ypatb0ockcb9tr6a-oci3-m1d8v647--5173--96435430.local-credentialless.webcontainer-api.io/ -jwt: - secret: U7R7yI7oF5wI5Of5qTnS83uWhhRr9mY8ftkbvEtN/fc= - access: - expiration: 900000 - refresh: - expiration: 604800000 - verification: - expiration: 86400000 - device: - expiration: 86400000 -assistant: - base: "You are Kilimo Assistant, an expert in farm and agriculture questions only." - generateJson: "Return a JSON with fields: content (string), violate (bool if outside your expertise)." - generateTitle: "Add a short title field in the JSON." - generateActions: "Add an actions field in the JSON with relevant actions from the list below." - models: - - name: deepseek-gpt-4 - url: https://api.deepseek.com/chat/completions - access: - key: Authorization - value: Bearer sk-52cdbf062bdf4e45aa39734e1bb2f813 - - name: gemini-3-flash-preview - url: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent - access: - key: x-goog-api-key - value: AIzaSyA3DXZUXLIYcMFWaWuZMmtzTU8RMIBg1Yk - actions: - - CREATE_FARM - - START_IRRIGATION - - HARVEST_CROPS - - PEST_CONTROL - - FERTILIZATION - - SOIL_TESTING - - WEATHER_FORECAST - - CROP_SELECTION - - DISEASE_DIAGNOSIS - - YIELD_PREDICTION - - IRRIGATION_SCHEDULING - - MARKET_PRICES - - FARM_EQUIPMENT_MAINTENANCE -s3: - endpoint: https://api.storage.kilimo.farm - region: us-east-1 - access-key: nHSi4lEhgoFJ2QwVGazc - secret-key: WeK42mbjlBkAQrx3ghin5zF8UIw6cJ7CNG9HpqEO - bucket-name: kilimo - file-expiry: 3 \ No newline at end of file