Error! Transitionsmarketing.com Not Active Yet
Previously we used cloud-based Picket version but and then reached emails limit and our backend-team left without those notifications which are critical for their work.
A self-hosted version was planned a long time ago and so at present nosotros have a gamble to spin information technology upwards.
The post below describes how to outset cocky-hosted Sentry on an AWS EC2 instance, configure electronic mail and test if from a Python.
Will use Watch on-premise repository here.
Run AWS EC2, configure SSL from Allow's Encrypt, install NGINX, Docker and Docker Compose.
Those steps are described in details in the Bitwarden: an organization'due south password manager self-hosted version installation on an AWS EC2 mail service, and then I'll skip them hither.
Utilise EC2 type t3.medium as Scout requires 3 GiB retention as minimal.
Running Sentry
Clone repository:
root@bttrm-scout:/home/admin# mkdir /opt/watch
root@bttrm-sentry:/habitation/admin# cd /opt/sentry/
root@bttrm-sentry:/opt/sentry# git clone https://github.com/getsentry/onpremise.git
root@bttrm-sentry:/opt/spotter# cd onpremise/
Create Docker Volumes for data and PostgreSQL database:
root@bttrm-scout:/opt/sentinel/onpremise# docker volume create --name=sentry-data && docker book create --name=sentry-postgres
watch-information
sentry-postgres
Create config-file:
root@bttrm-picket:/opt/sentry/onpremise# cp -n .env.case .env
Build images:
root@bttrm-picket:/opt/sentinel/onpremise# docker-etch build
smtp uses an prototype, skipping
memcached uses an image, skipping
redis uses an image, skipping
postgres uses an image, skipping
Building web
Pace 1/one : FROM spotter:ix.1-onbuild
9.1-onbuild: Pulling from library/sentry
...
Successfully congenital 4840fec904c8
Successfully tagged onpremise_worker:latest
Generate SECRET_KEY:
root@bttrm-spotter:/opt/sentinel/onpremise# docker-etch run --rm web config generate-secret-key
Creating network "onpremise_default" with the default commuter
Pulling smtp (tianon/exim4:)...
latest: Pulling from tianon/exim4
...
Status: Downloaded newer image for tianon/exim4:latest
Pulling memcached (memcached:1.5-alpine)...
1.5-alpine: Pulling from library/memcached
...
Condition: Downloaded newer image for memcached:1.5-tall
Pulling redis (redis:three.ii-alpine)...
3.2-alpine: Pulling from library/redis
...
Condition: Downloaded newer paradigm for redis:3.two-alpine
Pulling postgres (postgres:nine.5)...
9.five: Pulling from library/postgres
...
Creating onpremise_smtp_1 ... done
Creating onpremise_postgres_1 ... done
Creating onpremise_memcached_1 ... done
Creating onpremise_redis_1 ... washed
y0%***1yz
The last string in the output – с y0%***1yz – is our primal.
Edit the .env file and set this SECRET_KEY.
Populate database and create an admin user:
root@bttrm-sentry:/opt/sentry/onpremise# docker-compose run --rm web upgrade
Starting onpremise_redis_1 ... washed
Starting onpremise_postgres_1 ... washed
Starting onpremise_memcached_1 ... done
Starting onpremise_smtp_1 ... washed
12:06:24 [WARNING] sentry.utils.geo: settings.GEOIP_PATH_MMDB non configured.
12:06:27 [INFO] sentry.plugins.github: apps-not-configured
Syncing...
Creating tables ...
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group_permissions
Creating tabular array auth_group
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table south_migrationhistory
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
Migrating...
Running migrations for sentry:
- Migrating forwards to 0472_auto__add_field_sentryapp_author.
...
Created internal Spotter project (slug=internal, id=one)
Would yous like to create a user account at present? [Y/north]: y
E-mail: admin@case.com
Password:
Echo for confirmation:
Should this user be a superuser? [y/Due north]: Y
User created: admin@example.com
Added to organization: lookout
...
Run the stack:
root@bttrm-sentinel:/opt/sentry/onpremise# docker-etch up
onpremise_redis_1 is up-to-date
onpremise_memcached_1 is up-to-date
onpremise_postgres_1 is up-to-date
onpremise_smtp_1 is upwards-to-engagement
Creating onpremise_worker_1 ... done
Creating onpremise_web_1 ... done
Creating onpremise_cron_1 ... washed
...
Check containers:
root@bttrm-picket:/opt/sentry/onpremise# docker ps
Open a browser and cheque if Lookout man is working:
Log in, hither yous can configure e-mail but I did it later on using AWS SES:
Press Side by side, check it'south working:
Not sure what'due south the worker message here, but it disappeared after.
Now, stop containers and create systemd unit of measurement-file – /etc/systemd/system/sentry.service:
root@bttrm-sentinel:/opt/lookout/onpremise# systemctl edit --force sentry
Gear up here:
[Unit] Description=Sentry service Requires=docker.service Afterwards=docker.service [Service] Restart=e'er WorkingDirectory=/opt/sentry/onpremise # Compose upwardly ExecStart=/usr/local/bin/docker-compose -f docker-compose.yml up # Etch down, remove containers and volumes ExecStop=/usr/local/bin/docker-compose -f docker-compose.yml down -v [Install] WantedBy=multi-user.target
In case of errors like:
May 18 12:38:33 bttrm-scout systemd[1]: scout.service: Service has more than than one ExecStart= setting, which is simply allowed for Type=oneshot services. Refusing.
Add i more ExecStart, just empty:
[Unit] Description=Sentry service Requires=docker.service After=docker.service [Service] Restart=always WorkingDirectory=/opt/sentinel/onpremise # Etch up ExecStart= ExecStart=/usr/local/bin/docker-compose -f docker-etch.yml upwardly # Compose down, remove containers and volumes ExecStop=/usr/local/bin/docker-etch -f docker-compose.yml down -5 [Install] WantedBy=multi-user.target
Didn't saw such the fault earlier, just googled this solution here>>>.
Run the service:
root@bttrm-sentry:/opt/sentry/onpremise# systemctl start sentry
Check its status:
root@bttrm-sentry:/opt/sentinel/onpremise# systemctl status watch
● sentry.service - Sentry service
Loaded: loaded (/etc/systemd/organisation/scout.service; disabled; vendor preset: enabled)
Drib-In: /etc/systemd/arrangement/sentry.service.d
└─override.conf
Active: active (running) since Sat 2019-05-18 12:39:21 UTC; 12min ago
Chief PID: 9209 (docker-compose)
CPU: 643ms
CGroup: /organisation.slice/sentry.service
├─9209 /usr/local/bin/docker-compose -f docker-etch.yml upward
└─9210 /usr/local/bin/docker-compose -f docker-compose.yml up
May xviii 12:44:24 bttrm-spotter docker-compose[9209]: redis_1 | 1:M 18 May 12:44:24.080 * 100 changes in 300 seconds. Saving...
May 18 12:44:24 bttrm-sentry docker-etch[9209]: redis_1 | i:M 18 May 12:44:24.081 * Background saving started past pid 11
May xviii 12:44:24 bttrm-sentry docker-etch[9209]: redis_1 | 11:C 18 May 12:44:24.086 * DB saved on disk
May 18 12:44:24 bttrm-scout docker-compose[9209]: redis_1 | 11:C xviii May 12:44:24.086 * RDB: 0 MB of retentivity used by re-create-on-write
May xviii 12:44:24 bttrm-sentry docker-etch[9209]: redis_1 | one:Thou eighteen May 12:44:24.181 * Background saving terminated with success
May 18 12:49:25 bttrm-watch docker-etch[9209]: redis_1 | 1:M 18 May 12:49:25.066 * 100 changes in 300 seconds. Saving...
May 18 12:49:25 bttrm-lookout docker-compose[9209]: redis_1 | ane:M 18 May 12:49:25.066 * Background saving started by pid 12
May eighteen 12:49:25 bttrm-sentry docker-etch[9209]: redis_1 | 12:C xviii May 12:49:25.072 * DB saved on disk
May 18 12:49:25 bttrm-lookout man docker-compose[9209]: redis_1 | 12:C 18 May 12:49:25.073 * RDB: 0 MB of memory used past copy-on-write
May 18 12:49:25 bttrm-watch docker-etch[9209]: redis_1 | 1:M 18 May 12:49:25.167 * Background saving terminated with success
Okay, all good.
Add to autostart:
root@bttrm-sentry:/opt/scout/onpremise# systemctl enable lookout
Email configuration documantation is available her>>>.
Edit docker-compose.yml, set variables, here is AWS SES instance:
... SENTRY_EMAIL_HOST: email-smtp.us-e-1.amazonaws.com SENTRY_EMAIL_PORT: 587 SENTRY_EMAIL_PASSWORD: BH3***gpM SENTRY_EMAIL_USER: AKI***OAQ SENTRY_EMAIL_USE_TLS: "true" SENTRY_SERVER_EMAIL: no-reply@example.com ...
Pay attention to quotes around the "true":
SENTRY_EMAIL_USE_TLS: "true"
Save and restart Sentry service:
root@bttrm-sentry:/opt/sentry/onpremise# systemctl restart sentry
Python Sentry
Create a new project:
Get token:
Bank check from a workstation – install sentry-sdk:
[setevoy@setevoy-arch-work ~ ] $ sudo pip install sentinel-sdk
[setevoy@setevoy-curvation-work ~ ] $ python
...
>>> import sentry_sdk
>>> sentry_sdk.init("https://96e***c44@sentry.example.com/2")
<sentry_sdk.hub._InitGuard object at 0x7efd4c487128>
>>> sentry_sdk.capture_message("Hi Globe")
'736347c534cb4e3eb27fb3e3c0641439'
Check events in Lookout man
And electronic mail:
Done.
As well published on Medium.
Source: https://rtfm.co.ua/en/sentry-running-self-hosted-errors-tracking-system-on-an-aws-ec2/
Post a Comment for "Error! Transitionsmarketing.com Not Active Yet"