Skip to content

Instantly share code, notes, and snippets.

👽
Writing code from another galaxy.

Douglas Miranda douglasmiranda

👽
Writing code from another galaxy.
View GitHub Profile
@douglasmiranda
douglasmiranda / answer.md
Last active Dec 8, 2018
Can I retrieve user's IP address in docker swarm mode?
View answer.md

Answer: "NO" (2018-12-08)

When you're running your service on a container as a node of Docker Swarm, you're gonna get the IP of the ingress network gateway, not the user's IP.

Of course there's solutions, not an ideal one, but workarounds with each tool you're using. (Nginx, Caddy, Traefik..)

Related links:

@douglasmiranda
douglasmiranda / drone.md
Created Nov 26, 2018
Status: how Drone deals with monorepo; dir/file changed conditions
View drone.md

Well there's no builtin way of doing.

The problem is:

We need a way of skipping steps, or conditional pipelines that are triggered when some dir/* files.* were changed since last commit.

Useful if you maintain a:

  • Monorepo
@douglasmiranda
douglasmiranda / django-media-permissions.md
Last active Jun 29, 2020
Fix Django Media Folder Permissions
View django-media-permissions.md

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 Jul 23, 2018
Notes about CI/CD + Private Container Registry
View notes.md
@douglasmiranda
douglasmiranda / install.md
Last active Jan 22, 2019
Debian Stretch + Docker (PT-BR) (Digital Ocean)
View install.md

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 Jul 19, 2018
Drone agent loses connection when deployed with Docker Swarm
View solution.md

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 Jul 19, 2018
Add email to Keybase.io PGP Key (Public Key)
View instructions.md

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 Jul 11, 2018
gomplate get secret from file
View gomplate.md
@douglasmiranda
douglasmiranda / fix.md
Last active Sep 26, 2019
Docker Registry (Distribution) + Minio/s3: fix the "Retrying in X seconds" | failed with status: 503 Service Unavailable
View fix.md
@douglasmiranda
douglasmiranda / notes.md
Created May 19, 2018
Notes about: Drone - Continuous Delivery
View notes.md

How to use volumes and privileged containers?

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

How to cache:

You can’t perform that action at this time.