AWS ECS - I'm Giving Up

The last fews day's I've been learning how to deploy a Flask and React application to AWS. I've decided to shelf that project for now. As a hobby developer and learner I don't need all the features that AWS offers. A setup with Load Balancer, RDS instances, etc. adds a lot of complexity which I have no use for. The plan for this month was to create a test-driven Python and React application.
Read more →

Learning Progress: Still Learning About Amazon ECR

Read more →

Learning Progress TIL: About Container Orchestration

Read more →

Run Docker nginx as Non-Root-User

How to run nginx as non-privileged user with Docker nginx is an open-source solution for web serving and reverse proxying your web application. You put it “in front” of your different services, and nginx can route the traffic to the correct url. That's useful for micro-services, for example. Per default, nginx runs as root user. Why? Only root processes can listen to ports below 1024. The default port for web applications is usually 80 or 443.
Read more →

TIL: Bind Mounts

Read more →

Learning About Nodejs Graphql Microservices

I'm currently working on a few micro-services with Docker. The architecture looks promising to me, and I like to play with Docker containers. Lately I've been watching a few videos about Node.js/GraphQL Microservices by Better Coding Academy. The tutorial series assumes a lot of knowledge (JavaScript, Express, GraphQL, Docker). I would have liked more detailed explanations. But the videos are still useful for showing the architecture of an Express/GraphQL setup with micro-services.
Read more →

Setup a Postgres Database With Docker Compose

Adding a Postgres database to an existing service is fairly straightforward with docker-compose. Create a Dockerfile for your main service. For example, here's a simple Docker container with Node: FROMnode:12.14.0-alpine3.9ENV NPM_CONFIG_PREFIX=/home/node/.npm-globalRUN npm install npm@latest -g –silentWORKDIR/opt/appCOPY package*.json /opt/app/RUN npm install –no-optional && npm cache clean –forceENV PATH /opt/app/node_modules/.bin:$PATHENV PATH=$PATH:/home/node/.npm-global/binARG NODE_ENV=production ENV NODE_ENV $NODE_ENVARG PORT=3000 ENV PORT $PORTEXPOSE$PORT 8229 8230COPY . .CMD ["npm", "run", "watch"]The Dockerfile starts from the official Node container, updates npm globally, installs the necessary packages, and runs an npm command (as root user in development mode).
Read more →

2019 Week 50: A Look Back

Read more →

Friday Picks 029

Read more →

Example Multi Stage Docker Build for React

I'm still trying to improve my Docker builds. Here's an example for a multi-stage Docker build for React:

base imageFROMnode:12.13.1-alpine as compile-image# install global packagesENV NPM_CONFIG_PREFIX=/home/node/.npm-globalRUN npm install npm@latest -gRUN npm install pnpm react-scripts@3.3.0 -g# set working directory & give permissions to user nodeRUN mkdir -p /usr/src/app && chown node:node /usr/src/appWORKDIR/usr/src/app# switch to non-root user & install dependenciesUSERnodeCOPY package*.json /usr/src/app/COPY pnpm-lock.yaml /usr/src/app/pnpm-lock.yamlENV PATH /usr/src/app/node_modules/.bin:$PATHENV PATH=$PATH:/home/node/.npm-global/binRUN pnpm install# set environment to production, overwrite# with docker-composeARG NODE_ENV=production ENV NODE_ENV $NODE_ENV# create buildCOPY .

Read more →