Skip to content

Instantly share code, notes, and snippets.

View alombarte's full-sized avatar

A. Lombarte alombarte

View GitHub Profile
#!/bin/bash
# Entrypoint with password replacement based on ___PLACEHOLDERS___
# Only works in bash, does not work on sh (e.g.: Alpine)
FILE_TO_REPLACE="krakend.json"
passwords_to_replace="$(grep -o '___.*___' $FILE_TO_REPLACE | sed 's/___//g' | sort | uniq )"
for pass in $passwords_to_replace; do
if [ "x${!pass}" = 'x' ]; then
echo "[KO] Environment variable '$pass' is not declared and the configuration replacement failed!"
@alombarte
alombarte / Dockerfile
Last active April 22, 2024 02:42
Multi-stage build to compile krakend's flexible configuration
FROM devopsfaith/krakend as builder
ARG ENV=prod
COPY krakend.tmpl .
COPY config .
# Save temporary file to /tmp to avoid permission errors
RUN FC_ENABLE=1 \
FC_OUT=/tmp/krakend.json \
FC_PARTIALS="/etc/krakend/partials" \
@alombarte
alombarte / docker-compose.yml
Created June 4, 2020 17:45
Balance two krakend nodes using HAProxy
version: "3"
services:
balancer:
image: haproxy:1.7
volumes:
- ".//haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg"
ports:
- "8080:80"
krakend_1:
image: devopsfaith/krakend
@alombarte
alombarte / extractIssuesFromJira.sh
Created January 27, 2020 18:47
Retrieve all the JIRA issues between the tag and the previous tag. Optionally surround the issues with the JIRA url to the issues.
#!/bin/bash
# Finds all the strings looking as issues (e.g: ISSUE-123) in the commit log and returns its links
# The issues can optionally be surrounded with a prefix or a suffix to print issue tracker URLS.
# Issues ARE NOT expected to be found in the first position of the commit log (e.g: Merge feature branch 'feature/ISS-123')
#
# Example (extract issues between v1.2.3 and v1.2.2
# --------
# Input:
# extractIssuesFromJira.sh v1.2.3 'http://jira.url/browse/'
#