<commit_before>.. infrastructure:
.. infra:

###############
Infrastructure
###############

.. production:

***********
Production
***********

This section contains production-specific information and runbook.


Architecture and Setup
======================

We are using:

* Heroku for hosting the main application process
* [AWS RDS](https://aws.amazon.com/rds/) for hosting database
* [AWS S3](https://aws.amazon.com/s3/) for hosting static data and uploaded content

Old version is running on an [EC2 instance](https://aws.amazon.com/ec2/).

User Content Hosting
--------------------

User-uploaded content (user icons, gallery pictures etc.) is hosted on S3 im the `uploady.dracidoupe.cz` budket/domain.

There is no sharing with the old version: content from current production needs to be uploaded/synchronized manually. This needs to happen on a bastion host as the EC2 instance can't talk to Amazon APIs because of obsoleted openssl. Use [aws s3 sync . s3://uploady.dracidoupe.cz/whatever](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html) command.

Static File Hosting
--------------------

Static files (like CSS) are now hosted from within Heroku [using whitenoise](http://whitenoise.evans.io/en/stable/django.html). They [should be migrated to CDN](https://github.com/dracidoupe/graveyard/issues/2).


Error Reporting
---------------

Exceptions are sent to [Sentry](https://sentry.io/welcome/). Sentry is configured to push information about new exceptions into [#serverove-novinky Slack channel](https://dracidoupe.slack.com/archives/C7FMV74DT).<commit_msg>Document current papertrail search<commit_after>.. infrastructure:
.. infra:

###############
Infrastructure
###############

.. production:

***********
Production
***********

This section contains production-specific information and runbook.


Architecture and Setup
======================

We are using:

* Heroku for hosting the main application process
* [AWS RDS](https://aws.amazon.com/rds/) for hosting database
* [AWS S3](https://aws.amazon.com/s3/) for hosting static data and uploaded content

Old version is running on an [EC2 instance](https://aws.amazon.com/ec2/).

User Content Hosting
--------------------

User-uploaded content (user icons, gallery pictures etc.) is hosted on S3 im the `uploady.dracidoupe.cz` budket/domain.

There is no sharing with the old version: content from current production needs to be uploaded/synchronized manually. This needs to happen on a bastion host as the EC2 instance can't talk to Amazon APIs because of obsoleted openssl. Use [aws s3 sync . s3://uploady.dracidoupe.cz/whatever](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html) command.

Static File Hosting
--------------------

Static files (like CSS) are now hosted from within Heroku [using whitenoise](http://whitenoise.evans.io/en/stable/django.html). They [should be migrated to CDN](https://github.com/dracidoupe/graveyard/issues/2).


Error Reporting
---------------

Exceptions are sent to [Sentry](https://sentry.io/welcome/). Sentry is configured to push information about new exceptions into [#production-feed Slack channel](https://dracidoupe.slack.com/archives/C029JA38AAV).

Logs are scanned using [Papertrail](https://www.papertrail.com/) and matching events are send to [#production-feed](https://dracidoupe.slack.com/archives/C029JA38AAV). Alerts currently configured:

* `Warning: OR [WARNING] -("[WARNING] Worker with pid" AND ("was terminated due to signal 19" OR "was terminated due to signal 15")) -"[WARNING] Not Found: /favicon.ico"` (sent every 10 minutes)

{'fraction_non_alphanumeric': 0.16824512534818942, 'fraction_numerical': 0.010863509749303621, 'mean_word_length': 4.050632911392405, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 16, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5302529', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1004, 'n_words': 348}