Skip to content

Instantly share code, notes, and snippets.

View kadu-ribeiro's full-sized avatar

Carlos Eduardo Mendes Pinto Ribeiro kadu-ribeiro

View GitHub Profile
@kadu-ribeiro
kadu-ribeiro / postgres_fdw.sql
Created September 6, 2019 13:19 — forked from sathed/postgres_fdw.sql
postgres_fdw example
/***** "Remote" server first *****/
-- Note: Unless the object you are trying to gain access to is in the same DATABASE, it's a remote datebase. Even if it's
-- on the same node!
-- 1. create the role and assign it a password. Note: CREATE USER is an alias for CREATE ROLE. Either one is fine
CREATE ROLE new_user WITH PASSWORD 'somepassword';
-- 2. Grant the required permissions. This grants select, insert, update, and delete on all tables in the public schema.
-- I also gave execute to all functions in the public schema as well.
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO new_user;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO new_user;
@kadu-ribeiro
kadu-ribeiro / linux-franz.md
Created September 2, 2019 13:37
Tutorial para instalação do FRANZ no Linux

Como instalar o Franz no Linux e ter vários mensageiros no mesmo app

Para instalar o Franz no Linux e ter vários mensageiros no mesmo app, você só precisa fazer o seguinte:

  1. Abra um terminal;
  2. Caso já tenha feito alguma instalação manual, apague a pasta, o link e o atalho anterior com esse comando;
sudo rm -Rf /opt/franz*
sudo rm -Rf /usr/bin/franz
sudo rm -Rf /usr/share/applications/franz.desktop
@kadu-ribeiro
kadu-ribeiro / nginx-tuning.md
Created August 13, 2019 17:08 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@kadu-ribeiro
kadu-ribeiro / nginx-proxy.conf
Created August 6, 2019 23:45 — forked from brickpop/nginx-proxy.conf
Example of an nginx virtual host with a selective cached reverse proxy
# TO DO
# - Replace '9000' with your local port
#
# - Run certbot to geherate a certificate for domain-name.com and uncoment the HTTPS section below
# $ certbot certonly --webroot -w /var/www/certbot -d www.domain-name.com -d domain-name.com
upstream app-server {
ip_hash;
server: localhost:9000;
# server: localhost:9001; # used if clustering is available