Skip to content

Instantly share code, notes, and snippets.

View mau21mau's full-sized avatar

Mauricio Junior mau21mau

View GitHub Profile
@mau21mau
mau21mau / README.md
Last active April 9, 2024 10:51
Configure Google Cloud's Cloud Run service with custom domain

These are the steps to Deploy a Cloud Run service that will:

  1. Communicate with the internet passing through your VPC.
  2. Be accessible through a custom domain managed outside GCP.

NOTE: If your VPC has a Nat Gateway and Router with an static IP address, then your Cloud Run will have a static Outbound IP allowing things like database whitelisting.

Now with the steps:

  1. Create and static preimum Global IP to bind to the LoadBalancer later. Point the subdomain to that IP on CloudFlare
@mau21mau
mau21mau / setup-loadbalancer-with-nginx-ingress-controller.md
Last active April 10, 2024 20:58
How to setup Nginx Ingress Controller and L7 HTTP(S) Load Balancer to work together on GKE

This steps assume we already have a Cluster created with VPC-native traffic routing enabled.

Before the need of the HTTP(S) LoadBalancer, I would just apply the manifests provided by the NGINX DOCS page for the installation of the Nginx Ingress Controller and It would create a service of type LoadBalancer which would, then, create a regional L4 LoadBalancer automatically.

But now that I need need to have Cloud Armor and WAF, the L4 Loadbalancer doesn't support it. A HTTP(S) Load Balancer is needed in order to Cloud Armor to work.

In order to have Nginx Ingress controller working with the new HTTPS(S) LoadBalancer we need to change the type: LoadBalancer on the Nginx Ingress Controller service to ClusterIP instead, and add the NEG annotation to it cloud.google.com/neg: '{"exposed_ports": {"80":{"name": "ingress-nginx-80-neg"}}}'. We do that because we don't want it to generate a L4 LoadBalancer for us. Instead, we will manually create an HTTP(S) LoadBalancer and bind it t

@mau21mau
mau21mau / README.md
Created December 28, 2017 16:38
Configure Debug for App Engine python Standard on VSCode

Python Debug for VSCode on Google App Engine

This gist aims to show how to configure debug for VScode and python development on the Google App Engine Standard Environment. This tutorial is based on this article, with some additional information that didn't seem much clear for me.

Step 1: Open the application directory in VSCode.

Step 2: Download the latest version of ptvsd module here. Copy it to your working directory, extract it, than enter the extracted folder (the one that contains setup.py) and copy the ptvsd folder to your root project (where app.yaml resides).

Step 3: Create a tasks.json file with the VSCode command. Press CTRL+SHIFT+B to "Run build task". As no task is configured it will create one from a template which you will have to choose. Once created, place the following content into taksks.json:

@mau21mau
mau21mau / README.md
Last active June 25, 2024 21:12
Configure Celery + Supervisor With Django
@mau21mau
mau21mau / README.md
Last active May 15, 2019 18:02
UWSGI + Django Ubuntu >= 16.04

Install Python3 base stuff

sudo apt-get install python3-dev
sudo apt-get install python3-setuptools
sudo apt-get install python3-kivy
@mau21mau
mau21mau / gist:59c7f373d4248104b257
Last active May 22, 2019 00:40
Webserver: Django com uWSGi e Nginx no Ubuntu >= 12.04

Webserver: Django com uWSGi e Nginx no Ubuntu >= 12.04

OBS.: A pasta onde os projetos django serão hospedadas nesse tutorial é /home/sysadmin/webapps/. Por isso, criando a pasta:

cd /home/sysadmin/
mkdir webapps