Configure Sentry server in centos 7 [Tracking Error]
About Sentry server :
The Sentry Server is the core Python application that powers all of our Sentry installations.
Sentry is an Open Source error tracking that helps developers monitor and fix crashes in real time. Sentry is an error tracking software product which has many different subscriptions options.
Source : https://docs.sentry.io/
you can clearly see the status of container present in the docker and you can also check the image name, ports that are configured with container, container ID , commands, creation date and name of container.
Now we will check the status of firewalld, ifyou want your firewall enabled, just add ports to firewalld service.
#systemctl status firewalld
you can see that firewalld service is running and now will add ports to firewall service using firewall-cmd command
#firewall-cmd --add-port=9000/tcp --permanent
#firewall-cmd --add-port=25/tcp --permanent
now go to last line of that file,
and add few lines below,
# Set the default socket timeout to a value that prevents connections
# to our SMTP server from timing out, due to sendmail's greeting pause
# feature.
import socket
socket.setdefaulttimeout(20)
and add few lines below,
# Set the default socket timeout to a value that prevents connections
# to our SMTP server from timing out, due to sendmail's greeting pause
# feature.
import socket
socket.setdefaulttimeout(20)
Source : https://docs.sentry.io/
Installation of sentry server in Centos 7 :
First we need to setup server Environment of Centos, using command i can weather my my distro is Centos/Redhat or not.
# cat /etc/redhat-release
After checking linux environment, if you already have docker install in system, skip few steps and check installation process of sentry server.
or if you want to remove and install newly docker, follow steps below,
# sudo yum remove docker \
docker-common \
docker-selinux \
docker-engine
# rm -rf /etc/docker /var/lib/docker
Now we will install newly docker in Centos 7/Redhat 7 server because i am configuring sentry server in docker containers.
For sentry server, i am installating docker-ce [ version 17.12 ] because i already tested in different version of docker and successfully installed in 17.12 version.
if you want to try in your own, upgrade or install newly docker version and follow same steps below.
Now follow steps for full installation of docker,
i am installing yum-utils and different packges for docker applcation.
# sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
Now i will add docker-ce repo to the yum-config-manager and after that i will install docker-ce application and docker-ce repo help yum to download the docker-ce application from its repo.
# sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
after adding repository to the yum-config-manager, i am going to install docker-ce in my system and remember for this i am installing docker-ce 17.12 version.
# yum install docker-ce
after this i will fetch package from the URL which we set as repo in yum-config-manager.
you will see that docker-ce is installing around 10-12 packages including dependencies and you will see that it is download 17.12 version docker-ce.
The download size maybe different for coming packages and will take some time to download those packages and install in server [ Centos / Redhat server ].
after successfully installation of docker-ce you can check the list of available packages with different version.
# yum list docker-ce --showduplicates | sort -r
Now start the docker-ce service and check for any error.
# systemctl start docker
after starting the docker-ce package, check the status of docker.
Installation of Sentry server [Tracking Error] in Centos 7/Redhat 7 :
In sentry server, it depend upon few more packages like redis, PostgreSQL
To know more about dependencies package and services : https://docs.sentry.io/server/installation/docker/
Now install and Running Dependent Services
#docker run -d --name sentry-redis redis
To know more about redis : https://redis.io/topics/introduction
$ docker run -d --name sentry-postgres -e POSTGRES_PASSWORD=secret -e POSTGRES_USER=sentry postgres
you can change postgres database password and setup as per you.
To know more about postgresql https://www.postgresql.org/about/
$ docker run --detach --name sentry-smtp tianon/exim4
We also install smtp server to send verification mail and send invitation mail to different users email, for that we need docker container containing mail server.
$ docker run -it --rm -e SENTRY_SECRET_KEY='word_given_by_you' --link sentry-postgres:postgres --link sentry-redis:redis --link sentry-smtp:smtp sentry upgrade
the "word_given_by_you" will be your sentry secret key and you can set any word and implement sentry server.
and i am also upgrade my sentry server to include redis,postgres and smtp server to connect to each other.
because of this docker container will connect to each other and send information to each other.
After downloading image it will start upgrading sentry server with its key and implment new changes like redis implement, postgres,smtp and many more.
Now it will ask you to create sentry user for authentication and login.
after setting values like email, password and confirmation for superuser, it will finish configuration.
$ docker run -d --name my-sentry -p 8080:9000 -e SENTRY_SECRET_KEY='word_given_by_you' --link sentry-redis:redis --link sentry-postgres:postgres --link sentry-smtp:smtp sentry
Now i am installing web portal for sentry server and port forwarding the sentry server to 9000 and also including smtp,redis and postgres server
$ docker run -d --name sentry-cron -e SENTRY_SECRET_KEY='word_given_by_you' --link sentry-postgres:postgres --link sentry-redis:redis --link sentry-smtp:smtp sentry run cron
Now, we will install sentry cron to establish the sentry server.
It’s recommended to only run one of them at the time or you will see unnecessary extra tasks being pushed onto the queues but the system will still behave as intended if multiple beat processes are run. This can be used to achieve high availability.
$ docker run -d --name sentry-worker-1 -e SENTRY_SECRET_KEY='word_given_by_you' --link sentry-postgres:postgres --link sentry-redis:redis --link sentry-smtp:smtp sentry run worker
A large amount of Sentry’s work is managed via background workers, so we need container which manage sentry work,
After installation of packages in docker container, we will analyze and check ports to implement firewalld.
usind docker ctl commands we can check the status of containers.
# docker container ls
you can clearly see the status of container present in the docker and you can also check the image name, ports that are configured with container, container ID , commands, creation date and name of container.
Now we will check the status of firewalld, ifyou want your firewall enabled, just add ports to firewalld service.
#systemctl status firewalld
you can see that firewalld service is running and now will add ports to firewall service using firewall-cmd command
#firewall-cmd --add-port=9000/tcp --permanent
#firewall-cmd --add-port=25/tcp --permanent
#firewall-cmd --add-port=5432/tcp --permanent
#firewall-cmd --add-port=6379/tcp --permanent
#firewall-cmd --add-port=8080/tcp --permanent
After adding port using "--permanent"
Restart the firewalld service and check for status,
#systemctl restart firewalld
Now, using "firewall-cmd" command we will check allow ports in firewall service.
#firewall-cmd --list-all
Now after checking the ports enable, go to browser and search for ip address along with port number.
IN WEB - HTTP://IP_ADDR:8080
after searching for sentry server, it will redirect you to the authentication to get into sentry server and implement.
After prompting login page, it will ask you for email/username and password to setup things.
give your email and password as you set earlier when you upgraded sentry using docker command.
it will ask you for Root URL, Admin email and different things like allow registration and beacon , i just unchecked and continue
click continue after filling all details.
it will show you dashboard like this, but for now, we implement smtp server for worker and sentry container with our mail server.
Now we will edit sentry_worker-1 and my-sentry
using docker command, we can go to container and edit their configuration file and do changes,
# docker exec -ti container_id bash
First we will edit for sentry-worker-1
#docker exec -ti container_id_of_mysentry-1 bash
after that terminal enter into container shell, where we can do our changes, implement and many more things.
#apt-get update
Now update the container kernel packages,
# apt-get install nano
by default there is no editor command in container, so we need to install any editor command like vim,nano as per your need.
For sentry, the configuration and python file present in "/etc/sentry"
#cd /etc/sentry
you will see two file present in "/etc/sentry"
Now we will edit some change
#nano config.yml
you will see that ,
we need to setup mail server, in above diagram is is showing how to implement mail server.
we need to setup mail server because, when we send verification mail, invitation mail, and errors to any mail, so mail server help us to send these mail from its server.
mail.backend: 'smtp'
mail.host: '---------------------.com'
mail.port: 587
mail.username: '--------------------'
mail.password: 'mail_password'
mail.use-tls: true
mail.from: ' --------------------'
uncommend or copy from above and change according to your mail server and save that file.
Now we need to edit "sentry.conf.py" which is python file for increase socket time, so when we send any mail, it wont throw error message.
#nano sentry.conf.py
now go to last line of that file,
and add few lines below,
# Set the default socket timeout to a value that prevents connections
# to our SMTP server from timing out, due to sendmail's greeting pause
# feature.
import socket
socket.setdefaulttimeout(20)
Now exit from the container.
Now same thing, we will do for my-sentry which is main sentry server,
#docker exec -ti container_id_of_mysentry-1 bash
after that terminal enter into container shell, where we can do our changes, implement and many more things.
#apt-get update
Now update the container kernel packages,
# apt-get install nano
by default there is no editor command in container, so we need to install any editor command like vim,nano as per your need.
For sentry, the configuration and python file present in "/etc/sentry"
#cd /etc/sentry
you will see two file present in "/etc/sentry"
Now we will edit some change
#nano config.yml
you will see that ,
we need to setup mail server, in above diagram is is showing how to implement mail server.
we need to setup mail server because, when we send verification mail, invitation mail, and errors to any mail, so mail server help us to send these mail from its server.
mail.backend: 'smtp'
mail.host: '---------------------.com'
mail.port: 587
mail.username: '--------------------'
mail.password: 'mail_password'
mail.use-tls: true
mail.from: ' --------------------'
uncommend or copy from above and change according to your mail server and save that file.
Now we need to edit "sentry.conf.py" which is python file for increase socket time, so when we send any mail, it wont throw error message.
#nano sentry.conf.py
now go to last line of that file,
and add few lines below,
# Set the default socket timeout to a value that prevents connections
# to our SMTP server from timing out, due to sendmail's greeting pause
# feature.
import socket
socket.setdefaulttimeout(20)
Now exit from the container.
#exit
Now we will restart the server, and again access the web panel
After restarting, go to web panel,
and go to profile
go to account setting,
Now, check your email for verification.
check your junk if you cannot see sentry verfication mail in inbox.
after that it will confirm admin email and you can setup more members to sentry server.
If you want to check logs of container,
# docker container ls
# docker logs container_id -f
hope you like this session, if you want to know more about sentry , Linux and many more, let me know in the comment section. :)
Comments
Post a Comment