Created
December 10, 2021 09:03
-
-
Save niquola/e19d19e1549b60c6b176c0b7cd4bbeb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:infrabox/matrix {ns ["prod" "staging"]} | |
:gcp {} | |
:helm {} | |
:k8s | |
{:monitoring | |
{:infrabox/service | |
{:kibana {:image "docker.elastic.co/kibana/kibana:7.13.2" | |
:proxy {:port 5601 | |
:host (str "kibana." domain) | |
:user (secret-src [:kibana :user] "admin") | |
:password (secret-src [:kibana :password])} | |
:config {:ELASTICSEARCH_HOSTS (service-url {:system :logs})} | |
:probe {:port 80 :path "/__healthcheck"}}} | |
:infrabox/db | |
{:elastic {:image (config [:logs :es :image]) | |
:init [["sh" "-c" "ulimit -n 65536"] | |
["sysctl" "-w" "vm.max_map_count=262144"], | |
["sh" "-c" (format "chown -R 1000:1000 %s" (self :volumes :data :mount))]] | |
:http {:db {:port 9200 | |
:labels {:system :logs} | |
:grafana/datasource {:type :elastic}}} | |
:config {:cluster.name "logs" | |
:bootstrap.memory_lock "true" | |
:ES_JAVA_OPTS (format "-Xms%sm -Xmx%sm" (config [:logs :es :memory]) (config [ns :es :memory])) | |
:discovery.type "single-node"} | |
:volumes {:data {:mount "/usr/share/elasticsearch/data" | |
:storage (config [:logs :es :size])}} | |
:sidecars | |
{:exporter {:image "quay.io/prometheuscommunity/elasticsearch-exporter:latest" | |
:command {:infrabox/format :cli/opts | |
:es.uri (str "http://localhost" (self :http :db :port))} | |
:http {:metrics {:port 9114 :prometheus/scrapes {}}}}}} | |
:prom {:image "prom/prometheus:v2.30.3" | |
:tcp {:db {:port 9090 | |
:grafana/datasource {:type :prometheus} | |
:prometheus/scrapes {:prometheus {}}}} | |
:proxy {:port (self :tcp :db :port) | |
:host (str "prometheus." domain) | |
:user (secret-src [:kibana :user] "admin") | |
:password (secret-src [:kibana :password])} | |
:command {:fmt :cli/opts | |
:config.file (self :files :config :path) | |
:storage.tsdb.path (self :volumes :data :mount) | |
:storage.tsdb.retention.time (config [:prom :retention.time] "14d") | |
:web.enable-lifecycle true | |
:web.console.libraries "/usr/share/prometheus/console_libraries" | |
:web.console.templates "/usr/share/prometheus/consoles"} | |
:files {:config {:path "/etc/prometheus/config.yaml" | |
:yaml {:global {:scrape_interval "15s" | |
:evaluation_interval "15s"} | |
:scrape_configs (search :prometheus/scrapes)}}} | |
:volumes {:data {:mount "/prometheus" | |
:storage (config [:prom :size] "50Gi")}}} | |
:grafana {:image "grafana/grafana:8.3.0" | |
:http {:web {:port 3000 | |
:host (str "grafana." domain)}} | |
:dirs {:path "/etc/grafana/provisioning" | |
"datasources" (search :grafana/datasources)} | |
:volumes {:data {:mount "/var/lib/grafana" | |
:storage (config [:grafana :storage] "20Gi")}}}}} | |
ns | |
{:infrabox/service | |
{:aidbox {:image (config [ns :aidbox :image] "healthsamurai/aidboxone:edge") | |
:resources {} | |
:http {:metrics {:port 8765 | |
:prometheus/scrapes | |
{:default {:path "/metrics"} | |
:minutes {:path "/metrics/minutes"} | |
:hours {:path "/metrics/hours"}}} | |
:web {:port 8080 | |
:host (str "staging." (config [ns :aidbox :domain]))}} | |
:secrets {:AIDBOX_LICENSE_KEY (secret [:aidbox :license :id]) | |
:AIDBOX_LICENSE_ID (secret [:aidbox :license :key]) | |
:AIDBOX_CLIENT_ID (secret-src [:aidbox :client :id] "admin") | |
:AIDBOX_CLIENT_SECRET (secret-src [:aidbox :client :secret]) | |
:AIDBOX_ADMIN_ID (secret-src [:aidbox :admin :id] "admin") | |
:AIDBOX_ADMIN_PASSWORD (secret-src [:aidbox :admin :password]) | |
:PGUSER (secret [ns :pg :user]) | |
:PGPASSWORD (secret [ns :pg :password])} | |
:config {:AIDBOX_FHIR_VERSION (config [ns :aidbox :fhir] "4.0.1") | |
:AIDBOX_PORT (self :http :web :port) | |
:PGDATABASE "aidbox" | |
:PGHOST (service-search {:db :aidbox} :host) | |
:PGPORT (service-search {:db :aidbox} :port) | |
:AIDBOX_ES_URL (service-url {:system :logs}) | |
:AIDBOX_ES_BATCH_SIZEL (config [ns :aidbox :es :batch] 100) | |
:AIDBOX_ES_INDEX_PAT (format "'%s-aidbox'-yyyy-MM-dd" ns) | |
:BOX_METRICS_PORT (self :http :metrics :port)}}} | |
:infrabox/db | |
{:db {:image (config [ns :pg :image] "healthsamurai/aidboxdb:13.2") | |
:tcp {:db {:port 5432 | |
:grafana/datasource {:type :postgres}}} | |
:resources {} | |
:volumes {:data {:mount "/data" | |
:size (config [ns :pg :size] "100Gi")}} | |
:secrets {:POSTGRES_USER (secret-src [ns :pg :user] "postgres") | |
:POSTGRES_PASSWORD (secret-src ns :pg :password) | |
:GOOGLE_APPLICATION_CREDENTIALS (self :xfiles :gcp-key.json) | |
:WALG_GS_PREFIX (config [ns :pg :walg :gs :prefix])} | |
:xfiles {:path "/etc/xfiles" | |
:gcp-key.json (secret [ns :walg :gs :account])} | |
:files {:path "/etc/postgres" | |
:postgresql.conf {:infrabox/format :pg-conf | |
:wal_level "logical" | |
:archive_mode "on" | |
:archive_command "'wal-g wal-push %p'" | |
:restore_command "'wal-g wal-fetch %f %p'"}}}}}}} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment