Skip to content

Instantly share code, notes, and snippets.

backend api
balance roundrobin
option httpchk GET /health
timeout check 1000ms
# maxconn 1 - only one concurrent connection per gunicorn
# maxqueue 1 - only queue one request per socket before attempting other sockets
# iter 10s - one health check every 10 seconds
# downinter 1s - faster health checks if the socket is marked down
@lukedemi
lukedemi / web.conf
Created August 9, 2021 21:05
Thunderproof Gunicorn
[supervisord]
nodaemon=true
[program:app]
user=djangouser
directory=/app
command=ddtrace-run gunicorn main.wsgi --workers=1 --timeout 15 -b unix:/var/shared/gunicorn%(process_num)03d.sock --log-file -
numprocs=%(ENV_WORKERS)s
process_name=%(program_name)s_%(process_num)03d
@lukedemi
lukedemi / gist:17c1e7bac7e09f43faf9fa0236df56ff
Last active August 2, 2018 19:57
Surface Go 4GB Disk Perf Results (Winsat)
PS C:\Windows\system32> winsat disk -drive c
Windows System Assessment Tool
> Running: Feature Enumeration ''
> Run Time 00:00:00.00
> Running: Storage Assessment '-drive c -ran -read'
> Run Time 00:00:00.63
> Running: Storage Assessment '-drive c -seq -read'
> Run Time 00:00:03.16
> Running: Storage Assessment '-drive c -seq -write'
> Run Time 00:00:07.80
@task(7110)
def get_user(self):
self.client.get(
"/v2/user",
auth=self.auth
)
@task(5460)
def get_prices_historic(self):
pair = random.choice(CRYPTO_FIAT_PAIRS)
$ ./geo status --quiet
{
"codified": 331,
"uncodified": 3,
"total": 334,
"percent": 99.10179640718563,
"resources": {
"aws_elb": {
"uncodified": [
"service-web"
@lukedemi
lukedemi / geo_status.json
Last active February 7, 2017 16:01
geo status output
$ ./geo status --quiet
{
"codified": 331,
"uncodified": 3,
"total": 334,
"percent": 99.10179640718563,
"resources": {
"aws_elb": {
"uncodified": [
"service"
def validate_statement_ip_restrictions(statement)
errors = []
if statement.ip_restrictions.empty?
errors << "IPAddress Condition aws:SourceIP must contain cidr blocks"
else
for cidr_block in statement.ip_restrictions
if !valid_cidr?(cidr_block)
errors << "#{cidr_block} is not included in the valid_cidr array for this environment"
end
class GeoEngineer::Resource
validate -> { validate_has_tag(:Name) if support_tags? }
validate -> { validate_has_tag(:ProjectName) if self.project? && support_tags? }
validate :validate_project_name_correct
def validate_project_name_correct
bad_name = support_tags? && self.project && tags['ProjectName'] != self.project.full_name
"ProjectName tag should equal \"#{project.full_name}\" for resource \"#{type}.#{id}\"" if bad_name
end
class GeoEngineer::Project
after :initialize, :setup_default_tags
def setup_default_tags
defaults = {
org: org,
ProjectName: name
}
self.tags = GeoEngineer::SubResource.new(self, 'tags') unless self.tags
defaults.each do |key, value|
Nov 04 22:27:03 ip-10-21-1-206.ec2.internal sh[3861]: 10.21.2.218 - - [04/Nov/2014:22:27:03 +0000] "GET /v1/repositories/lonely-quotient/images HTTP/1.1" 200 1748 "-" "docker/1.3.0 go/go1.3.2 git-commit/c78088f kernel/3.16.2+ os/linux arch/amd64"
Nov 04 22:27:03 ip-10-21-1-206.ec2.internal sh[3861]: 10.21.2.218 - - [04/Nov/2014:22:27:03 +0000] "GET /v1/repositories/library/taller-handbill/tags HTTP/1.1" 200 474 "-" "docker/1.3.0 go/go1.3.2 git-commit/c78088f kernel/3.16.2+ os/linux arch/amd64"
Nov 04 22:27:04 ip-10-21-1-206.ec2.internal sh[3861]: 10.21.2.218 - - [04/Nov/2014:22:27:04 +0000] "GET /v1/repositories/library/lonely-quotient/tags HTTP/1.1" 200 158 "-" "docker/1.3.0 go/go1.3.2 git-commit/c78088f kernel/3.16.2+ os/linux arch/amd64"
Nov 04 22:27:04 ip-10-21-1-206.ec2.internal sh[3861]: 10.21.2.218 - - [04/Nov/2014:22:27:04 +0000] "GET /v1/images/10038695a0264b9e9196a8861d3626da10038695a0264b9e9196a8861d3626da/ancestry HTTP/1.1" 200 1632 "-" "docker/1.3.0 go/go1.3.2 git-commit/c78088f kernel/3.16.2+ os