Code AdonisJS v5 Docker (compose) templates Table of Contents * Preparations * Plain Docker template * Docker template with SQLite * Docker-compose template with Postgres * Docker-compose template with Postgres and uploads * Host networking?! Collection of Docker and docker-compose templates Preparations Whenever you want to run AdonisJS in container it’s good to add SIGINT listener. Otherwise CTRL
Code Adonis V5 (MongoDB) provider Table of Contents * Overview * Create Adonis project * Let’s start using Mongoose! * Using Mongoose directly like any other package * Enter the Provider! * How to turn it into external sharable provider Story time! You want to use MongoDB with AdonisJS, but no idea how to do it? U’ve come exactly
Code Bashing Table of Contents * Back to basics * Chaining flags * Piping | * IO and redirecting * Useful tricks * BANG BANG!! * Bash native command “bookmarking” * Run the last certain command * Replace command but keep the arguments * Extra content * Show current git branch near current location * Saving to read-only file in vim (save with sudo)
Code Best and pest practices Table of Contents * Code maintainability * What is maintainable code * How to write maintainable code * KISS, YAGNI, DRY etc * KISS - keep it simple stupid * YAGNI - you aren’t going to need it * DRY - Don’t repeat yourself * WET - Write everything twice * Easily readable code and cognitive overhead * Pest practises to avoid
Code Dockerizing AdonisJS v5 (outdated) This guide is outdated, refer to » up-to-date guide « Tried putting AdonisJS v5 preview build into container. It is doable but requires some workarounds to work fine. Whole source code: https://gitlab.com/McSneaky/youtube-downloader Dockerfile # Build AdonisJS FROM node:14-alpine as builder # Workaround for now, since
Code JWT This post will be about JWTs for web development, not about mobile apps, programs or embedded devices What is JWT JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties. The claims in a JWT are encoded as a JSON object
Code Useful Commands Since I keep forgetting some good commands, which I have to re-search all the timem, I'll write them down in here This post will be updated from time to time, so everything is in one place Git Change remote URL Good when remote has moved, renamed or
Code Developing 101 Git usage Use Git! (or any other version control system) Git gud and commit Using Git and learning basics with it how to use it will save you a lot of time. At the beginning it might slow you down, but it will pay back greatly in future The more
Code Automate Docker deployment with Gitlab Going to deploy single Docker container to remote server. Good for all sorts of small projects and pages, like this blog :) .gitlab-ci.yml Create .gitlab-ci.yml file in project root # Setup 2 steps: # dockerize Build container # deploy Deploy to remote server stages: - dockerize - deploy dockerize: stage: dockerize image:
Code Static files in Dockerized Nginx Dockerfile and Nginx config to setup really basic statics file hosting container. This setup will let host do all the HTTPS, GZIP, cache etc magic. This is just nice starting point # Use nginx:alpine as base image FROM nginx:alpine # Copy static files into Nginx webroot COPY ./public /usr/share/