├── .gitignore ├── production ├── roles └── zerqu │ ├── files │ ├── public │ │ ├── robots.txt │ │ ├── favicon.ico │ │ ├── apple-touch-icon-120.png │ │ ├── apple-touch-icon-152.png │ │ └── apple-touch-icon-76.png │ ├── cloudflare.conf │ └── wsgi.py │ ├── handlers │ └── main.yml │ ├── vars │ └── main.yml │ ├── templates │ ├── gunicorn_conf.j2 │ ├── supervisor.conf.j2 │ ├── nginx.conf.j2 │ ├── zerqu_conf.j2 │ └── newrelic.ini.j2 │ ├── tasks │ ├── main.yml │ ├── install.yml │ └── config.yml │ └── defaults │ └── main.yml ├── vagrant.yml ├── requirements.yml ├── Makefile ├── playbook.yml ├── Vagrantfile └── group_vars └── all /.gitignore: -------------------------------------------------------------------------------- 1 | roles/*.* 2 | -------------------------------------------------------------------------------- /production: -------------------------------------------------------------------------------- 1 | [web] 2 | pythonchina-web-0 3 | -------------------------------------------------------------------------------- /roles/zerqu/files/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-Agent: * 2 | Disallow: /app 3 | -------------------------------------------------------------------------------- /roles/zerqu/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for ansible-zerqu 3 | -------------------------------------------------------------------------------- /roles/zerqu/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars file for ansible-zerqu 3 | supervisor_incdir: /etc/supervisor/conf.d 4 | -------------------------------------------------------------------------------- /roles/zerqu/files/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pythoncn/ansible-python-china/HEAD/roles/zerqu/files/public/favicon.ico -------------------------------------------------------------------------------- /roles/zerqu/files/public/apple-touch-icon-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pythoncn/ansible-python-china/HEAD/roles/zerqu/files/public/apple-touch-icon-120.png -------------------------------------------------------------------------------- /roles/zerqu/files/public/apple-touch-icon-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pythoncn/ansible-python-china/HEAD/roles/zerqu/files/public/apple-touch-icon-152.png -------------------------------------------------------------------------------- /roles/zerqu/files/public/apple-touch-icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pythoncn/ansible-python-china/HEAD/roles/zerqu/files/public/apple-touch-icon-76.png -------------------------------------------------------------------------------- /roles/zerqu/files/cloudflare.conf: -------------------------------------------------------------------------------- 1 | map $http_cf_visitor $cf_scheme { 2 | '{"scheme":"http"}' http; 3 | '{"scheme":"https"}' https; 4 | default $http_x_forwarded_proto; 5 | } 6 | -------------------------------------------------------------------------------- /vagrant.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: playbook.yml 4 | vars: 5 | server_mode: development 6 | zerqu_server_name: beta.python-china.org 7 | zerqu_site_url: "http://{{ zerqu_server_name }}" 8 | redis_bind: 0.0.0.0 9 | -------------------------------------------------------------------------------- /requirements.yml: -------------------------------------------------------------------------------- 1 | - src: Stouts.redis 2 | path: roles/ 3 | - src: Stouts.memcached 4 | path: roles/ 5 | - src: Stouts.nginx 6 | path: roles/ 7 | - src: Stouts.python 8 | path: roles/ 9 | - src: Stouts.supervisor 10 | path: roles/ 11 | - src: ANXS.postgresql 12 | path: roles/ 13 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | msg=$(shell git log -1 --pretty=%B) 2 | revision=$(shell git rev-parse HEAD) 3 | 4 | init: 5 | @ansible-playbook -vvvv --ask-vault-pass -i production playbook.yml 6 | 7 | deploy: 8 | @ansible-playbook --ask-vault-pass -i production playbook.yml --tags deploy -e 'deploy_revision=${revision} deploy_message="${msg}"' 9 | -------------------------------------------------------------------------------- /roles/zerqu/templates/gunicorn_conf.j2: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | import multiprocessing 4 | 5 | bind = '{{ zerqu_bind }}' 6 | workers = multiprocessing.cpu_count() * 2 + 1 7 | 8 | timeout = 30 9 | 10 | max_requests = 1000 11 | max_requests_jitter = 500 12 | 13 | proc_name = '{{ zerqu_app_name }}' 14 | 15 | accesslog = '-' 16 | errorlog = '-' 17 | loglevel = 'warning' 18 | 19 | secure_scheme_headers = { 20 | 'X-FORWARDED-PROTO': 'https', 21 | } 22 | -------------------------------------------------------------------------------- /roles/zerqu/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - include: install.yml 4 | 5 | 6 | - include: config.yml 7 | tags: [deploy] 8 | 9 | 10 | - name: newrelic deployment 11 | newrelic_deployment: 12 | token: "{{ newrelic_api_key }}" 13 | app_name: Python China 14 | user: lepture 15 | revision: "{{ deploy_revision }}" 16 | description: "{{ deploy_message }}" 17 | when: server_mode == 'production' 18 | tags: [deploy] 19 | 20 | 21 | - name: Restart supervisor task 22 | supervisorctl: name={{ zerqu_app_name }} state=restarted 23 | tags: [deploy] 24 | -------------------------------------------------------------------------------- /roles/zerqu/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | server_mode: production 4 | zerqu_user: www-data 5 | 6 | zerqu_base: /var/zerqu 7 | zerqu_virtualenv: "{{ zerqu_base }}/venv" 8 | zerqu_source: "{{ zerqu_base }}/src" 9 | zerqu_application: "{{ zerqu_base }}/app" 10 | zerqu_public_dir: "{{ zerqu_base }}/public" 11 | 12 | zerqu_app_name: pycn_web 13 | zerqu_server_name: python-china.org 14 | 15 | zerqu_site_name: Python China 16 | zerqu_site_description: Welcome to Python China 17 | zerqu_site_url: "https://{{ zerqu_server_name }}" 18 | zerqu_site_seo_url: "http://{{ zerqu_server_name }}" 19 | 20 | zerqu_bind: "127.0.0.1:9011" 21 | zerqu_database_uri: "postgresql://postgres@localhost/pythonchina" 22 | -------------------------------------------------------------------------------- /roles/zerqu/templates/supervisor.conf.j2: -------------------------------------------------------------------------------- 1 | [program:{{ zerqu_app_name }}] 2 | user={{ zerqu_user }} 3 | command={{ zerqu_virtualenv }}/bin/newrelic-admin run-program {{ zerqu_virtualenv }}/bin/gunicorn -k gevent -c gunicorn_conf.py wsgi:app 4 | directory={{ zerqu_application }} 5 | environment=ZERQU_CONF="{{ zerqu_application }}/zerqu_conf.py",NEW_RELIC_CONFIG_FILE="{{ zerqu_application }}/newrelic.ini",NEW_RELIC_ENVIRONMENT="{{ server_mode }}",PYTHONPATH="{{ zerqu_source }}" 6 | autostart=true 7 | autorestart=true 8 | redirect_stderr=true 9 | stdout_logfile=/var/log/supervisor/{{ zerqu_server_name }}.log 10 | stopsignal=TERM 11 | 12 | stdout_logfile_maxbytes=50MB 13 | stdout_logfile_backups=5 14 | stopwaitsecs = 60 15 | 16 | killasgroup=true 17 | -------------------------------------------------------------------------------- /roles/zerqu/tasks/install.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: install system packages 4 | apt: pkg={{ item }} state=installed 5 | with_items: 6 | - build-essential 7 | - libffi-dev 8 | - libssl-dev 9 | 10 | 11 | - name: Install deployment dependencies 12 | pip: 13 | name: "{{ item }}" 14 | virtualenv: "{{ zerqu_virtualenv }}" 15 | with_items: 16 | - "newrelic==2.54.0.41" 17 | 18 | 19 | - name: Install zerqu production dependencies 20 | pip: 21 | requirements: "{{ zerqu_source }}/deps/production.txt" 22 | virtualenv: "{{ zerqu_virtualenv }}" 23 | 24 | 25 | - name: Copy public files 26 | copy: src={{ item }} dest={{ zerqu_public_dir }}/ 27 | with_fileglob: 28 | - public/*.png 29 | - public/*.ico 30 | - public/*.txt 31 | -------------------------------------------------------------------------------- /playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | sudo: yes 4 | # gather_facts: no 5 | 6 | roles: 7 | - Stouts.redis 8 | - Stouts.nginx 9 | - Stouts.python 10 | - Stouts.supervisor 11 | - ANXS.postgresql 12 | - zerqu 13 | 14 | vars: 15 | python_ppa: "ppa:fkrull/deadsnakes-python2.7" 16 | python_versions: [2.7] 17 | python_virtualenvs: 18 | - path: /var/zerqu/venv 19 | postgresql_ext_install_dev_headers: yes 20 | 21 | postgresql_databases: 22 | - name: pythonchina 23 | 24 | zerqu_site_name: Python China 25 | zerqu_site_styles: 26 | - //dn-python.qbox.me/qingcheng/20160412.vendor.7e4de9.css 27 | - //dn-python.qbox.me/qingcheng/20160412.app.0fdf2a.css 28 | zerqu_site_scripts: 29 | - //dn-python.qbox.me/qingcheng/20160412.vendor.2b287e.js 30 | - //dn-python.qbox.me/qingcheng/20160412.app.3db66f.js 31 | -------------------------------------------------------------------------------- /roles/zerqu/files/wsgi.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | from werkzeug.contrib.fixers import ProxyFix 3 | from flask import redirect 4 | from zerqu import create_app 5 | from zerqu.ext.sentry import FlaskSentry 6 | app = create_app() 7 | FlaskSentry(app, logging=False, wrap_wsgi=False) 8 | app.wsgi_app = ProxyFix(app.wsgi_app) 9 | 10 | 11 | @app.route('/topic/') 12 | def redirect_topic(tid): 13 | return redirect('/t/%d' % tid, code=301) 14 | 15 | 16 | @app.route('/node/') 17 | def redirect_node_list(): 18 | return redirect('/c/', code=301) 19 | 20 | 21 | @app.route('/node/') 22 | def redirect_node(slug): 23 | return redirect('/c/%s' % slug, code=301) 24 | 25 | 26 | @app.route('/user/') 27 | @app.route('/user//topics') 28 | @app.route('/member/') 29 | @app.route('/~') 30 | def redirect_user(name): 31 | return redirect('/u/%s' % name.lower(), code=301) 32 | 33 | 34 | @app.route('/c/flask') 35 | @app.route('/c/june') 36 | @app.route('/c/tornado') 37 | @app.route('/c/django') 38 | @app.route('/c/gae') 39 | def redirect_to_web(): 40 | return redirect('/c/web', code=301) 41 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | $script = < 30 | {% for src in zerqu_site_styles %} 31 | 32 | {% endfor %} 33 | 34 | ''' 35 | 36 | APP_FOOTER = ''' 37 | {% for src in zerqu_site_scripts %} 38 | 39 | {% endfor %} 40 | ''' 41 | 42 | SITE_LOGINS = ['google'] 43 | 44 | # async mode 45 | ZERQU_ASYNC = True 46 | 47 | # avatar base domain 48 | ZERQU_AVATAR_BASE = '//dn-python.qbox.me/' 49 | 50 | # 5 days 51 | ZERQU_VALID_MODIFY_TIME = 432000 52 | 53 | GOOGLE_CONSUMER_KEY = '{{ google_consumer_key }}' 54 | GOOGLE_CONSUMER_SECRET = '{{ google_consumer_secret }}' 55 | 56 | # TWITTER_CONSUMER_KEY = '' 57 | # TWITTER_CONSUMER_SECRET = '' 58 | 59 | # GITHUB_CONSUMER_KEY = '' 60 | # GITHUB_CONSUMER_SECRET = '' 61 | 62 | QINIU_ACCESS_KEY = '{{ qiniu_access_key }}' 63 | QINIU_SECRET_KEY = '{{ qiniu_secret_key }}' 64 | QINIU_BUCKET = 'python' 65 | QINIU_PREFIX = 'images' 66 | QINIU_BASE_URL = 'https://dn-python.qbox.me/' 67 | 68 | #: email settings 69 | MAIL_SERVER = 'smtp.gmail.com' 70 | MAIL_USE_SSL = False 71 | MAIL_USE_TLS = True 72 | MAIL_USERNAME = 'noreply@python-china.org' 73 | MAIL_PASSWORD = '{{ zerqu_mail_password }}' 74 | MAIL_DEFAULT_SENDER = ('Python China', 'noreply@python-china.org') 75 | 76 | SENTRY_DSN = "{{ sentry_dsn }}" 77 | -------------------------------------------------------------------------------- /group_vars/all: -------------------------------------------------------------------------------- 1 | $ANSIBLE_VAULT;1.1;AES256 2 | 30343463626132336665363732336437663661303463363334306561313034623564376430333965 3 | 3664343962633131373531633739636634336134353732620a653637323234313061303132653061 4 | 31316637316263636632666530316364303161396534353265643538366634303031383863306662 5 | 3435616266646463370a343063343732333935353334356638626539656231613738353331353932 6 | 36633438626632333836656135303036656335663734343733643530336538653864643337306162 7 | 64383436303137663934366565306234323330343834373062633434666139383830366535363366 8 | 30323762393563316262653934396531306662626564386237393539336264383832376362646232 9 | 64643631623836626138656562336632373965316332616231653439313438326334343361323139 10 | 34653236643730313539366236343464393135363136663565653337656639306538303338653561 11 | 62393465666263353039643563666363653136306632393635666262636539623732323430626266 12 | 31636234316339356566616361396464646133313536616362323766633262396363663664646133 13 | 65376162623964316164616534646431666436323466356666373638383662376161613230663330 14 | 37386564643038633432623862326334333532653436383339326564313366393833323035633863 15 | 39323234643164363065396330343436383937386633313334346637653662666538396639616339 16 | 38313835306230663432616364623337613831383363366466646231656230636166353835356335 17 | 32666364613464616234383732383530343232313631303336353530353236303635303234303732 18 | 32646665313532313564333434343138393661363766386339613465656662356135653131643330 19 | 37333865386338653838336263346637353731343332656235333335363964613838313033633133 20 | 33316563643137303131666566626364383262326135313164383939663839616234373863343733 21 | 61313931336236323333626639666361333431323338643935636665356431353531633736313038 22 | 64396537363830343932353662633766343338636361313130333136303734373631303232383962 23 | 33313763313464316364393066376661356234653732663737363965353563303130653466643637 24 | 32346563313061316330353537323961663530366235396131303136633230326239306631336430 25 | 38303937396339353061653763323031336439663536333836363939643032376430663534313165 26 | 65383430346665326331623939323930383038633535636630336536333664386230343933656166 27 | 66366265663431303462656363623332356262363462306565333838623864386430626439306536 28 | 36346162653935303263346433396464313365636132326238356163663038346331323439336635 29 | 65326231303963356663356436623935373537633463333032643331353865663130393664623565 30 | 37666336613266633433393664376433306230326165313731386536316234333961313130393338 31 | 37383837353639613731623364626663333630653234386637333536633639663331336436386366 32 | 38396237656533336162373735343832326231623933656362383838366138623366323762343465 33 | 65303965393262633164323035343564623233353138323135393432666530623531383766646666 34 | 30663937346530633164383534393966336432363561646231393363646633653532643034636266 35 | 31636230633831343638343933633637656635306630363537643232363666666266333263646137 36 | 35613038623438316437623031326466313234326436343637613764656262633064383139386162 37 | 30323666373636333562633265666265356562646331653539363033326239343835306232333239 38 | 63386162666332373030633264353030633962613036646361323135353139376234333130376233 39 | 39306238663635366166363332636434663831356538303132333665373934653332343230346466 40 | 61636264316637333930663963353139333362356365613731306333386236396130616463613532 41 | 62323266663038383236373934656330663533323838366235633035376663626661653330376461 42 | 33396430356239376437333939653136326563336238373337353938303666636230633537623965 43 | 34383430326231326639303365353834653465393634653535653338666265386432313335396239 44 | 62326336613466323866623464636331633335376639336133343934386165633964623436373031 45 | 38303638633462343463336633313561666365346235613662616239313639663631323963333465 46 | 64343233303130626231623466666130643733363636643361393136666465323031 47 | -------------------------------------------------------------------------------- /roles/zerqu/templates/newrelic.ini.j2: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------------------- 2 | 3 | # 4 | # This file configures the New Relic Python Agent. 5 | # 6 | # The path to the configuration file should be supplied to the function 7 | # newrelic.agent.initialize() when the agent is being initialized. 8 | # 9 | # The configuration file follows a structure similar to what you would 10 | # find for Microsoft Windows INI files. For further information on the 11 | # configuration file format see the Python ConfigParser documentation at: 12 | # 13 | # http://docs.python.org/library/configparser.html 14 | # 15 | # For further discussion on the behaviour of the Python agent that can 16 | # be configured via this configuration file see: 17 | # 18 | # http://newrelic.com/docs/python/python-agent-configuration 19 | # 20 | 21 | # --------------------------------------------------------------------------- 22 | 23 | # Here are the settings that are common to all environments. 24 | 25 | [newrelic] 26 | 27 | # You must specify the license key associated with your New 28 | # Relic account. This key binds the Python Agent's data to your 29 | # account in the New Relic service. 30 | license_key = {{ newrelic_license_key }} 31 | 32 | # The appplication name. Set this to be the name of your 33 | # application as you would like it to show up in New Relic UI. 34 | # The UI will then auto-map instances of your application into a 35 | # entry on your home dashboard page. 36 | app_name = Python China 37 | 38 | # When "true", the agent collects performance data about your 39 | # application and reports this data to the New Relic UI at 40 | # newrelic.com. This global switch is normally overridden for 41 | # each environment below. 42 | monitor_mode = true 43 | 44 | # Sets the name of a file to log agent messages to. Useful for 45 | # debugging any issues with the agent. This is not set by 46 | # default as it is not known in advance what user your web 47 | # application processes will run as and where they have 48 | # permission to write to. Whatever you set this to you must 49 | # ensure that the permissions for the containing directory and 50 | # the file itself are correct, and that the user that your web 51 | # application runs as can write to the file. If not able to 52 | # write out a log file, it is also possible to say "stderr" and 53 | # output to standard error output. This would normally result in 54 | # output appearing in your web server log. 55 | #log_file = /tmp/newrelic-python-agent.log 56 | 57 | # Sets the level of detail of messages sent to the log file, if 58 | # a log file location has been provided. Possible values, in 59 | # increasing order of detail, are: "critical", "error", "warning", 60 | # "info" and "debug". When reporting any agent issues to New 61 | # Relic technical support, the most useful setting for the 62 | # support engineers is "debug". However, this can generate a lot 63 | # of information very quickly, so it is best not to keep the 64 | # agent at this level for longer than it takes to reproduce the 65 | # problem you are experiencing. 66 | log_level = info 67 | 68 | # The Python Agent communicates with the New Relic service using 69 | # SSL by default. Note that this does result in an increase in 70 | # CPU overhead, over and above what would occur for a non SSL 71 | # connection, to perform the encryption involved in the SSL 72 | # communication. This work is though done in a distinct thread 73 | # to those handling your web requests, so it should not impact 74 | # response times. You can if you wish revert to using a non SSL 75 | # connection, but this will result in information being sent 76 | # over a plain socket connection and will not be as secure. 77 | ssl = true 78 | 79 | # High Security Mode enforces certain security settings, and 80 | # prevents them from being overridden, so that no sensitive data 81 | # is sent to New Relic. Enabling High Security Mode means that 82 | # SSL is turned on, request parameters are not collected, and SQL 83 | # can not be sent to New Relic in its raw form. To activate High 84 | # Security Mode, it must be set to 'true' in this local .ini 85 | # configuration file AND be set to 'true' in the server-side 86 | # configuration in the New Relic user interface. For details, see 87 | # https://docs.newrelic.com/docs/subscriptions/high-security 88 | high_security = false 89 | 90 | # The Python Agent will attempt to connect directly to the New 91 | # Relic service. If there is an intermediate firewall between 92 | # your host and the New Relic service that requires you to use a 93 | # HTTP proxy, then you should set both the "proxy_host" and 94 | # "proxy_port" settings to the required values for the HTTP 95 | # proxy. The "proxy_user" and "proxy_pass" settings should 96 | # additionally be set if proxy authentication is implemented by 97 | # the HTTP proxy. The "proxy_scheme" setting dictates what 98 | # protocol scheme is used in talking to the HTTP proxy. This 99 | # would normally always be set as "http" which will result in the 100 | # agent then using a SSL tunnel through the HTTP proxy for end to 101 | # end encryption. 102 | # proxy_scheme = http 103 | # proxy_host = hostname 104 | # proxy_port = 8080 105 | # proxy_user = 106 | # proxy_pass = 107 | 108 | # Tells the transaction tracer and error collector (when 109 | # enabled) whether or not to capture the query string for the 110 | # URL and send it as the request parameters for display in the 111 | # UI. When "true", it is still possible to exclude specific 112 | # values from being captured using the "ignored_params" setting. 113 | capture_params = false 114 | 115 | # Space separated list of variables that should be removed from 116 | # the query string captured for display as the request 117 | # parameters in the UI. 118 | ignored_params = 119 | 120 | # The transaction tracer captures deep information about slow 121 | # transactions and sends this to the UI on a periodic basis. The 122 | # transaction tracer is enabled by default. Set this to "false" 123 | # to turn it off. 124 | transaction_tracer.enabled = true 125 | 126 | # Threshold in seconds for when to collect a transaction trace. 127 | # When the response time of a controller action exceeds this 128 | # threshold, a transaction trace will be recorded and sent to 129 | # the UI. Valid values are any positive float value, or (default) 130 | # "apdex_f", which will use the threshold for a dissatisfying 131 | # Apdex controller action - four times the Apdex T value. 132 | transaction_tracer.transaction_threshold = apdex_f 133 | 134 | # When the transaction tracer is on, SQL statements can 135 | # optionally be recorded. The recorder has three modes, "off" 136 | # which sends no SQL, "raw" which sends the SQL statement in its 137 | # original form, and "obfuscated", which strips out numeric and 138 | # string literals. 139 | transaction_tracer.record_sql = obfuscated 140 | 141 | # Threshold in seconds for when to collect stack trace for a SQL 142 | # call. In other words, when SQL statements exceed this 143 | # threshold, then capture and send to the UI the current stack 144 | # trace. This is helpful for pinpointing where long SQL calls 145 | # originate from in an application. 146 | transaction_tracer.stack_trace_threshold = 0.5 147 | 148 | # Determines whether the agent will capture query plans for slow 149 | # SQL queries. Only supported in MySQL and PostgreSQL. Set this 150 | # to "false" to turn it off. 151 | transaction_tracer.explain_enabled = true 152 | 153 | # Threshold for query execution time below which query plans 154 | # will not not be captured. Relevant only when "explain_enabled" 155 | # is true. 156 | transaction_tracer.explain_threshold = 0.5 157 | 158 | # Space separated list of function or method names in form 159 | # 'module:function' or 'module:class.function' for which 160 | # additional function timing instrumentation will be added. 161 | transaction_tracer.function_trace = 162 | 163 | # The error collector captures information about uncaught 164 | # exceptions or logged exceptions and sends them to UI for 165 | # viewing. The error collector is enabled by default. Set this 166 | # to "false" to turn it off. 167 | error_collector.enabled = false 168 | 169 | # To stop specific errors from reporting to the UI, set this to 170 | # a space separated list of the Python exception type names to 171 | # ignore. The exception name should be of the form 'module:class'. 172 | error_collector.ignore_errors = 173 | 174 | # Browser monitoring is the Real User Monitoring feature of the UI. 175 | # For those Python web frameworks that are supported, this 176 | # setting enables the auto-insertion of the browser monitoring 177 | # JavaScript fragments. 178 | browser_monitoring.auto_instrument = false 179 | 180 | # A thread profiling session can be scheduled via the UI when 181 | # this option is enabled. The thread profiler will periodically 182 | # capture a snapshot of the call stack for each active thread in 183 | # the application to construct a statistically representative 184 | # call tree. 185 | thread_profiler.enabled = true 186 | 187 | # --------------------------------------------------------------------------- 188 | 189 | # 190 | # The application environments. These are specific settings which 191 | # override the common environment settings. The settings related to a 192 | # specific environment will be used when the environment argument to the 193 | # newrelic.agent.initialize() function has been defined to be either 194 | # "development", "test", "staging" or "production". 195 | # 196 | 197 | [newrelic:development] 198 | monitor_mode = false 199 | 200 | [newrelic:test] 201 | monitor_mode = false 202 | 203 | [newrelic:staging] 204 | app_name = Python China (Staging) 205 | monitor_mode = true 206 | 207 | [newrelic:production] 208 | monitor_mode = true 209 | 210 | # --------------------------------------------------------------------------- 211 | 212 | [function-trace:send-mail] 213 | enabled = true 214 | function = zerqu.libs.pigeon:mail.send 215 | name = send_mail 216 | group = Python/Task 217 | --------------------------------------------------------------------------------