Introduction to Exceptionless 5.0.0 Local Docker Rapid Deployment

Keywords: Database Docker Redis yum ElasticSearch

I've written two articles about it before. Use and deployment of Exceptionless, an open source log project But it was based on version 4.1.0 (release in 2017), and Exceptionless launched version 5.0.0 more than two years later.

I. About Exceptionless 5.0.0

Exceptionless is an open source, real-time and useful log collection framework, which makes log collection easy to use and does not require much technical details and configuration. But previous versions of Web and API have been tied to the Windows platform and run through IIS, which seems a bit out of place for entering the cloud era. The release of 5.0.0 solves this pain point. The biggest change is to rewrite and support cross-platform based on ASP.NET Core. That is to say, the original idea of deploying Docker-based Linux servers has been realized. Thank you all for contributing to Exceptionless project. ___________. This article introduces the rapid deployment of development and production environments in Exceptionless version 5.0.0. I believe it will be helpful for interested friends.

At this point, I can also migrate our previous Exceptionless from Windows Server to Linux!

II. Rapid Local Deployment Steps

2.1 Installation of Docker 18.09+

Since a pre-requirement of Exceptionless 5.0.0 is that the Docker version (CE) is 18.09 or above, we need to install an 18.09+DockerCE version on the Linux server. If you installed it before, you can skip this step, but if the version is less than 18.09, please clean up the old version and upgrade to the new version. The upgraded version can refer to the following steps.

The experimental environment: Aliyun ECS Host,CentOS 7.4

(1) Clean up the old version of Docker

Stop the old version of Docker:

systemctl stop docker

Uninstall the package:

yum erase docker \
    docker-client \
    docker-client-latest \
    docker-common \
    docker-latest \
    docker-latest-logrotate \
    docker-logrotate \
    docker-selinux \
    docker-engine-selinux \
    docker-engine \
    docker-ce

Delete the relevant configuration file:

find /etc/systemd -name '*docker*' -exec rm -f {} \;
find /etc/systemd -name '*docker*' -exec rm -f {} \;
find /lib/systemd -name '*docker*' -exec rm -f {} \;
rm -rf /var/lib/docker   #Delete previously existing mirrors and containers, not necessary, prudently
rm -rf /var/run/docker  

(2) Install Docker 18.09+

Package Installation:

yum install -y yum-utils  device-mapper-persistent-data lvm2

Add yum source:

yum-config-manager \
--add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

View Installable Version: The latest version is now 19.03

yum list docker-ce --showduplicates | sort -r

Install the specified version: 18.09

yum install docker-ce docker-ce-18.09.9-3.el7 -y

Start Docker and set boot self-startup:

systemctl start docker
systemctl enable docker

View the Docker version:

docker version 

As you can see, it's 18.09:

2.2 Download Exceptionless 5.0.0 Release package

Portal: Exceptionless release

2.3 Install Exceptionless 5.0.0

(1) Modify the docker-compose.yml file and set the external access address/domain name (adapted to your server IP address or domain name + SSL certificate, here I directly modify the external IP address of my Aliyun server, refer to my comments)

version: '3.4'

services:
  api:
    depends_on:
      - elasticsearch
      - redis
    build:
      context: .
      target: api
    image: exceptionless/api:latest
    restart: on-failure
    environment:
      EX_AppMode: Production
      EX_BaseURL: http://192.168.16.170:5100 UI address, modify the IP address here for your server IP address
      EX_ConnectionStrings__Cache: provider=redis
      EX_ConnectionStrings__Elasticsearch: server=http://elasticsearch:9200
      #EX_ConnectionStrings__Email: smtps://user:password@smtp.host.com:587
      EX_ConnectionStrings__MessageBus: 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'
    ports:
      - 5000:80 # This can be commented out if using reverse proxy.
    volumes:
      - appdata:/app/storage

  jobs:
    depends_on:
      - api
    build:
      context: .
      target: job
    image: exceptionless/job:latest
    restart: on-failure
    environment:
      EX_AppMode: Production
      EX_BaseURL: http://192.168.16.170:5100 UI address, modify the IP address here for your server IP address
      EX_ConnectionStrings__Cache: provider=redis
      EX_ConnectionStrings__Elasticsearch: server=http://elasticsearch:9200
      #EX_ConnectionStrings__Email: smtps://user:password@smtp.host.com:587
      EX_ConnectionStrings__MessageBus: 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
    volumes:
      - appdata:/app/storage

  ui:
    image: exceptionless/ui:latest
    environment:
      AppMode: Production
      EX_ApiUrl: http://192.168.16.170:5000 #API address, modify the IP address here for your server IP address
      #EX_Html5Mode: 'false'
      #EX_EnableSsl: 'false'
      #EX_EnableAccountCreation: 'false'
    ports:
      - 5100:80 # This can be commented out if using reverse proxy.

