Skip to content

Instantly share code, notes, and snippets.

Eric Fossas efossas

Block or report user

Report or block efossas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@efossas
efossas / rs_config.js
Created Jul 18, 2019
Mongo Replica Set Script
View rs_config.js
function initReplicaSet() {
return rs.initiate({
"_id": "appReplicaSet",
"members": [
{
"_id": 0,
"host": "mongo_1:27017"
},
{
"_id": 1,
@efossas
efossas / mongo-change-stream-compose.yml
Created Jul 18, 2019
Docker Compose File For Mongo Change Stream Sockets Set Up
View mongo-change-stream-compose.yml
version: "3.7"
services:
front:
build: ./front
volumes:
- ${PWD}/front/src:/project
ports:
- 8080:80
networks:
@efossas
efossas / mongo-front.html
Created Jul 18, 2019
Mongo Change Stream Front End
View mongo-front.html
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script>
<script>
function connect() {
if (!window.socket) window.socket = io.connect('http://localhost:8083');
let form = document.getElementById('socketForm');
let uuid = form.elements.namedItem("uuid").value;
@efossas
efossas / mongo-back.js
Created Jul 18, 2019
Mongo Change Stream Back End
View mongo-back.js
'use strict';
const config = require('./config.json');
const http = require('http');
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const MUUID = require('uuid-mongodb');
const mongo = require('mongodb');
@efossas
efossas / events.js
Created Jul 18, 2019
Socket Events
View events.js
/*
eventName: Check
data: any
*/
const Check = (socket) => {
socket.on('Check', (data) => {
socket.emit('Check', data);
});
};
@efossas
efossas / mongo-change-streams-sockets.js
Created Jul 18, 2019
SocketIO Server That Listens To Mongo Change Streams
View mongo-change-streams-sockets.js
'use strict';
const config = require('./config.json');
const mongo = require('mongodb');
const MUUID = require('uuid-mongodb');
const http = require('http').createServer();
const io = require('socket.io')(http);
const redisAdapter = require('socket.io-redis');
const events = require('./events.js');
@efossas
efossas / nginx-stub-status.conf
Last active Jul 4, 2019
Nginx Server With Additional Port For Stub Status
View nginx-stub-status.conf
user nginx;
worker_processes auto;
error_log /dev/stdout warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@efossas
efossas / nginx-exporter-istio-deployment.yml
Created Jul 4, 2019
Deployment Using Nginx Exporter In Istio Service Mesh
View nginx-exporter-istio-deployment.yml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ${YOU DEPLOYMENT}
namespace: ${YOUR NAMESPACE}
labels:
app: ${YOUR APP NAME}
spec:
replicas: 1
selector:
@efossas
efossas / prometheus-port-forward.sh
Created Jul 4, 2019
Port Forward To Prometheus
View prometheus-port-forward.sh
kubectl port-forward --namespace metrics $(kubectl get pod --namespace metrics --selector="app=prometheus,component=server,release=metrics" --output jsonpath='{.items[0].metadata.name}') 8080:9090
@efossas
efossas / helm-prometheus.sh
Created Jul 4, 2019
Helm Install Prometheus
View helm-prometheus.sh
helm upgrade metrics stable/prometheus \
--tls --install \
--namespace metrics \
--values prometheus.yml
You can’t perform that action at this time.