From 2e6169e69980d3c6dc37967cf17283b88f23d48d Mon Sep 17 00:00:00 2001 From: Aldair Cruz <17972991+aldaircruz@users.noreply.github.com> Date: Tue, 30 Apr 2019 05:33:45 +0100 Subject: [PATCH] feat(*): add template for sentry (#60) --- public/v1/apps/sentry.json | 214 +++++++++++++++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 public/v1/apps/sentry.json diff --git a/public/v1/apps/sentry.json b/public/v1/apps/sentry.json new file mode 100644 index 0000000..4c93494 --- /dev/null +++ b/public/v1/apps/sentry.json @@ -0,0 +1,214 @@ +{ + "captainVersion": "1", + "documentation": "Taken from https://hub.docker.com/_/sentry/ and https://docs.sentry.io/server/", + "dockerCompose": { + "version": "3.3", + "services": { + "$$cap_appname-postgres": { + "image": "postgres:$$cap_postgres_version", + "notExposeAsWebApp": "true", + "volumes": [ + "$$cap_appname-postgres-data:/var/lib/postgresql/data" + ], + "restart": "always", + "environment": { + "POSTGRES_USER": "sentry", + "POSTGRES_PASSWORD": "$$cap_pg_pass", + "POSTGRES_DB": "sentry" + } + }, + "$$cap_appname-redis": { + "dockerfileLines": [ + "FROM redis:$$cap_redis_version", + "CMD exec redis-server" + ], + "notExposeAsWebApp": "true", + "volumes": [ + "$$cap_appname-redis-data:/data" + ], + "restart": "always" + }, + "$$cap_appname-cron": { + "depends_on": [ + "$$cap_appname" + ], + "dockerfileLines": [ + "FROM sentry:$$cap_sentry_version", + "RUN groupadd -r $$cap_appname-cron && useradd -r -g $$cap_appname-cron $$cap_appname-cron", + "USER $$cap_appname-cron", + "CMD sentry run cron" + ], + "notExposeAsWebApp": "true", + "restart": "always", + "environment": { + "SENTRY_SECRET_KEY": "$$cap_sentry_secret", + "SENTRY_REDIS_HOST": "srv-captain--$$cap_appname-redis" + } + }, + "$$cap_appname-worker": { + "depends_on": [ + "$$cap_appname-cron" + ], + "dockerfileLines": [ + "FROM sentry:$$cap_sentry_version", + "RUN groupadd -r $$cap_appname-worker && useradd -r -g $$cap_appname-worker $$cap_appname-worker", + "USER $$cap_appname-worker", + "CMD sentry run worker" + ], + "notExposeAsWebApp": "true", + "restart": "always", + "environment": { + "SENTRY_SECRET_KEY": "$$cap_sentry_secret", + "SENTRY_REDIS_HOST": "srv-captain--$$cap_appname-redis", + "SENTRY_REDIS_PORT": "6379", + "SENTRY_POSTGRES_HOST": "srv-captain--$$cap_appname-postgres", + "SENTRY_DB_NAME": "sentry", + "SENTRY_DB_USER": "sentry", + "SENTRY_DB_PASSWORD": "$$cap_pg_pass" + } + }, + "$$cap_appname": { + "dockerfileLines": [ + "FROM sentry:$$cap_sentry_version", + "RUN echo 'auth.allow-registration: false' > /etc/sentry/config.yml", + "RUN echo 'beacon.anonymous: true' >> /etc/sentry/config.yml", + "RUN echo 'mail.from: \"\"' >> /etc/sentry/config.yml", + "RUN echo 'mail.host: \"\"' >> /etc/sentry/config.yml", + "RUN echo 'mail.password: \"\"' >> /etc/sentry/config.yml", + "RUN echo 'mail.port: 465' >> /etc/sentry/config.yml", + "RUN echo 'mail.use-tls: true' >> /etc/sentry/config.yml", + "RUN echo 'mail.username: \"\"' >> /etc/sentry/config.yml", + "RUN echo 'system.admin-email: \"\"' >> /etc/sentry/config.yml", + "RUN echo 'system.url-prefix: \"\"' >> /etc/sentry/config.yml", + "RUN echo '#!/bin/bash' >> ./init.sh", + "RUN echo 'echo Starting configuration. The App will restart multiple times.' >> ./init.sh", + "RUN echo 'echo 1 of 4 : running upgrade' >> ./init.sh", + "RUN echo 'sentry upgrade --noinput --traceback --no-repair' >> ./init.sh", + "RUN echo 'echo 2 of 4 : set sentry:version-configured' >> ./init.sh", + "RUN echo 'sentry config set sentry:version-configured ${CAP_SENTRY_VERSION}' >> ./init.sh", + "RUN echo 'echo 3 of 4 : creating user' >> ./init.sh", + "RUN echo 'sentry createuser --email=${CAP_SENTRY_SUPERUSER_EMAIL} --password=${CAP_SENTRY_SUPERUSER_PASSWORD} --superuser --no-input' >> ./init.sh", + "RUN echo 'echo Configuration completed!' >> ./init.sh", + "RUN echo 'echo 4 of 4 : starting application' >> ./init.sh", + "RUN echo 'sentry run web' >> ./init.sh", + "RUN chmod +x init.sh", + "RUN groupadd -r $$cap_appname-sentry && useradd -r -g $$cap_appname-sentry $$cap_appname-sentry", + "USER $$cap_appname-sentry", + "CMD [\"./init.sh\"]" + ], + "containerHttpPort": "9000", + "depends_on": [ + "$$cap_appname-postgres", + "$$cap_appname-redis" + ], + "volumes": [ + "$$cap_appname-data:/var/lib/sentry/files" + ], + "restart": "always", + "environment": { + "CAP_SENTRY_VERSION": "$$cap_sentry_version", + "CAP_SENTRY_SUPERUSER_EMAIL": "$$cap_sentry_superuser_email", + "CAP_SENTRY_SUPERUSER_PASSWORD": "$$cap_sentry_superuser_password", + "SENTRY_POSTGRES_HOST": "srv-captain--$$cap_appname-postgres", + "SENTRY_REDIS_HOST": "srv-captain--$$cap_appname-redis", + "SENTRY_REDIS_PORT": "6379", + "SENTRY_DB_NAME": "sentry", + "SENTRY_DB_USER": "sentry", + "SENTRY_DB_PASSWORD": "$$cap_pg_pass", + "SENTRY_SECRET_KEY": "$$cap_sentry_secret", + "SENTRY_MAILGUN_API_KEY": "$$cap_mailgun_apikey", + "SENTRY_SERVER_EMAIL": "$$cap_sentry_server_mail", + "SENTRY_EMAIL_HOST": "$$cap_sentry_email_host", + "SENTRY_EMAIL_PORT": "$$cap_sentry_email_port", + "SENTRY_EMAIL_USER": "$$cap_sentry_email_user", + "SENTRY_EMAIL_PASSWORD": "$$cap_sentry_email_password", + "SENTRY_EMAIL_USE_TLS": "$$cap_sentry_email_use_tls" + } + } + } + }, + "instructions": { + "start": "Open-source error tracking that helps developers monitor and fix crashes in real time.\n\n Information about this container:\n https://hub.docker.com/_/sentry/ \n\nDocumentation:\n https://docs.sentry.io/server/\n\nMinimum Hardware Requirements: At least 3GB Ram\nNot filling this requirement may cause some errors during the initial configuration when running the database migrations.\n\n Enter your Sentry Configuration parameters and click on next. The initial installation will take about 5 minutes for the process to finish.", + "end": "Sentry is deployed and available as srv-captain--$$cap_appname:9000. \n\n IMPORTANT: It will take up to 10 minutes for Sentry to be ready. Before that, you might see 502 error page.\n" + }, + "variables": [ + { + "id": "$$cap_postgres_version", + "label": "Postgres Version Tag", + "defaultValue": "9.6", + "description": "Checkout their docker page for the valid tags https://hub.docker.com/r/library/postgres/tags/", + "validRegex": "/^([^\\s^\\/])+$/" + }, + { + "id": "$$cap_redis_version", + "label": "Redis Version Tag", + "description": "Checkout their docker page for the valid tags https://hub.docker.com/r/library/redis/tags/", + "defaultValue": "3.2-alpine", + "validRegex": "/^([^\\s^\\/])+$/" + }, + { + "id": "$$cap_sentry_version", + "label": "Sentry Version Tag", + "description": "Checkout their docker page for the valid tags https://hub.docker.com/_/sentry/", + "defaultValue": "9.1.0", + "validRegex": "/^([^\\s^\\/])+$/" + }, + { + "id": "$$cap_pg_pass", + "label": "Postgres Password", + "description": "Password strength requeriments: Should contain at least one digit, one lower case, one upper case and at least 12 from the mentioned characters.", + "validRegex": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{12,}$/" + }, + { + "id": "$$cap_sentry_secret", + "label": "Sentry Secret", + "description": "A secret key used for cryptographic functions within Sentry. This key should be unique and consistent across all running instances. You can generate a new secret key doing something like: docker run --rm sentry config generate-secret-key. Minimum length: 50 characters.", + "validRegex": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{50,}$/" + }, + { + "id": "$$cap_sentry_superuser_email", + "label": "Sentry Superuser Email", + "validRegex": "/.{1,}/" + }, + { + "id": "$$cap_sentry_superuser_password", + "label": "Sentry Superuser Password", + "description": "Password strength requeriments: Should contain at least one digit, one lower case, one upper case and at least 12 from the mentioned characters.", + "validRegex": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{12,}$/" + }, + { + "id": "$$cap_sentry_server_mail", + "label": "Sentry Server Email (optional)", + "description": "The email address used for From: in outbound emails.", + "defaultValue": "root@localhost", + "validRegex": "/.{1,}/" + }, + { + "id": "$$cap_sentry_email_host", + "label": "SMTP email host (optional)" + }, + { + "id": "$$cap_sentry_email_port", + "label": "SMTP email port (optional)", + "defaultValue": 465 + }, + { + "id": "$$cap_sentry_email_user", + "label": "SMTP email user (optional)" + }, + { + "id": "$$cap_sentry_email_password", + "label": "SMTP email password (optional)" + }, + { + "id": "$$cap_sentry_email_use_tls", + "label": "SMTP use tls (optional)", + "defaultValue": true + }, + { + "id": "$$cap_mailgun_apikey", + "label": "Mailgun Api key (optional)", + "description": "If you're using Mailgun for inbound mail, set your API key and configure a route to forward to /api/hooks/mailgun/inbound/" + } + ] +} \ No newline at end of file