#  reverseproxy:
#    depends_on:
#      - api
#      - ui
#    image: valian/docker-nginx-auto-ssl
#    restart: on-failure
#    ports:
#      - 80:80
#      - 443:443
#    volumes:
#      - ssldata:/etc/resty-auto-ssl
#    environment:
#      ALLOWED_DOMAINS: '(ex-ui|ex-api).mydomainn.com'
#      SITES: 'ex-ui.mydomainn.com=ui;ex-api.mydomainn.com=api'

  elasticsearch:
    image: exceptionless/elasticsearch:1
    restart: on-failure
    environment:
      cluster.name: 'exceptionless'
      bootstrap.memory_lock: 'true'
      discovery.type: single-node
      ES_JAVA_OPTS: '-Xms512m -Xmx512m'
      xpack.security.enabled: 'false'
      xpack.graph.enabled: 'false'
      xpack.watcher.enabled: 'false'
    ports:
      - 9200:9200
      - 9300:9300
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata:/usr/share/elasticsearch/data

  kibana:
    depends_on:
      - elasticsearch
    image: exceptionless/kibana:1
    restart: on-failure
    environment:
      xpack.security.enabled: 'false'
    ports:
      - 5601:5601

  redis:
    image: redis:alpine
    restart: on-failure
    ports:
      - 6379:6379

volumes:
  esdata:
    driver: local
  appdata:
    driver: local
  ssldata:
    driver: local

_ Note: defines Exceptionless's minimal operating environment in this docker-compose.yml, but it is officially recommended that the production environment use the Elastic Search cluster and modify the memory limitations of Elastic Search appropriately. If your volume is very small and not very large, then this minimal operating environment is sufficient, and there is no need to be highly available for high availability.   

(2) Upload the Release package to the Ali Cloud server, and then execute the shell command through SSH (first cd to the release package directory) to start Exceptionless 5.0.0.

docker-compose up -d

The whole process will take a long time, because it will take 34 Steps to pull out many mirrors, such as Redis, Elastic Search, Kibana and. NET Core SDK, etc. Please wait patiently. The final effect is as follows:

2.4 Use Exceptionless 5.0.0

(1) Access to your server IP:5100 to access Exceptionless Web management login interface. If you can see it, then the deployment is successful. Register an account and log in.

(2) you can see that the home page is a brand new Chinese management interface, thanks to the efforts of the contributors.

(3) Create some sample projects, such as "XDP.Product.API", and get API Key

(4) Configure API Key in your ASP.NET Core Web API project and send Log to Exceptionless API (port 5000 here)

(5) View Log in Exceptionless

Legacy issues: Email notification configuration

Children who have used Exceptionless know that Exceptionless provides a powerful Email notification mechanism, which can provide users with timely serious error notification and daily reports.

On the basis of the installation described above, according to the official Wiki documents, it is reasonable to just make sure that the api in docker-compose.yml and the AppMode of jobs are in Production mode and set up SMTP to open the Email notification.

EX_AppMode: Production
EX_ConnectionStrings__Email: smtp://edisonchou7%40qq.com:zltqvl2321ed@smtp.qq.com:465

In Exceptionless, Decode is used to decode @ because it seems to be drunk because it divides the front username + password and the rear Host+Port by @ symbol.

After setting up, restart docker with the following command:

docker-compose up -d

docker-compose will automatically restart the changed containers, such as APIs and jobs.

However, I tried many times and found that I still couldn't send Email notification normally, because it didn't affect the use, so I didn't go deep into it for the time being. Friends with solutions can inform and share the solutions. Thank you.

Four, summary

This paper introduces the container-based local deployment of Exceptionless 5.0.0, mainly referring to the Elf-Host document from Exceptionless.

Reference material

1,Exceptionless release

2,Exceptionless Self-Hosting Documention

Posted by blaster_master on Sun, 06 Oct 2019 11:21:28 -0700