https://github.com/exceptionless/Exceptionlesshtml
https://github.com/exceptionless/Exceptionless.UInode
項目拉下來,nuget還原下,這裏我是一直還原不上的,後面強了就對了(最近github一直比較慢,nuget也是慢死了)nginx
先是用了它的docker-compose 裏面東西太多了,job老是有問題,後面用源碼本身創建一個dockerfile 來打包git
打包UI 須要用 github
npx grunt build
須要安裝 grunt 這裏就不介紹了redis
經過以前的 用nginx來打包ui 就好了docker
經過命令推送到 Harborbootstrap
固然也須要安裝elasticsearch 5.X ,容器很方便的,後面用容器便可建立es了api
一塊兒看起來都很容易app
後面檢查了源碼發現 模式非Localhost環境下是須要用 https的
services.AddMvc(o => { o.Filters.Add(new CorsAuthorizationFilterFactory("AllowAny")); o.Filters.Add<RequireHttpsExceptLocalAttribute>(); o.Filters.Add<ApiExceptionFilter>(); o.ModelBinderProviders.Insert(0, new CustomAttributesModelBinderProvider()); o.InputFormatters.Insert(0, new RawRequestBodyFormatter()); })
public sealed class RequireHttpsExceptLocalAttribute : RequireHttpsAttribute { public RequireHttpsExceptLocalAttribute() { IgnoreLocalRequests = true; } }
[ApiController] [RequireHttpsExceptLocal] public abstract class ExceptionlessApiController : Controller { }
使用的時候須要註釋一下
分別運行容器 ,這裏須要注意的是es容器和exceptionless 要作對於的資料卷掛載 ,後面我統一整理到 docker-compose中
發現都是OK的。
爲了實現一鍵搞定,整理了一個docker-compose 以下
version: "3.3" volumes: #el exceptionless_data: driver: local #es elasticsearch_data: driver: local # el使用的es elasticsearch_el_data: driver: local services: # redis 服務 redis: image: redis:5.0.3-alpine3.8 container_name: stu-exam_redis # deploy: # mode: replicated # replicas: 1 # resources: # limits: # cpus: '0.50' # memory: 256M # reservations: # cpus: '0.10' # memory: 50M # restart_policy: # condition: on-failure # delay: 5s # max_attempts: 3 command: redis-server /usr/local/etc/redis/redis.conf expose: - '6379' ports: - 6379:6379 volumes: - ./redis/data:/data - ./redis/redis.conf:/usr/local/etc/redis/redis.conf #ES 5.X master elasticsearch_master: image: elasticsearch:5.6.16 container_name: stu-exam_es_master environment: - "ES_JAVA_OPTS=-Xms1g -Xmx1g" - ES_CLUSTERNAME=elasticsearch command: elasticsearch volumes: - elasticsearch_data:/usr/share/elasticsearch/data - ./elasticsearch/node/master/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml ports: - 9200:9200 - 9300:9300 # ES node01 # elasticsearch_node01: # image: elasticsearch:5.6.16 # container_name: stu-exam_es_node01 # environment: # - bootstrap.memory_lock=true # - "ES_JAVA_OPTS=-Xms1g -Xmx1g" # - ES_CLUSTERNAME=elasticsearch # command: elasticsearch # volumes: # - elasticsearch_data/node/node01/data:/usr/share/elasticsearch/data # - ./elasticsearch/node/node01/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml # ports: # - 9200:9200 # - 9300:9300 # links: # - elasticsearch_master #el_api exceptionless_api: image: xxxx/tools/exceptionless_api:pro-1.0 container_name: stu-exam_exceptionless_api # environment: # AppMode: Production # EX_ConnectionStrings__Cache: provider=redis # EX_ConnectionStrings__Elasticsearch: server=http://192.168.0.240:9200 # EX_ConnectionStrings__MessageBus: provider=redis # EX_ConnectionStrings__Queue: provider=redis # #EX_ConnectionStrings__Metrics: provider=statsd;server=statsd; # EX_ConnectionStrings__Queue: provider=redis # EX_ConnectionStrings__Redis: server=redis,abortConnect=false # EX_ConnectionStrings__Storage: provider=folder;path=/app/storage # EX_RunJobsInProcess: 'false' links: - elasticsearch_master:es-master - redis expose: - '80' ports: - 65000:80 volumes: - exceptionless_data:/appexceptionless/storage - ./exceptionless/appsettings.Production.yml:/appexceptionless/appsettings.Production.yml depends_on: - elasticsearch_master # el_ui exceptionless_ui: image: xxx/tools/exceptionless_ui:pro-1.0 environment: AppMode: Development # EL-API 配置外部URL BaseUrl: http://192.168.0.240:65000 ports: - 5100:80 volumes: - ./exceptionless/conf.js:/usr/share/nginx/html/app.config.11aa095b02872a76.js depends_on: - exceptionless_api
經過 docker-compose up 啓動所有就搞定了 固然也能夠經過 docker-compose 指定的服務名稱來啓動(exceptionless_ui) ,服務會根據depends_on依賴關係來肯定啓動的前後順序。
可是後面使用客戶端添加日誌,發現日誌並無記錄在裏面,出現了錯誤
解決辦法:
原來是由於咱們使用容器安裝的包或者本身下載的es包中缺乏插件,這裏這個錯誤就須要安裝 mapper-size 這個插件,安裝好了,客戶端就添加進去了,怎麼安裝就不介紹了,咱們在容器內部安裝好相關插件後本身在打包一個本身的es鏡像就能夠了
最後還有一個問題就是 當咱們要重新運行 elasticsearch容器的時候,記得也要從新運行 exceptionless_api,否則當elasticsearch rm掉以後,exceptionless_api訪問會出現問題 mapper相關的問題,多是由於 exceptionless_api 再次訪問會重新建立 es 分片的緣由
docker run -d --name=elasticsearch_node1 \ -v /root/customdata/es/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \ -v /root/customdata/es/data:/usr/share/elasticsearch/data \ -v /root/customdata/es/plugins/:/usr/share/elasticsearch/plugins/ \ -p 9400:9200 -p 9500:9300 elasticsearch:5.6.16 ui: docker run -d --name=exceptionlessui_node1 -v /root/customdata/exceptionless_ui/app.config.js:/usr/share/nginx/html/app.config.11aa095b02872a76.js -p 40007:80 xxxx/tools/exceptionless_ui:pro-1.0 exceptionlessapi: docker run -d --name=exceptionlessapi_node1 -v /root/customdata/exceptionless_api/appsettings.Production.yml:/appexceptionless/appsettings.Production.yml \ -v /root/customdata/exceptionless_api/storage/:/appexceptionless/storage \ -p 40008:80 xxxx/tools/exceptionless_api:pro-1.0