Skip to content

Instantly share code, notes, and snippets.

View misTrasteos's full-sized avatar

Álvar Torres misTrasteos

  • Madrid, Spain
View GitHub Profile
@misTrasteos
misTrasteos / Kubernetes hostPath volumes in Kind.md
Last active January 24, 2021 16:20
Kubernetes hostPath volumes in Kind

create the cluster

We need to provide some extra options when creating the kind cluster.

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraMounts:
 - hostPath: /kubernetes/volumes
@misTrasteos
misTrasteos / Volumenes con Kubernetes y Kind.md
Last active October 7, 2023 22:30
PersistentVolume en Kubernetes con Kind

Volumenes con Kubernetes y Kind

Esto es una prueba de concepto de cómo funcionan los PersistentVolume en kubernetes. Creo un PersistentVolume y a partir de un PersistentVolumeClaim lo comparto entre dos contenedores. Un contenedor (aplicación java) escribe texto en el volumen. Mientras que el otro contenedor(un nginx) publica el contenido del volumen. He utilizado Kind.

Kind cluster

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
 extraMounts:
@misTrasteos
misTrasteos / README.md
Last active February 2, 2021 21:41
generate a Docker image from a python script

Files

requirements.txt

prometheus-client==0.9.0

client.py

from prometheus_client import start_http_server, Counter
import time
@misTrasteos
misTrasteos / generateMinutesFromLastWeek.py
Created February 10, 2021 21:47
Generate a week of minutes for fake log purposes
import datetime
now = datetime.datetime.now().replace(second=0, microsecond=0)
# I use replace method to round to second and microsecond, as datetime is inmutable
minutesInAWeek = 7 * 24 * 60 # 7 days in a week, 24 hours a day, 60 minutes an hour
for i in reversed(range(minutesInAWeek)):
minuteInThePast = now - datetime.timedelta(minutes = i)
@misTrasteos
misTrasteos / generateRandomWalk.py
Last active February 11, 2021 22:33
generate a random walk time series
import matplotlib.pyplot as plt
import numpy as np
numberOfDays = 7
minutesPerDay = 24 * 60
def addNoise(array, noise=5):
# some random noise
return array + np.random.rand( len(array) ) * noise
@misTrasteos
misTrasteos / README.md
Created February 12, 2021 18:29
Download all maven dependencies into a folder using maven docker image

how to run

run this container from the root of your maven project.

docker run -it --rm -v "$(pwd)/dependencies":/root/.m2 -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven mvn dependency:go-offline

All dependencies will be downloaded in this directory

@misTrasteos
misTrasteos / Dockefile
Last active February 18, 2021 21:22
Trying to build my own github actions agent
# DISCLAIMER, this is not the best way to build a Docker Image. It is still WIP, so I find this way easier to modify.
FROM ubuntu:20.04
ARG JAVA_VERSION=adoptopenjdk-8-hotspot
ARG MAVEN_VERSION=3.6.3
# general stuff
RUN apt-get update
RUN apt-get install wget -y
RUN apt-get install apt-transport-https -y
@misTrasteos
misTrasteos / README.md
Last active May 8, 2023 12:15
Self hosted Apache Maven repository, Reposilite, PoC

What is this ?

This is a PoC of running a self hosted Apache Maven Repository, Reposilite, and use it as a distribution management.

Just running the usual mvn clean deploy, but deploy the jar into Reposilite.

All Apache Maven commands will run inside the Apache Maven Docker image

Components

Docker Network

Building Maven containers needs to 'see' Reposilite ones. So we are going to create a network so as to all containers can see each other.

@misTrasteos
misTrasteos / Dockefile
Created July 25, 2021 11:22
Redis distroless Docker image
ARG GCC_VERSION=11
FROM gcc:${GCC_VERSION} AS builder
ARG REDIS_VERSION=stable
# from https://redis.io/topics/quickstart
RUN wget https://download.redis.io/releases/redis-${REDIS_VERSION}.tar.gz && \
tar xvzf redis-${REDIS_VERSION}.tar.gz && \
cd redis-${REDIS_VERSION} && \

Install latest version

Ubuntu

sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install git

commit

empty commits