{"id":2940,"date":"2014-10-10T11:29:23","date_gmt":"2014-10-10T09:29:23","guid":{"rendered":"http:\/\/supportex.net\/blog\/?p=2940"},"modified":"2019-05-10T14:51:18","modified_gmt":"2019-05-10T12:51:18","slug":"installing-sentry-centos-6-5","status":"publish","type":"post","link":"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/","title":{"rendered":"Installing Sentry on Centos 6.5"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/getsentry\/sentry\">Sentry<\/a> is a real time event logging and aggregation platform. It allows to aggregate all events of your project in one place. It may be handy to get all logging messages and to have a possibility to track what&#8217;s going on with your application. You could use Sentry\u00a0with node.js, PHP, Go, Python, Java and some other languages\/applications.\u00a0<a href=\"http:\/\/sentry.readthedocs.org\/en\/latest\/client\/\">Full list of available clients<\/a>.<\/p>\n<p>So let&#8217;s get started. First problem you encounter while installing Sentry on Centos 6.5. is Python version. It&#8217;s written with use of Django and requires \u00a0Python 2.7, while Centos shipped with version 2.6. \u00a0There are various ways to get Python on Centos, for instance, to compile it from the sources, which is obviously not the best way. \u00a0We will use <a href=\"https:\/\/github.com\/yyuu\/pyenv\">pyenv<\/a>,\u00a0version management system for Python. Detailed description on <a href=\"http:\/\/supportex.net\/blog\/2014\/09\/installing-python-2-7-centos-6-5\/\">how to install Python 2.7 on Centos 6.5<\/a> can be found in our previous post.<\/p>\n<p>One important note, it would be much better to create some system account and to use it for all following actions. Let&#8217;s call it sentry:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">adduser sentry ; su \u00a0- sentry<\/code><\/p>\n<p>Once Python 2.7 is installed, install Sentry:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">pip2.7 install sentry<\/code><\/p>\n<p>We are going to use MySQL so we need one more package for Sentry:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">pip2.7 install sentry[mysql]<\/code><\/p>\n<p>(If you encounter and issue make sure you have <em>mysql-devel<\/em> installed).<\/p>\n<p>Init Sentry config:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">sentry init<\/code><\/p>\n<p>Modify the config to file with your real values for host, databases, etc:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">from sentry.conf.server import *\nimport os.path\nCONF_ROOT = os.path.dirname(__file__)\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.mysql',\n 'NAME': 'sentry',\n 'USER': 'sentry',\n 'PASSWORD': 'strongpasswprd',\n 'HOST': 'localhost',\n 'PORT': '3306',\n }\n}\nCELERY_ALWAYS_EAGER = False\nBROKER_URL = 'redis:\/\/localhost:6379'\nSENTRY_BUFFER = 'sentry.buffer.redis.RedisBuffer'\nSENTRY_REDIS_OPTIONS = {\n 'hosts': {\n 0: {\n 'host': '127.0.0.1',\n 'port': 6379,\n }\n }\n}\nUSE_X_FORWARDED_HOST = True\nSENTRY_WEB_HOST = '127.0.0.1'\nSENTRY_WEB_PORT = 9028\nSENTRY_WEB_OPTIONS = {\n 'secure_scheme_headers': {'X-FORWARDED-PROTO': 'https'},\n}\nEMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'\nEMAIL_HOST = 'sentry.example.com'\nEMAIL_HOST_PASSWORD = ''\nEMAIL_HOST_USER = ''\nEMAIL_PORT = 25\nEMAIL_USE_TLS = False\nSERVER_EMAIL = 'sentry@example.com'\nSECRET_KEY = '7mdR5dLYdS5dS5F4sfFswsEUfH8s45sdgtfisdqdYVgdIsbdduv6g7gggsgJFgXg=='\nTWITTER_CONSUMER_KEY = ''\nTWITTER_CONSUMER_SECRET = ''\nFACEBOOK_APP_ID = ''\nFACEBOOK_API_SECRET = ''\nGOOGLE_OAUTH2_CLIENT_ID = ''\nGOOGLE_OAUTH2_CLIENT_SECRET = ''\nGITHUB_APP_ID = ''\nGITHUB_API_SECRET = ''\nTRELLO_API_KEY = ''\nTRELLO_API_SECRET = ''\nBITBUCKET_CONSUMER_KEY = ''\nBITBUCKET_CONSUMER_SECRET = ''\nINSTALLED_APPS += ('nagios_sentry', )\n<\/pre>\n<p>If you don&#8217;t have Redis installed, install it and proceed:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">yum install redis<\/code><\/p>\n<p>Create MySQL database for Sentry:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\">CREATE DATABASE sentry_database\u00a0CHARACTER SET utf8;\nGRANT ALL PRIVILEGES ON sentry_database\u00a0.* TO 'user'@'%' identified by 'passwd';\n<\/pre>\n<p>Run the migrations:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">sentry upgrade<\/code><\/p>\n<p>Now create admin user:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">sentry createsuperuser\nsetry repair --owner=&lt;username&gt;\n<\/pre>\n<p>We are ready to start Sentry.<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">sentry start<\/code><\/p>\n<p>Now you can log in and start using Sentry.<\/p>\n<p>Few notes about performance and monitoring.<\/p>\n<ul>\n<li>If are going to send thousands of log messages it would make sense to use both <a href=\"http:\/\/sentry.readthedocs.org\/en\/latest\/queue\/index.html\">Celery workers<\/a> and <a href=\"http:\/\/sentry.readthedocs.org\/en\/latest\/buffer\/index.html\">update buffers<\/a> (using Redis as backend). It allows to improve the performace a lot.<\/li>\n<li>It would make sense to monitor Sentry. \u00a0For this purpose you could use <a href=\"https:\/\/github.com\/adw0rd\/nagios-sentry\">nagios-sentry<\/a>. You can install it using pip2.7.<\/li>\n<\/ul>\n<p>It does make sense to use nginx as \u00a0a http server and gunicorn server for Sentry behind it. Here&#8217;s a sample configuration for nginx:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">server {\n server_name sentry.example.com;\n listen 192168.1.1:80;\n access_log \/var\/log\/nginx\/sentry.example.com-access.log;\n error_log \/var\/log\/nginx\/sentry.example.com-error.log;\n proxy_set_header Host $http_host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header X-Forwarded-Proto $scheme;\n proxy_redirect off;\n proxy_connect_timeout 300;\n proxy_send_timeout 300;\n proxy_read_timeout 300;\n keepalive_timeout 0;\n send_timeout 5s;\n resolver_timeout 5s;\n client_body_timeout 5s;\n client_max_body_size 150k;\n client_body_buffer_size 150k;\n\n location \/ {\n proxy_pass http:\/\/localhost:9028;\n }\n\n location ~* \/api\/(?P&lt;projectid&gt;\\d+\/)?store\/ {\n proxy_pass http:\/\/localhost:9028;\n\n }\n }\n<\/pre>\n<p>It&#8217;s handy to use supervisord to \u00a0lauch Sentry after reboots. Here is a sample configuration for web and workers:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">[program:sentry-web]\nautostart=true\nautorestart=true\nstartsecs=10\nstartretries=3\ncommand=su - sentry -c \"\/home\/sentry\/.pyenv\/shims\/sentry --config=\/home\/sentry\/.sentry.conf.py start &gt;&gt; \/var\/log\/sentry\/web.log 2&gt;&gt; \/var\/log\/sentry\/web.log\"\nautostart=true\nlogfile=\/var\/log\/sentry\/web.log\nredirect_stderr=true\n\n[program:sentry-worker]\nautostart=true\nautorestart=true\nstartsecs=10\nstartretries=3\ncommand=su - sentry -c \"\/home\/sentry\/.pyenv\/shims\/sentry --config=\/home\/sentry\/.sentry.conf.py celery worker -B 2&gt; \/var\/log\/sentry\/worker.log 2&gt;&gt; \/var\/log\/sentry\/worker.log\"\nredirect_stderr=true\nlogfile=\/var\/log\/sentry\/worker.log\n<\/pre>\n<p>Happy logging!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sentry is a real time event logging and aggregation platform. It allows to aggregate all events of your project in one place. It may be handy to get all logging messages and to have a possibility to track what&#8217;s going on with your application. You could use Sentry\u00a0with node.js, PHP, Go, Python, Java and some&hellip; <\/p>\n<div class=\"readmore-wrapper\"><a href=\"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/\" class=\"more-link\">Read <\/a><\/div>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[152],"tags":[154],"class_list":["post-2940","post","type-post","status-publish","format-standard","hentry","category-linux","tag-sentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Installing Sentry on Centos 6.5 &#8211; Supportex.NET blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Installing Sentry on Centos 6.5 &#8211; Supportex.NET blog\" \/>\n<meta property=\"og:description\" content=\"Sentry is a real time event logging and aggregation platform. It allows to aggregate all events of your project in one place. It may be handy to get all logging messages and to have a possibility to track what&#8217;s going on with your application. You could use Sentry\u00a0with node.js, PHP, Go, Python, Java and some&hellip; Read\" \/>\n<meta property=\"og:url\" content=\"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/\" \/>\n<meta property=\"og:site_name\" content=\"Supportex.NET blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-10-10T09:29:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-10T12:51:18+00:00\" \/>\n<meta name=\"author\" content=\"Oleksii Tykhonov\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oleksii Tykhonov\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/\"},\"author\":{\"name\":\"Oleksii Tykhonov\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"headline\":\"Installing Sentry on Centos 6.5\",\"datePublished\":\"2014-10-10T09:29:23+00:00\",\"dateModified\":\"2019-05-10T12:51:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/\"},\"wordCount\":368,\"commentCount\":0,\"keywords\":[\"sentry\"],\"articleSection\":[\"linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/\",\"url\":\"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/\",\"name\":\"Installing Sentry on Centos 6.5 &#8211; Supportex.NET blog\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\"},\"datePublished\":\"2014-10-10T09:29:23+00:00\",\"dateModified\":\"2019-05-10T12:51:18+00:00\",\"author\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"breadcrumb\":{\"@id\":\"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/supportex.net\/blog\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Installing Sentry on Centos 6.5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\",\"url\":\"https:\/\/supportex.net\/blog\/en\/\",\"name\":\"Supportex.NET blog\",\"description\":\"Server and network management company\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\",\"name\":\"Oleksii Tykhonov\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"caption\":\"Oleksii Tykhonov\"},\"url\":\"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Installing Sentry on Centos 6.5 &#8211; Supportex.NET blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/","og_locale":"en_US","og_type":"article","og_title":"Installing Sentry on Centos 6.5 &#8211; Supportex.NET blog","og_description":"Sentry is a real time event logging and aggregation platform. It allows to aggregate all events of your project in one place. It may be handy to get all logging messages and to have a possibility to track what&#8217;s going on with your application. You could use Sentry\u00a0with node.js, PHP, Go, Python, Java and some&hellip; Read","og_url":"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/","og_site_name":"Supportex.NET blog","article_published_time":"2014-10-10T09:29:23+00:00","article_modified_time":"2019-05-10T12:51:18+00:00","author":"Oleksii Tykhonov","twitter_misc":{"Written by":"Oleksii Tykhonov","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/#article","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/"},"author":{"name":"Oleksii Tykhonov","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"headline":"Installing Sentry on Centos 6.5","datePublished":"2014-10-10T09:29:23+00:00","dateModified":"2019-05-10T12:51:18+00:00","mainEntityOfPage":{"@id":"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/"},"wordCount":368,"commentCount":0,"keywords":["sentry"],"articleSection":["linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/","url":"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/","name":"Installing Sentry on Centos 6.5 &#8211; Supportex.NET blog","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/en\/#website"},"datePublished":"2014-10-10T09:29:23+00:00","dateModified":"2019-05-10T12:51:18+00:00","author":{"@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"breadcrumb":{"@id":"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/supportex.net\/blog\/2014\/10\/installing-sentry-centos-6-5\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/supportex.net\/blog\/en\/"},{"@type":"ListItem","position":2,"name":"Installing Sentry on Centos 6.5"}]},{"@type":"WebSite","@id":"https:\/\/supportex.net\/blog\/en\/#website","url":"https:\/\/supportex.net\/blog\/en\/","name":"Supportex.NET blog","description":"Server and network management company","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251","name":"Oleksii Tykhonov","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","caption":"Oleksii Tykhonov"},"url":"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/"}]}},"_links":{"self":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/2940","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/comments?post=2940"}],"version-history":[{"count":14,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/2940\/revisions"}],"predecessor-version":[{"id":3124,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/2940\/revisions\/3124"}],"wp:attachment":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/media?parent=2940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/categories?post=2940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/tags?post=2940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}