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