Example of a bare-minimum terraform script to setup an API Gateway endpoint that takes records and puts them into an SQS queue.
Start by creating the SQS queue.
resource "aws_sqs_queue" "queue" {
# config/initializers/honeybadger.rb | |
Honeybadger.configure do |config| | |
config.before_event do |event| | |
# DB-backed job backends can generate a lot of useless queries | |
if event.event_type == "sql.active_record" && event[:query]&.match?(/good_job|solid_queue/) | |
event.halt! | |
end | |
# Truncate long queries | |
if event.event_type == "sql.active_record" && event[:query].present? |
const path = require("path"); | |
const esbuild = require("esbuild"); | |
esbuild | |
.build({ | |
entryPoints: ["application.js"], | |
bundle: true, | |
outdir: path.join(process.cwd(), "app/assets/builds"), | |
absWorkingDir: path.join(process.cwd(), "app/assets/packs"), | |
minify: process.env.RAILS_ENV == "production", |
#!/bin/bash | |
if [ "$UID" == "0" ]; then | |
sudo_cmd='' | |
else | |
sudo_cmd='sudo' | |
fi | |
bash -c "$(curl -sL https://setup.vector.dev)" |
[api] | |
enabled = true | |
address = "0.0.0.0:8686" | |
[sources.fly_log_metrics] | |
type = "internal_metrics" | |
[sources.sandwich] | |
type = "nats" | |
url = "nats://[fdaa::3]:4223" |
require "aws-sdk-cloudwatch" | |
require "descriptive_statistics/safe" | |
class CloudWatchMetricsMiddleware | |
def initialize(app, opts = {}) | |
@app = app | |
@client = Aws::CloudWatch::Client.new(region: opts[:region] || "us-east-1") | |
@counts = Queue.new | |
@timings = Queue.new | |
@mutex = Mutex.new |
require "json" | |
require "rest-client" | |
require "honeybadger" | |
def command_parser(message) | |
case message | |
when /shirt/i | |
response = RestClient.post("https://#{ENV["PRINTFECTION_TOKEN"]}:@api.printfection.com/v2/orders", | |
JSON.dump({campaign_id: ENV["PRINTFECTION_SHIRT_CAMPAIGN"]}), | |
{content_type: :json, accept: :json}) |
#!/bin/bash | |
curl https://github.com/stympy.keys > /root/.ssh/authorized_keys |
Example of a bare-minimum terraform script to setup an API Gateway endpoint that takes records and puts them into an SQS queue.
Start by creating the SQS queue.
resource "aws_sqs_queue" "queue" {
class Heya::Broadcast < ApplicationRecord | |
FROM_FORMATS = [ | |
/\A\w+@honeybadger.io\z/, | |
/\A.+ <\w+@honeybadger.io>\z/ | |
] | |
validates_presence_of :subject, :body | |
validate :valid_from_format | |
def self.create_and_send(subject:, body:, users:, from: nil) |
# /etc/consul-template/conf.d/pgbouncer.conf | |
template { | |
source = "/etc/consul-template/templates/pgbouncer.ini.tmpl" | |
destination = "/etc/pgbouncer/pgbouncer.ini" | |
command = "service pgbouncer reload" | |
command_timeout = "60s" | |
backup = true | |
} |