Install rancher on k3os with centralized datastore on mysql cluster.
- Host: Ubuntu 18.04.4 Desktop (32gb ram 4 cpu)
- Virtualisation: kvm/qemu (virtual machine manager)
- Local network: 192.168.0.0/16
- Gateway: 192.168.0.1
#!/usr/bin/ruby | |
#usage: youtube-to-mp3 <youtube-url> | |
#example: youtube-to-mp3 http://www.youtube.com/playlist?list=PL398CE05652474A1E | |
#desc: downloads a single youtube vid or a playlist, then converts to mp3. | |
# Requires youtube-dl and ffmpeg | |
url = ARGV[0] | |
system("youtube-dl -citA #{url}") |
#!/bin/bash | |
# gets iam security credentials from instance metadata and writes them to | |
# awscli environment variables and .s3cfg (for s3cmd) | |
# Usage: ec2-get-security-credentials ROLENAME DEFAULT_REGION | |
# ROLE=$1 | |
# DEFAULT_REGION=$2 | |
import boto3 | |
def role_arn_to_session(**args): | |
""" | |
Usage : | |
session = role_arn_to_session( | |
RoleArn='arn:aws:iam::012345678901:role/example-role', | |
RoleSessionName='ExampleSessionName') | |
client = session.client('sqs') | |
""" |
import socket | |
def find_open_port(): | |
""" | |
Use socket's built in ability to find an open port. | |
""" | |
sock = socket.socket() | |
sock.bind(('', 0)) |
import boto3 | |
from boto3.session import Session | |
def assume_role(arn, session_name): | |
"""aws sts assume-role --role-arn arn:aws:iam::00000000000000:role/example-role --role-session-name example-role""" | |
client = boto3.client('sts') | |
account_id = client.get_caller_identity()["Account"] | |
print(account_id) |
# MASTER PRE-REQS | |
# Install docker, docker-compose | |
# mkdir -p ~/{jenkins,jnlp_slave} | |
# master | |
# docker run -d \ | |
# -u root \ | |
# --name=jenkins \ | |
# -e TZ=America/Denver \ |
# Source: https://gist.github.com/baaf4adb25e9efaba886c17a2ad722a5 | |
######################################################## | |
# How To Auto-Scale Kubernetes Clusters With Karpenter # | |
# https://youtu.be/C-2v7HT-uSA # | |
######################################################## | |
# Referenced videos: | |
# - Karpenter: https://karpenter.sh | |
# - GKE Autopilot - Fully Managed Kubernetes Service From Google: https://youtu.be/Zztufl4mFQ4 |
# -*- coding: utf-8 -*- | |
import os | |
import uuid | |
from flask import Flask, render_template, redirect, url_for, request | |
from flask_uploads import UploadSet, configure_uploads, IMAGES, patch_request_class | |
from flask_wtf import FlaskForm | |
from flask_wtf.file import FileField, FileRequired, FileAllowed | |
from wtforms import SubmitField |