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 / django-media-permissions.md
Last active September 4, 2024 07:02
Fix Django Media Folder Permissions

Check your current file/directory permission with:

stat -c "%a" /path/to/dir_or_file

To recursively give directories read&execute privileges:

find /path/to/base/dir -type d -exec chmod 755 {} +
@douglasmiranda
douglasmiranda / notes.md
Last active July 23, 2018 03:13
Notes about CI/CD + Private Container Registry
@douglasmiranda
douglasmiranda / install.md
Last active January 22, 2019 20:30
Debian Stretch + Docker (PT-BR) (Digital Ocean)

Debian Stretch + Docker

Setup replicado na Digital Ocean e CloudCone, mas funciona basicamente da mesma forma em qualquer server com Debian Stretch + acesso root por ssh.

Resumo:

  • vamos criar um usuário comum do sistema, permitir que ele execute comandos sudo (requisitando senha)
  • vamos conectar ao servidor com ssh com o novo usuário, com acesso a partir de chave pública e desabilitar acesso ssh com senha, bem como acesso ssh do root direto
  • configurar um simples firewall
  • instalar Docker e executá-lo sem o sudo
  • No fim há um tópico "Possíveis erros", então ao se deparar com erros, visite essa seção
@douglasmiranda
douglasmiranda / solution.md
Created July 19, 2018 06:01
Drone agent loses connection when deployed with Docker Swarm

Solution:

In your Drone server set the environment variable:

DRONE_KEEPALIVE_MIN_TIME: 5s

In your Drone agent set the environment variables:

@douglasmiranda
douglasmiranda / instructions.md
Created July 19, 2018 05:51
Add email to Keybase.io PGP Key (Public Key)

Export your public key:

keybase pgp export > keybase-public.key

Export your private key:

keybase pgp export --secret > keybase-private.key
@douglasmiranda
douglasmiranda / gomplate.md
Last active July 11, 2018 21:07
gomplate get secret from file
@douglasmiranda
douglasmiranda / fix.md
Last active August 18, 2024 11:59
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}