Skip to content

Instantly share code, notes, and snippets.

View douglasmiranda's full-sized avatar
👽

Douglas Miranda douglasmiranda

👽
  • Earth, Brazil
View GitHub Profile
@douglasmiranda
douglasmiranda / gomplate.md
Last active July 11, 2018 21:07
gomplate get secret from file
@douglasmiranda
douglasmiranda / fix.md
Last active October 26, 2021 11:26
Docker Registry (Distribution) + Minio/s3: fix the "Retrying in X seconds" | failed with status: 503 Service Unavailable
@douglasmiranda
douglasmiranda / notes.md
Created May 19, 2018 21:28
Notes about: Drone - Continuous Delivery

How to use volumes and privileged containers?

Repository's sidebar menu: Settings > Project Settings > and mark "Trusted"

How to cache:

@douglasmiranda
douglasmiranda / default.conf
Last active May 8, 2018 06:18
Nginx Microcaching
# ...
# In Django you can tell the Nginx to not cache with:
# https://docs.djangoproject.com/en/2.0/topics/http/decorators/#module-django.views.decorators.cache
# Microcache - Want 150 requests/sec to become 1200?
#
# https://www.nginx.com/blog/benefits-of-microcaching-nginx/
# http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache
proxy_cache_path /tmp/cache keys_zone=cache:10m max_size=10g levels=1:2 inactive=600s max_size=100m;
@douglasmiranda
douglasmiranda / Caddyfile
Created May 7, 2018 02:49
Caddy config for Django
# https://github.com/douglasmiranda/dockerfiles/tree/master/caddy
# https://caddy.community/t/caddy-as-a-proxy-for-django/2164/2
www.{$DOMAIN_NAME} {
redir https://example.com
}
{$DOMAIN_NAME} {
proxy / django:5000 {
header_upstream Host {host}
# Based on https://www.pgday.ch/common/slides/2017_ver6_pgbouncer_20k_English.pdf
# Just connect to pgbouncer like you would connect to a postgres server
# In this case using the port 6432
# Run pgbouncer as the user pgbouncer (su-exec)
[databases]
db1 = host=postgres port=5432 dbname=db1
[pgbouncer]
listen_addr = *
listen_port = 6432
@douglasmiranda
douglasmiranda / nginx.conf
Created May 4, 2018 01:00 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# Advanced config for NGINX
server_tokens off;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
while ! pg_isready > /dev/null 2> /dev/null; do echo "Connecting to postgres failed"; sleep 1; done
$ pipenv install gconfigs # or pip install gconfigs
$ pipenv run python
>>> from gconfigs import envs, configs, secrets
>>> envs('HOME', default='/')
'/'
>>> configs.as_bool('DEBUG', default=False)
False
>>> configs('DATABASE_USER')
@douglasmiranda
douglasmiranda / megamenu.html
Created February 2, 2018 00:01
Bootstrap Mega Menu Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://unpkg.com/bootstrap-material-design@4.0.0-beta.4/dist/css/bootstrap-material-design.min.css" integrity="sha384-R80DC0KVBO4GSTw+wZ5x2zn2pu4POSErBkf8/fSFhPXHxvHJydT0CSgAP2Yo2r4I" crossorigin="anonymous">
<style>
#mega-menu {
margin-top: 50px;