CategoriesUncategorized

Argo CD Too Many Redirects issue Using TLS Termination at Traefik with Let’s Encrypt

The problem is that by default Argo-CD handles TLS termination itself and always redirects HTTP requests to HTTPS. Combine that with an ingress controller that also handles TLS termination and always communicates with the backend service with HTTP and you get Argo-CD’s server always responding with a redirects to HTTPS.

For my case, i have Traefik with Let’s Encrypt where the SSL is offloaded, then ingress controller receives on port 80, then forward to argocd-server service on insecure port (80).

I fixed the issue of too-many-redirects by implementing this solution (Modifying the Deployment.yaml for argocd-server):

spec:
  containers:
  - command:
    - argocd-server
    - --staticassets
    - /shared/app
    - --insecure # <-- this thing needs to be added
CategoriesUncategorized

Install pyenv on MacOS

For Python in macOS, use pyenv:

brew install pyenv

To install a specific Python version, run:

pyenv install <version>

To select a version for every command run with the current folder:

pyenv local 3.5.0

Note that you must update PATH in your environment to find pyenv’s python3 before any other:

PATH="~/.pyenv/shims:${PATH}"

To list available versions:

pyenv versions

See https://gist.github.com/Bouke/11261620 for more information.

CategoriesUncategorized

Pulumi Using JS Quick Start Guide for AWS

This guide is intended for an audience that truly wants the “quickest” way to get started with Pulumi. Other articles on the internet are more in-depth. This article serves as the least path of resistance.

Install:

For Mac:

brew install pulumi

For Windows:

choco install pulumi

For Linux:

curl -fsSL https://get.pulumi.com | sh

AWS Config:

For Linux & Mac:

export AWS_ACCESS_KEY_ID=<YOUR_ACCESS_KEY_ID>
export AWS_SECRET_ACCESS_KEY=<YOUR_SECRET_ACCESS_KEY>

For Windows:

$env:AWS_ACCESS_KEY_ID = "<YOUR_ACCESS_KEY_ID>"
$env:AWS_SECRET_ACCESS_KEY = "<YOUR_SECRET_ACCESS_KEY>"

Start a new project

mkdir aws-js-pulumi && cd aws-js-pulumi
pulumi new aws-javascript
NOTE: Running the Pulumi new command for the first time will require you to sign up to for the service to get your token. Moreover, for individuals this is free! See Prices here: https://www.pulumi.com/pricing/

Deploy:

pulumi up

This is the absolute minimum to get started. Please review https://www.pulumi.com/ for a more detailed guide!

CategoriesUncategorized

Vue.js with RedHat Node Image — using Express Server

FROM registry.redhat.io/ubi8/nodejs-10:latest

LABEL maintainer="Joseph Shinaberry <joseph.shinaberry@spathesystems.com>"

WORKDIR /app

COPY . /app

USER root

RUN yum install npm \
    python2 -y && \
    cd /app && \
    npm install --unsafe-perm && \
    npm run build && \
    chown -R 1001:0 /app

USER 1001

EXPOSE 8080

CMD [ "node", "server.js" ]

Add this into the package.json under dependencies.

        "connect-history-api-fallback": "^1.6.0",
        "express": "^4.15.2",

Create server.js file in project root and add the following code:

const express = require('express');
const path = require('path');
const history = require('connect-history-api-fallback');

const app = express();

const staticFileMiddleware = express.static(path.join(__dirname + '/dist'));

app.use(staticFileMiddleware);
app.use(history({
  disableDotRule: true,
  verbose: true
}));
app.use(staticFileMiddleware);

app.get('/', function (req, res) {
  res.render(path.join(__dirname + '/dist/index.html'));
});

var server = app.listen(process.env.PORT || 8080, function () {
  var port = server.address().port;
  console.log("App now running on port", port);
});
CategoriesUncategorized

Using Node.js, to serve Vue.js full breakdown

Dockerfile:

FROM node:alpine

MAINTAINER Joseph Shinaberry <joseph.shinaberry@spathesystems.com>

WORKDIR /app

# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH

# install and cache app dependencies
COPY . /app

USER root
RUN apk add --no-cache --virtual .gyp \
        python \
        make \
        g++ \
    && npm install \
        npm install @vue/cli -g \
    && apk del .gyp \
    && vue-cli-service build

RUN chown -R 1001:0 /app
USER 1001

# OPEN PORT
EXPOSE 8080

# start app
CMD [ "node", "server.js" ]

Dependencies add to package.json

        "connect-history-api-fallback": "^1.6.0",
        "express": "^4.15.2",

Server.js file

const express = require('express');
const path = require('path');
const history = require('connect-history-api-fallback');

const app = express();

const staticFileMiddleware = express.static(path.join(__dirname + '/dist'));

app.use(staticFileMiddleware);
app.use(history({
  disableDotRule: true,
  verbose: true
}));
app.use(staticFileMiddleware);

app.get('/', function (req, res) {
  res.render(path.join(__dirname + '/dist/index.html'));
});

var server = app.listen(process.env.PORT || 8080, function () {
  var port = server.address().port;
  console.log("App now running on port", port);
});

CategoriesUncategorized

Docker Helpers

Start Docker – Postgres Advanced run

docker run -d -v /home/user/Data/someplace:/var/lib/postgresql/data -e POSTGRES_USERNAME=coolusername -e POSTGRES_PASSWORD=mightypassword -e POSTGRES_DBNAME=databasename -p 55432:5432 postgres:latest

Docker running services

docker ps

Docker Run Simple example

docker run -p 8080:8080 <tag>

See Docker Images

docker images --all

Docker Build simple example

docker builder -t <tag> .

Resolve PV being full

docker-compose up --renew-anon-volumes --build db

CategoriesUncategorized

Convert Bytes to MB/KB/GB/TB

    bytesToSize(bytes) {
      const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
      const i = Number(Math.floor(Math.log(bytes) / Math.log(1024)));
      if (bytes === 0) return '0 Byte';
      return `${Math.round(bytes / (1024 ** i), 2)} ${sizes[i]}`;
    },