Skip to content

Instantly share code, notes, and snippets.

View Asjas's full-sized avatar
πŸ”₯

A-J Roos Asjas

πŸ”₯
View GitHub Profile

Coolify Orchestrated DB Cluster

In this project, our goal is to establish a robust and scalable infrastructure for a PostgreSQL database with high availability, seamless security, and integrated monitoring and alerting systems.

Introduction

We'll leverage tools like Patroni, Consul, Vault, Prometheus, Grafana, and Cert-Manager to ensure a comprehensive, modern solution. Coolify will act as our orchestration platform, managing various services and simplifying deployments. We aim to not only build a highly available database cluster but also provide a learning experience for interns that demonstrates best practices in DevOps, security, and observability.

The backbone of our infrastructure will focus on a distributed, high-availability PostgreSQL cluster. To ensure reliability, we’ll introduce Patroni for automating failover, Consul for service coordination, and Vault for managing sensitive information. Monitoring will be handled by Prometheus and visualized u

@Asjas
Asjas / luhnAlgorithm.ts
Created July 8, 2022 18:01
Luhn Algorithm
// https://github.com/muhammadghazali/mod10
function LuhnAlgorithm(RSA_ID: string) {
let isValid = false;
let checkDigit;
let sumOfAllNumbers = 0;
let reversedIdentifier = [];
const identifierString = RSA_ID;
checkDigit = identifierString.charAt(identifierString.length - 1);
@Asjas
Asjas / app.js
Created May 21, 2022 10:07
React "as" Prop Example
const Headline = ({ as = 'h1', children }) => {
const As = as;
return <As>{children}</As>;
};
const App = () => {
return (
<>
<Headline>Hello React</Headline>
<Headline as="h2">Hello React</Headline>
@Asjas
Asjas / reset.css
Last active October 17, 2023 23:13
My CSS Reset
/* Box sizing rules */
html {
box-sizing: border-box;
}
/* Set core root defaults */
html:focus-within {
scroll-behavior: smooth;
}
@Asjas
Asjas / scss.txt
Created May 19, 2021 07:12
Pretty neat SCSS folder structure
// https://matthiasott.com/notes/how-i-structure-my-css
/scss/
β”œβ”€β”€ 1-settings
β”‚ └── _global.scss
β”œβ”€β”€ 2-design-tokens
β”‚ β”œβ”€β”€ _colors.scss
β”‚ β”œβ”€β”€ _fonts.scss
β”‚ β”œβ”€β”€ _media-queries.scss
β”‚ β”œβ”€β”€ _spacing.scss
@Asjas
Asjas / reset.css
Created May 19, 2021 07:09
Modern CSS Reset - Andy Bell
// https://piccalil.li/blog/a-modern-css-reset
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Remove default margin */
@Asjas
Asjas / index.js
Last active March 22, 2021 15:41
Node Backpressure Aware Copy
function backpressureAwareCopy(srcStream, destStream) {
srcStream.on('data', (chunk) => {
const canContinue = destStream.write(chunk);
if (!canContinue) {
// if we are overflowing the destination, we stop reading
srcStream.pause();
// once all the buffered data is flushed, we resume reading from source
destStream.once('drain', () => srcStream.resume());
}
})
@Asjas
Asjas / system-queries.sql
Created February 28, 2021 19:09
PostgreSQL System Table Queries
// This query returns a list of tables, in alphabetical order, with a count of the columns.
SELECT table_name
,COUNT(column_name)
FROM information_schema.columns
WHERE table_schema = 'myschema' -- put your schema here
GROUP BY table_name
ORDER BY table_name;
// This query returns a list of tables, in alphabetical order, with a count of the rows.
@Asjas
Asjas / index.js
Created February 16, 2021 21:04
Node.js ES modules __dirname and __filename
import { fileURLToPath } from 'url';
import { dirname } from 'path';
console.log(`import.meta.url: ${import.meta.url}`);
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
console.log(`dirname: ${__dirname}`);
console.log(`filename: ${__filename}`);
@Asjas
Asjas / Dockerfile
Last active September 20, 2020 15:36
Example Node.js Production Dockerfile
FROM node:10.16.2-stretch
EXPOSE 3000
ENV NODE_ENV production
# Create work environment and set up app
RUN mkdir /app && chown -R node:node /app
WORKDIR /app
USER node