Pelican Blog Quickstart with Docker

Prerequisites We need to have at least Docker installed. Creating the Blog First we’re creating a new directory for our blog and generate the blog structure using William Jackon’s docker-pelican: mkdir my-site cd my-site docker container run -it --rm --entrypoint pelican-quickstart -v ${PWD}:/pelican-site ghcr.io/williamjacksn/pelican Welcome to pelican-quickstart v4.9.1. This script will help you create a new Pelican-based website. Please answer the following questions so this script can generate the files 1 Title: My First Review needed by Pelican. > Where do you want to create your new web site? [.] > What will be the title of this web site? Micha's Tech Notes > Who will be the author of this web site? Micha Kops > What will be the default language of this web site? [C] > Do you want to specify a URL prefix? e.g., https://example.com (Y/n) Y > What is your URL prefix? (see above example; no trailing slash) https > Do you want to enable article pagination? (Y/n) n > What is your time zone? [Europe/Rome] > Do you want to generate a tasks.py/Makefile to automate generation and publishing? (Y/n) > Do you want to upload your website using FTP? (y/N) > Do you want to upload your website using SSH? (y/N) > Do you want to upload your website using Dropbox? (y/N) > Do you want to upload your website using S3? (y/N) > Do you want to upload your website using Rackspace Cloud Files? (y/N) > Do you want to upload your website using GitHub Pages? (y/N) Done. Your new project is available at /pelican-site ...

September 10, 2024 · 3 min · 529 words · Micha Kops

Postgres with docker-compose or Docker and pg_stat_statements enabled

pg_stat_statements is useful to gather performance information about queries so lets add it to our dockerized postgres database. Using docker-compose Using docker-compose we just need to add the following docker-compose.yaml: docker-compose.yml version: '3.5' services: postgres: container_name: postgres_container image: postgres ports: - "5432:5432" volumes: - /var/lib/postgresql/data # used for query profiling, deactivate for enhanced performance command: postgres -c shared_preload_libraries=pg_stat_statements -c pg_stat_statements.track=all -c max_connections=200 environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: thepassword We simply start our Postgres database with docker-compose: ...

March 29, 2023 · 1 min · 212 words · Micha Kops

Fast Link Checks using Filiph Linkchecker and Docker

This Linkchecker claims to be way faster than blc and wummel/linkchecker. Using Docker, we may validate our site’s links in no time and without complex setup. docker run --rm tennox/linkcheck hascode.io Resources https://github.com/filiph/linkcheck

May 2, 2022 · 1 min · 33 words · Micha Kops

Quick Apache NiFi Setup with Docker

Steps Pull image and run with ports exposed: docker run --name "nifi" -p 8443:8443 -d apache/nifi:latest Fetch the generated username and password from the logs: docker logs nifi | grep -A1 "Generated Username" Generated Username [8f6d91f7-733e-40cf-b900-059ea9dccbf2] Generated Password [v7KGiiRYLJL2+HzhKOqz1rbgiPOaWz0B] Now we may enter the https://localhost:8443/nifi/login in our browser, accept the security exemption and login with the credentials from above, voila! Installing additional connectors I have found a nice summary on the following GitHub repository: ...

February 8, 2022 · 1 min · 200 words · Micha Kops

Setting up multiple Postgresql Instances with docker-compose

A simple setup when two Postgres databases prefilled with schema/data needed. docker-compose.yml version: '3.6' services: postgres1: image: postgres restart: always environment: - DATABASE_HOST=127.0.0.1 - POSTGRES_USER=root - POSTGRES_PASSWORD=root - POSTGRES_DB=root ports: - "15432:15432" volumes: - ./postgres1-init.sql:/docker-entrypoint-initdb.d/docker_postgres_init.sql postgres2: image: postgres restart: always environment: - DATABASE_HOST=127.0.0.1 - POSTGRES_USER=root - POSTGRES_PASSWORD=root - POSTGRES_DB=root ports: - "25432:25432" volumes: - ./postgres2-init.sql:/docker-entrypoint-initdb.d/docker_postgres_init.sql And our sample init scripts: CREATE USER tester WITH PASSWORD 'tester' CREATEDB; CREATE DATABASE testdb WITH OWNER = tester ENCODING = 'UTF8' LC_COLLATE = 'en_US.utf8' LC_CTYPE = 'en_US.utf8' TABLESPACE = pg_default CONNECTION LIMIT = -1; ...

