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" {
#!/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 | |
} |
service: hook-relay | |
provider: | |
name: aws | |
custom: | |
resources: | |
us-east-1: ${file(./resources/timestream.yml)} # The resources that should be created in just one region | |
resources: |
class ApplicationRecord < ActiveRecord::Base | |
self.abstract_class = true | |
include ActivityLogger | |
end |