Skip to content

Instantly share code, notes, and snippets.

Avatar

Hefesto misTrasteos

  • Madrid, Spain
View GitHub Profile
@misTrasteos
misTrasteos / README.md
Last active Feb 20, 2021
Self hosted Apache Maven repository, Reposilite, PoC
View README.md

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
Last active Feb 18, 2021
Trying to build my own github actions agent
View Dockefile
# 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
Created Feb 12, 2021
Download all maven dependencies into a folder using maven docker image
View README.md

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 / generateRandomWalk.py
Last active Feb 11, 2021
generate a random walk time series
View generateRandomWalk.py
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 / generateMinutesFromLastWeek.py
Created Feb 10, 2021
Generate a week of minutes for fake log purposes
View generateMinutesFromLastWeek.py
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 / README.md
Last active Feb 2, 2021
generate a Docker image from a python script
View README.md

Files

requirements.txt

prometheus-client==0.9.0

client.py

from prometheus_client import start_http_server, Counter
import time
@misTrasteos
misTrasteos / Volumenes con Kubernetes y Kind.md
Last active Jan 28, 2021
PersistentVolume en Kubernetes con Kind
View Volumenes con Kubernetes y Kind.md

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 / Kubernetes hostPath volumes in Kind.md
Last active Jan 24, 2021
Kubernetes hostPath volumes in Kind
View Kubernetes hostPath volumes in Kind.md

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