February 8, 2022 · 1 min · 90 words · Micha Kops

Kafka Java Quickstart with Docker

Goals Setup Kafka and Zookeeper with Docker and docker-compose Create a message consumer and producer in Java Kafka Setup We’re using docker-compose to set up our message broker, zookeper and other stuff using confluent-platform. This is our docker-compose.yaml config file from Confluent’s following GitHub repository. docker-compose.yaml --- version: '2' services: zookeeper: image: confluentinc/cp-zookeeper:7.0.1 hostname: zookeeper container_name: zookeeper ports: - "2181:2181" environment: ZOOKEEPER_CLIENT_PORT: 2181 ZOOKEEPER_TICK_TIME: 2000 broker: image: confluentinc/cp-kafka:7.0.1 hostname: broker container_name: broker depends_on: - zookeeper ports: - "29092:29092" - "9092:9092" - "9101:9101" environment: KAFKA_BROKER_ID: 1 KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181' KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092 KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 KAFKA_JMX_PORT: 9101 KAFKA_JMX_HOSTNAME: localhost schema-registry: image: confluentinc/cp-schema-registry:7.0.1 hostname: schema-registry container_name: schema-registry depends_on: - broker ports: - "8081:8081" environment: SCHEMA_REGISTRY_HOST_NAME: schema-registry SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'broker:29092' SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081 connect: image: cnfldemos/kafka-connect-datagen:0.5.0-6.2.0 hostname: connect container_name: connect depends_on: - broker - schema-registry ports: - "8083:8083" environment: CONNECT_BOOTSTRAP_SERVERS: 'broker:29092' CONNECT_REST_ADVERTISED_HOST_NAME: connect CONNECT_GROUP_ID: compose-connect-group CONNECT_CONFIG_STORAGE_TOPIC: docker-connect-configs CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: 1 CONNECT_OFFSET_FLUSH_INTERVAL_MS: 10000 CONNECT_OFFSET_STORAGE_TOPIC: docker-connect-offsets CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: 1 CONNECT_STATUS_STORAGE_TOPIC: docker-connect-status CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: 1 CONNECT_KEY_CONVERTER: org.apache.kafka.connect.storage.StringConverter CONNECT_VALUE_CONVERTER: io.confluent.connect.avro.AvroConverter CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: http://schema-registry:8081 CONNECT_PLUGIN_PATH: "/usr/share/java,/usr/share/confluent-hub-components" CONNECT_LOG4J_LOGGERS: org.apache.zookeeper=ERROR,org.I0Itec.zkclient=ERROR,org.reflections=ERROR ksqldb-server: image: confluentinc/cp-ksqldb-server:7.0.1 hostname: ksqldb-server container_name: ksqldb-server depends_on: - broker - connect ports: - "8088:8088" environment: KSQL_CONFIG_DIR: "/etc/ksql" KSQL_BOOTSTRAP_SERVERS: "broker:29092" KSQL_HOST_NAME: ksqldb-server KSQL_LISTENERS: "http://0.0.0.0:8088" KSQL_CACHE_MAX_BYTES_BUFFERING: 0 KSQL_KSQL_SCHEMA_REGISTRY_URL: "http://schema-registry:8081" KSQL_PRODUCER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor" KSQL_CONSUMER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringConsumerInterceptor" KSQL_KSQL_CONNECT_URL: "http://connect:8083" KSQL_KSQL_LOGGING_PROCESSING_TOPIC_REPLICATION_FACTOR: 1 KSQL_KSQL_LOGGING_PROCESSING_TOPIC_AUTO_CREATE: 'true' KSQL_KSQL_LOGGING_PROCESSING_STREAM_AUTO_CREATE: 'true' ksqldb-cli: image: confluentinc/cp-ksqldb-cli:7.0.1 container_name: ksqldb-cli depends_on: - broker - connect - ksqldb-server entrypoint: /bin/sh tty: true ksql-datagen: image: confluentinc/ksqldb-examples:7.0.1 hostname: ksql-datagen container_name: ksql-datagen depends_on: - ksqldb-server - broker - schema-registry - connect command: "bash -c 'echo Waiting for Kafka to be ready... && \ cub kafka-ready -b broker:29092 1 40 && \ echo Waiting for Confluent Schema Registry to be ready... && \ cub sr-ready schema-registry 8081 40 && \ echo Waiting a few seconds for topic creation to finish... && \ sleep 11 && \ tail -f /dev/null'" environment: KSQL_CONFIG_DIR: "/etc/ksql" STREAMS_BOOTSTRAP_SERVERS: broker:29092 STREAMS_SCHEMA_REGISTRY_HOST: schema-registry STREAMS_SCHEMA_REGISTRY_PORT: 8081 rest-proxy: image: confluentinc/cp-kafka-rest:7.0.1 depends_on: - broker - schema-registry ports: - 8082:8082 hostname: rest-proxy container_name: rest-proxy environment: KAFKA_REST_HOST_NAME: rest-proxy KAFKA_REST_BOOTSTRAP_SERVERS: 'broker:29092' KAFKA_REST_LISTENERS: "http://0.0.0.0:8082" KAFKA_REST_SCHEMA_REGISTRY_URL: 'http://schema-registry:8081' ...

