Skip to content

Instantly share code, notes, and snippets.

View kuccello's full-sized avatar

Kristan Krispy Uccello kuccello

View GitHub Profile
@kuccello
kuccello / Dockerfile
Created December 10, 2020 20:23
Api Server Dockerfile
FROM my-base-image:nx-base AS builder
ARG NODE_ENV
ARG BUILD_FLAG
WORKDIR /app/builder
COPY . .
RUN npx nx build api-server ${BUILD_FLAG}
FROM my-base-image:nx-base
@kuccello
kuccello / Dockerfile
Created December 10, 2020 20:22
React-Client Dockerfile
FROM my-base-image:nx-base AS builder
ARG NODE_ENV
ARG BUILD_FLAG
WORKDIR /app/builder
COPY . .
RUN npx nx build react-client ${BUILD_FLAG}
FROM nginx:1.19.2
user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
version: "3.8"
networks:
corp:
driver: bridge
services:
api-server:
container_name: api-server
build:
[HOST]$> curl --retry 300 --retry-delay 1 --retry-connrefused -XGET "http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=3m"
{"cluster_name":"fess-es","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":1,"active_shards":1,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":100.0}%
[HOST]$> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b27e2cf494a3 codelibs/fess:snapshot "/bin/sh -c /usr/sha…" 10 minutes ago Up 10 minutes 9200/tcp, 0.0.0.0:8080->8080/tcp, 9300
@kuccello
kuccello / audit.log
Created May 22, 2020 13:49
Fess Instance Wont Authenticate Admin User
action:LOGIN_FAILURE class:LocalUserCredential user:admin ip:172.30.0.1 time:2020-05-22T13:37:58.531886Z
/**
* This example assumes you have a proxy server setup.
* I am using Squid 3.5 with a rule set that allows all requests to pass through.
* My proxy is running in a docker container mapping port 31280 => 3128 for the squid instance.
* My proxy setup works for other Google client libraries such as Firestore etc.
*/
// ------ If you comment out the code encolsed with these comments then GSM returns values as expected ----------
const proxyAddress = process.env.USE_PROXY ? process.env.USE_PROXY : 'http://127.0.0.1:31280'
@kuccello
kuccello / machine.js
Last active September 9, 2019 22:25
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// Kristan 'Krispy' Uccello
// Feb.26.2018
//
// (Modified version of docs from: https://developers.google.com/drive/v3/web/quickstart/nodejs)
// Step 1: Turn on the Drive API
// a) Use this wizard (https://console.developers.google.com/start/api?id=drive) to create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials.
// b) On the Add credentials to your project page, click the Cancel button.
// c) At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set, and click the Save button.
// d) Select the Credentials tab, click the Create credentials button and select OAuth client ID.
// e) Select the application type Other, enter the name "Drive API Quickstart", and click the Create button.
@kuccello
kuccello / read.js
Created October 19, 2017 00:42
Read from firestore
export function getWorkerProfile(id, res) {
let ref = db.collection('scratch').doc('v1').collection('workers').doc(`${id}`);
ref.get().then(doc=>{
if (!doc.exists) {
res.status(500).send('Error occurred: No Such Worker');
} else {
console.log('Document data:', doc.data());
res.status(200).send(doc.data());
}
}).catch(err => {