<commit_before># Sentry on Docker

This collection of shell scripts will attempt to install [Sentry](https://sentry.io/welcome/) on [Docker](https://www.docker.com/) on a [CentOS](https://www.centos.org/) machine (VM or bare metal).

The main script, `docker-sentry` will install `etcd`, `sentry` and `nginx` reverse proxy with SSL support. The SSL certificates will be generated using the help of  https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion

Please keep in mind that in order to use SSL, you will need a DNS A, AAAA or CNAME record in your domain's zone file, otherwise SSL won't work. You can run it on port 80 but that's entirely not recommended.

The `sentry-exec` script will take care of "administrative tasks", such as stopping, starting, upgrading sentry components after installation. Please have a look at the help section for detailed info.

If this gets deployed on AWS EC2, use a machine with at least 2 GB of RAM. Same amount of RAM applies for bare metal

There are environment variables in the main script which need to be changed and set into etcd, according to your setup.

```
POSTGRES_PASSWORD <PASSWORD>
SENTRY_SINGLE_ORGANIZATION False
SENTRY_SERVER_EMAIL <EMAIL>
SENTRY_EMAIL_HOST smtp.example.com
SENTRY_EMAIL_PASSWORD <PASSWORD>
SENTRY_EMAIL_USER mailuser
SENTRY_EMAIL_PORT 587
SENTRY_EMAIL_USE_TLS True
VIRTUAL_HOST sentry.example.com
LETSENCRYPT_HOST sentry.example.com
LETSENCRYPT_EMAIL <EMAIL>
```

Please refer to https://hub.docker.com/_/sentry/ and https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion for more information

### Setup

#### Prerequisites:

1. Kernel 4.x for overlay2 storage driver
2. Docker

**Kernel Installation:**

- log on to your machine

```
$ sudo yum -y install git
$ cd $HOME; git clone https://github.com/ssro/scripts.git
$ $HOME/scripts/centos-elrepo.sh
```
- OS tuning

```
$ sudo bash -c "cat <<EOF > /etc/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/enabled
EOF"
$ sudo chmod +x /etc/rc.local

$ sudo bash -c "cat <<EOF > /etc/sysctl.d/user-tuning.conf
vm.overcommit_memory=1
net.core.somaxconn=65535
vm.swappiness=10
vm.vfs_cache_pressure=50
net.ipv4.tcp_congestion_control=htcp
net.ipv4.tcp_keepalive_time=60
net.ipv4.tcp_fin_timeout=10
net.ipv4.tcp_keepalive_probes=5
net.ipv4.tcp_slow_start_after_idle=0
EOF"

```

- reboot your machine

`$ sudo reboot`

**Docker installation:**

- log on to your machine

`$ $HOME/scripts/docker-install.sh`

- enable overlay2 storage driver for docker on xfs FS
```<commit_msg>Add interpreter<commit_after># Sentry on Docker

This collection of shell scripts will attempt to install [Sentry](https://sentry.io/welcome/) on [Docker](https://www.docker.com/) on a [CentOS](https://www.centos.org/) machine (VM or bare metal).

The main script, `docker-sentry` will install `etcd`, `sentry` and `nginx` reverse proxy with SSL support. The SSL certificates will be generated using the help of  https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion

Please keep in mind that in order to use SSL, you will need a DNS A, AAAA or CNAME record in your domain's zone file, otherwise SSL won't work. You can run it on port 80 but that's entirely not recommended.

The `sentry-exec` script will take care of "administrative tasks", such as stopping, starting, upgrading sentry components after installation. Please have a look at the help section for detailed info.

If this gets deployed on AWS EC2, use a machine with at least 2 GB of RAM. Same amount of RAM applies for bare metal

There are environment variables in the main script which need to be changed and set into etcd, according to your setup.

```
POSTGRES_PASSWORD <PASSWORD>
SENTRY_SINGLE_ORGANIZATION False
SENTRY_SERVER_EMAIL <EMAIL>
SENTRY_EMAIL_HOST smtp.example.com
SENTRY_EMAIL_PASSWORD <PASSWORD>
SENTRY_EMAIL_USER mailuser
SENTRY_EMAIL_PORT 587
SENTRY_EMAIL_USE_TLS True
VIRTUAL_HOST sentry.example.com
LETSENCRYPT_HOST sentry.example.com
LETSENCRYPT_EMAIL <EMAIL>
```

Please refer to https://hub.docker.com/_/sentry/ and https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion for more information

### Setup

#### Prerequisites:

1. Kernel 4.x for overlay2 storage driver
2. Docker

**Kernel Installation:**

- log on to your machine

```
$ sudo yum -y install git
$ cd $HOME; git clone https://github.com/ssro/scripts.git
$ $HOME/scripts/centos-elrepo.sh
```
- OS tuning

```
$ sudo bash -c "cat <<EOF > /etc/rc.local
#!/bin/bash

echo never > /sys/kernel/mm/transparent_hugepage/enabled
EOF"
$ sudo chmod +x /etc/rc.local

$ sudo bash -c "cat <<EOF > /etc/sysctl.d/user-tuning.conf
vm.overcommit_memory=1
net.core.somaxconn=65535
vm.swappiness=10
vm.vfs_cache_pressure=50
net.ipv4.tcp_congestion_control=htcp
net.ipv4.tcp_keepalive_time=60
net.ipv4.tcp_fin_timeout=10
net.ipv4.tcp_keepalive_probes=5
net.ipv4.tcp_slow_start_after_idle=0
EOF"

```

- reboot your machine

`$ sudo reboot`

**Docker installation:**

- log on to your machine

`$ $HOME/scripts/docker-install.sh`

- enable overlay2 storage driver for docker on xfs FS
```
{'fraction_non_alphanumeric': 0.09824422963109095, 'fraction_numerical': 0.013020319589662656, 'mean_word_length': 4.70945945945946, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 14, 'lorem ipsum': 0, 'www.': 4, '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': '6779552', 'n_tokens_mistral': 1796, 'n_tokens_neox': 1676, 'n_words': 562}