Basic Sentry setup
Not running the install script automatically at this point yet.
This commit is contained in:
25
site-cookbooks/kosmos_sentry/.gitignore
vendored
Normal file
25
site-cookbooks/kosmos_sentry/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
.vagrant
|
||||
*~
|
||||
*#
|
||||
.#*
|
||||
\#*#
|
||||
.*.sw[a-z]
|
||||
*.un~
|
||||
|
||||
# Bundler
|
||||
Gemfile.lock
|
||||
gems.locked
|
||||
bin/*
|
||||
.bundle/*
|
||||
|
||||
# test kitchen
|
||||
.kitchen/
|
||||
kitchen.local.yml
|
||||
|
||||
# Chef Infra
|
||||
Berksfile.lock
|
||||
.zero-knife.rb
|
||||
Policyfile.lock.json
|
||||
|
||||
.idea/
|
||||
|
||||
20
site-cookbooks/kosmos_sentry/LICENSE
Normal file
20
site-cookbooks/kosmos_sentry/LICENSE
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2023 Kosmos Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
9
site-cookbooks/kosmos_sentry/attributes/default.rb
Normal file
9
site-cookbooks/kosmos_sentry/attributes/default.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
node.default["sentry"]["repo"] = "https://github.com/getsentry/self-hosted"
|
||||
node.default["sentry"]["revision"] = "master"
|
||||
node.default["sentry"]["port"] = 80
|
||||
node.default["sentry"]["retention_days"] = 90
|
||||
node.default["sentry"]["allowed_ips"] = nil
|
||||
# The Sentry setup requires docker-compose >= 1.28, which is newer than the
|
||||
# latest stable version for Ubuntu 20.04
|
||||
node.default["sentry"]["docker-compose"]["version"] = "2.17.0"
|
||||
node.default["sentry"]["docker-compose"]["checksum"] = "65edee934d988471c40ef31305731dbb4381d3cb0aeea13342119b61772f85e2"
|
||||
115
site-cookbooks/kosmos_sentry/chefignore
Normal file
115
site-cookbooks/kosmos_sentry/chefignore
Normal file
@@ -0,0 +1,115 @@
|
||||
# Put files/directories that should be ignored in this file when uploading
|
||||
# to a Chef Infra Server or Supermarket.
|
||||
# Lines that start with '# ' are comments.
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
ehthumbs.db
|
||||
Icon?
|
||||
nohup.out
|
||||
Thumbs.db
|
||||
.envrc
|
||||
|
||||
# EDITORS #
|
||||
###########
|
||||
.#*
|
||||
.project
|
||||
.settings
|
||||
*_flymake
|
||||
*_flymake.*
|
||||
*.bak
|
||||
*.sw[a-z]
|
||||
*.tmproj
|
||||
*~
|
||||
\#*
|
||||
REVISION
|
||||
TAGS*
|
||||
tmtags
|
||||
.vscode
|
||||
.editorconfig
|
||||
|
||||
## COMPILED ##
|
||||
##############
|
||||
*.class
|
||||
*.com
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.pyc
|
||||
*.so
|
||||
*/rdoc/
|
||||
a.out
|
||||
mkmf.log
|
||||
|
||||
# Testing #
|
||||
###########
|
||||
.circleci/*
|
||||
.codeclimate.yml
|
||||
.delivery/*
|
||||
.foodcritic
|
||||
.kitchen*
|
||||
.mdlrc
|
||||
.overcommit.yml
|
||||
.rspec
|
||||
.rubocop.yml
|
||||
.travis.yml
|
||||
.watchr
|
||||
.yamllint
|
||||
azure-pipelines.yml
|
||||
Dangerfile
|
||||
examples/*
|
||||
features/*
|
||||
Guardfile
|
||||
kitchen.yml*
|
||||
mlc_config.json
|
||||
Procfile
|
||||
Rakefile
|
||||
spec/*
|
||||
test/*
|
||||
|
||||
# SCM #
|
||||
#######
|
||||
.git
|
||||
.gitattributes
|
||||
.gitconfig
|
||||
.github/*
|
||||
.gitignore
|
||||
.gitkeep
|
||||
.gitmodules
|
||||
.svn
|
||||
*/.bzr/*
|
||||
*/.git
|
||||
*/.hg/*
|
||||
*/.svn/*
|
||||
|
||||
# Berkshelf #
|
||||
#############
|
||||
Berksfile
|
||||
Berksfile.lock
|
||||
cookbooks/*
|
||||
tmp
|
||||
|
||||
# Bundler #
|
||||
###########
|
||||
vendor/*
|
||||
Gemfile
|
||||
Gemfile.lock
|
||||
|
||||
# Policyfile #
|
||||
##############
|
||||
Policyfile.rb
|
||||
Policyfile.lock.json
|
||||
|
||||
# Documentation #
|
||||
#############
|
||||
CODE_OF_CONDUCT*
|
||||
CONTRIBUTING*
|
||||
documentation/*
|
||||
TESTING*
|
||||
UPGRADING*
|
||||
|
||||
# Vagrant #
|
||||
###########
|
||||
.vagrant
|
||||
Vagrantfile
|
||||
12
site-cookbooks/kosmos_sentry/metadata.rb
Normal file
12
site-cookbooks/kosmos_sentry/metadata.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
name 'kosmos_sentry'
|
||||
maintainer 'Kosmos Contributors'
|
||||
maintainer_email 'mail@kosmos.org'
|
||||
license 'MIT'
|
||||
description 'Installs/configures Sentry'
|
||||
version '0.1.0'
|
||||
chef_version '>= 16.0'
|
||||
issues_url 'https://gitea.kosmos.org/kosmos/chef/issues'
|
||||
source_url 'https://gitea.kosmos.org/kosmos/chef'
|
||||
|
||||
depends 'git'
|
||||
depends 'firewall'
|
||||
82
site-cookbooks/kosmos_sentry/recipes/default.rb
Normal file
82
site-cookbooks/kosmos_sentry/recipes/default.rb
Normal file
@@ -0,0 +1,82 @@
|
||||
#
|
||||
# Cookbook:: kosmos_sentry
|
||||
# Recipe:: default
|
||||
#
|
||||
|
||||
package "docker"
|
||||
|
||||
remote_file "/usr/local/bin/docker-compose" do
|
||||
source "https://github.com/docker/compose/releases/download/v#{node["sentry"]["docker-compose"]["version"]}/docker-compose-linux-x86_64"
|
||||
checksum node["sentry"]["docker-compose"]["checksum"]
|
||||
mode '0755'
|
||||
end
|
||||
|
||||
deploy_path = "/opt/sentry"
|
||||
|
||||
git deploy_path do
|
||||
repository node["sentry"]["repo"]
|
||||
revision node["sentry"]["revision"]
|
||||
end
|
||||
|
||||
# TODO
|
||||
# Automatically run install script if sentry/sentry.conf.py does not exist yet
|
||||
|
||||
env_config = {
|
||||
sentry_event_retention_days: node["sentry"]["retention_days"],
|
||||
sentry_bind: node["sentry"]["bind"] || node["sentry"]["port"],
|
||||
# Default values from upstream
|
||||
compose_project_name: "sentry-self-hosted",
|
||||
sentry_image: "getsentry/sentry:nightly",
|
||||
snuba_image: "getsentry/snuba:nightly",
|
||||
relay_image: "getsentry/relay:nightly",
|
||||
symbolicator_image: "getsentry/symbolicator:nightly",
|
||||
wal2json_version: "latest",
|
||||
healthcheck_interval: "30s",
|
||||
healthcheck_timeout: "60s",
|
||||
healthcheck_retries: "10"
|
||||
}
|
||||
|
||||
template "#{deploy_path}/.env.custom" do
|
||||
source 'env.custom.erb'
|
||||
mode 0600
|
||||
sensitive true
|
||||
variables config: env_config
|
||||
notifies :restart, "service[sentry]", :delayed
|
||||
end
|
||||
|
||||
systemd_unit "sentry.service" do
|
||||
content({Unit: {
|
||||
Description: "Sentry service using Docker Compose",
|
||||
Requires: "docker.service",
|
||||
After: "docker.service",
|
||||
},
|
||||
Service: {
|
||||
Type: "oneshot",
|
||||
RemainAfterExit: "true",
|
||||
WorkingDirectory: deploy_path,
|
||||
ExecStart: "docker-compose --env-file #{deploy_path}/.env.custom up -d --remove-orphans",
|
||||
ExecStop: "docker-compose stop",
|
||||
StandardOutput: "syslog"
|
||||
},
|
||||
Install: {
|
||||
WantedBy: "multi-user.target"
|
||||
}})
|
||||
verify false
|
||||
triggers_reload true
|
||||
action [:create]
|
||||
end
|
||||
|
||||
service "sentry" do
|
||||
action [:enable, :start]
|
||||
end
|
||||
|
||||
include_recipe 'firewall'
|
||||
|
||||
firewall_rule 'sentry' do
|
||||
port node["sentry"]["port"]
|
||||
protocol :tcp
|
||||
command :allow
|
||||
if node["sentry"]["allowed_ips"]
|
||||
source node["sentry"]["allowed_ips"]
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
<% @config.each do |key, value| %>
|
||||
<% if value.is_a?(Hash) %>
|
||||
<% value.each do |k, v| %>
|
||||
<%= "#{key.upcase}_#{k.upcase}" %>=<%= v.to_s %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if value %>
|
||||
<%= key.upcase %>=<%= value.to_s %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user