January 29, 2022 · 8 min · 1500 words · Micha Kops

Install Docker on Linux

Goals Installing a specific Docker version on (Debian-based) Linux Freeze the version to avoid automatic updates Installation curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - (1) sudo add-apt-repository \ (2) "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" sudo apt-get update (3) sudo apt-get install -y docker-ce=18.06.1~ce~3-0~ubuntu (4) sudo apt-mark hold docker-ce (5) 1 Add the Docker GPG key 2 Add the Docker repository 3 Update the index 4 Install docker 5 Freeze the version to avoid unwanted automatic updates ...

May 14, 2021 · 1 min · 86 words · Micha Kops

MySQL and phpMyAdmin Setup with Docker-Compose

Goals Setup mySQL with phpMyAdmin connected using docker-compose Prerequisites docker-compose installed Setup This is our docker-compose.yml: version: '3.2' services: db: image: mysql:8.0 container_name: mysql-container restart: always ports: - '6603:3306' environment: MYSQL_ROOT_PASSWORD: 12345678 app: depends_on: - db image: phpmyadmin/phpmyadmin container_name: phpmyadmin restart: always ports: - '8080:80' environment: PMA_HOST: db Running docker-compose up Starting mysql-container ... done Starting phpmyadmin ... done Attaching to mysql-container, phpmyadmin [..] We may no login using the following ultra-secure credentials ;) User: root, Password: 12345678 ...

May 14, 2021 · 1 min · 78 words · Micha Kops

WordPress Docker Setup

Goals Run WordPress via Docker / Docker-Compose Increase the Upload Filesize Limit Create Docker Compose Configuration Create a docker-compose.yml: version: '3.1' services: wordpress: image: wordpress restart: always ports: - 8080:80 environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: exampleuser WORDPRESS_DB_PASSWORD: examplepass WORDPRESS_DB_NAME: exampledb volumes: - wordpress:/var/www/html db: image: mysql:5.7 restart: always environment: MYSQL_DATABASE: exampledb MYSQL_USER: exampleuser MYSQL_PASSWORD: examplepass MYSQL_RANDOM_ROOT_PASSWORD: '1' volumes: - db:/var/lib/mysql volumes: wordpress: db: Run Docker Compose / Start Containers docker-compose up WARNING: Found orphan containers (wordpress-docker_phpmyadmin_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. Starting wordpress-docker_db_1 ... done Starting wordpress-docker_wordpress_1 ... done Attaching to wordpress-docker_db_1, wordpress-docker_wordpress_1 [..] db_1 | 2021-04-03T18:58:17.247963Z 0 [Note] mysqld: ready for connections. db_1 | Version: '5.7.33' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) ...

May 14, 2021 · 1 min · 204 words · Micha Kops

Annotation based Kubernetes and Openshift Manifests for Java Applications with ap4k

Writing our manifest files for Kubernetes / Openshift often forces us to edit xml, json and yml files by hand. A new library, ap4k allows to specify metadata for these manifest files directly in our Java code using annotations. In the following short example I am going to demonstrate how to generate manifest files using Maven and ap4k. Figure 1. ap4k Tutorial Dependencies Using Maven we just need to add the following one dependency to our project’s pom.xml ...

February 28, 2019 · 5 min · 898 words · Micha Kops