Skip to content

Instantly share code, notes, and snippets.

View bruceherve's full-sized avatar
💭
Architecting and building distributed systems

Bruce Hervé bruceherve

💭
Architecting and building distributed systems
View GitHub Profile
@bruceherve
bruceherve / nginx.conf
Created February 20, 2023 07:58 — forked from alexishida/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;
func SendPushNotification(deviceTokens []string) error {
decodedKey, err := getDecodedFireBaseKey()
if err != nil {
return err
}
opts := []option.ClientOption{option.WithCredentialsJSON(decodedKey)}
app, err := firebase.NewApp(context.Background(), nil, opts...)
@bruceherve
bruceherve / ec2-apache.sh
Created October 26, 2022 14:28 — forked from herrera-ignacio/ec2-apache.sh
EC2 User data: install Apache web server for Amazon Linux 2 Image
#!/bin/bash
########################################
##### USE THIS WITH AMAZON LINUX 2 #####
########################################
# get admin privileges
sudo su
# install httpd (Linux 2 version)
@bruceherve
bruceherve / Nginx_Minio_SSL_Term.md
Created June 8, 2022 14:27 — forked from nitisht/Nginx_Minio_SSL_Term.md
Self-signed certificate setup with Nginx proxying requests to Minio Server

Nginx SSL termination for Minio server load balanced setup

This document explains the steps required to set up Nginx proxy and SSL termination for Minio servers running in the backgronud.

Generate self signed certificate

Create a directory /etc/nginx/ssl/domain.abc, here domain.abc is the name of your website domain. Then use the below commands

sudo openssl genrsa -out private.key 2048
sudo openssl req -new -x509 -days 3650 -key private.key -out public.crt -subj "/C=US/ST=state/L=location/O=organization/CN=domain.abc"
@bruceherve
bruceherve / minio-nginx-selfsigned.sh
Created June 7, 2022 12:44 — forked from superseb/minio-nginx-selfsigned.sh
Minio + NGINX in Docker using self signed certificates
#!/bin/bash
if [ "$#" -lt 0 ]; then
echo "Usage: $0"
exit 1
fi
echo "Generating nip.io based on found external IP"
FOUNDIP=$(docker run --rm --net=host appropriate/curl https://api.ipify.org)
APIFQDN="minio-api.${FOUNDIP}.nip.io"
FQDN="minio.${FOUNDIP}.nip.io"
@bruceherve
bruceherve / go-shebang-story.md
Created April 13, 2022 13:06 — forked from posener/go-shebang-story.md
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

# Source: https://gist.github.com/ed8ad113fff4322ef309198d5455687f
##############################################################################################
# Full App Lifecycle In Kubernetes With Argo CD, DevSpace, vCluster, k3d, and GitHub Actions #
# https://youtu.be/uU-EAQ8Vbvk #
##############################################################################################
# Referenced videos:
# - How To Create Virtual Kubernetes Clusters With vcluster By loft: https://youtu.be/JqBjpvp268Y
# - DevSpace - Development Environments in Kubernetes: https://youtu.be/nQly_CEjJc4