This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'prometheus/client' | |
prometheus = Prometheus::Client.registry | |
$email_job_retries = prometheus.counter(:http_requests, 'A counter of Email jobs that were retried') | |
ActiveSupport::Notifications.subscribe "enqueue_retry.active_job" do |name, start, finish, id, payload| | |
$email_job_retries.increment({ job: payload[:job] }) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COMMENTS_REGEX = /^comment\+(.+)@example\.com/i | |
# app/mailboxes/application_mailbox.rb | |
class ApplicationMailbox < ActionMailbox::Base | |
routing COMMENTS_REGEX => :comments | |
end | |
# app/mailboxes/comments_mailbox.rb | |
class CommentsMailbox < ApplicationMailbox | |
def process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_broadcasts | |
assert_broadcasts 'messages', 0 | |
ActionCable.server.broadcast 'messages', { text: 'hello' } | |
assert_broadcasts 'messages', 1 | |
end | |
def test_subscribed_with_room_number | |
subscribe room_number: 1 | |
assert subscription.confirmed? | |
assert_has_stream "chat_1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: vault-sidekick | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
name: vault-sidekick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 1: Fetch Kubernetes' service ClusterIP | |
data "kubernetes_service" "kubernetes" { | |
metadata { | |
name = "kubernetes" | |
} | |
} | |
# Step 2: Mount Vault Kubernetes authentication backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "kubernetes_service_account" "vault-tokenreview" { | |
metadata { | |
name = "vault-tokenreview" | |
} | |
} | |
resource "kubernetes_cluster_role_binding" "vault-tokenreview-clusterrolebinding" { | |
metadata { | |
name = "vault-tokenreviewer" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "google" { | |
credentials = "${file("creds/account.json")}" | |
project = "vault-sidecar" | |
region = "europe-west2" | |
} | |
provider "kubernetes" { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "kubernetes_role_binding" "vault-operator-role-binding" { | |
metadata { | |
name = "vault-operator-rolebinding" | |
} | |
role_ref { | |
api_group = "rbac.authorization.k8s.io" | |
kind = "Role" | |
name = "vault-operator-role" | |
} | |
subject { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apiextensions.k8s.io/v1beta1 | |
kind: CustomResourceDefinition | |
metadata: | |
name: vaultservices.vault.security.coreos.com | |
spec: | |
group: vault.security.coreos.com | |
names: | |
kind: VaultService | |
listKind: VaultServiceList | |
plural: vaultservices |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "kubernetes_role_binding" "etcd-operator-role-binding" { | |
metadata { | |
name = "etcd-operator" | |
} | |
role_ref { | |
api_group = "rbac.authorization.k8s.io" | |
kind = "Role" | |
name = "etcd-operator" | |
} | |
subject { |
NewerOlder