Helper setup to edit .yaml files with Vim:
List of general purpose commands for Kubernetes management:
Helper setup to edit .yaml files with Vim:
List of general purpose commands for Kubernetes management:
| #!/bin/bash | |
| set -euo pipefail | |
| openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req -keyout privkey.pem | |
| openssl rsa -in privkey.pem -passin pass:abcd -out server.key | |
| openssl req -x509 -in server.req -text -key server.key -out server.crt | |
| chmod 600 server.key | |
| test $(uname -s) = Linux && chown 70 server.key | |
| docker run -d --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust -v "$(pwd)/server.crt:/var/lib/postgresql/server.crt:ro" -v "$(pwd)/server.key:/var/lib/postgresql/server.key:ro" postgres:12-alpine -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key |
| from IPython.core.magic import Magics, magics_class, line_magic | |
| import asyncio | |
| from concurrent.futures import Future | |
| # Credits goes to https://gist.github.com/chrisseto/8f7289497f40ad442a30#gistcomment-1701177 | |
| @magics_class | |
| class AsyncMagics(Magics): | |
| @line_magic | |
| def await(self, line): |
| bind: 0.0.0.0:8000 | |
| workers: 1 | |
| worker_class: "example.worker:CustomWorker" | |
| timeout: 30 | |
| ca_certs: ca.crt | |
| certfile: server.crt | |
| keyfile: server.key | |
| cert_reqs: 2 | |
| do_handshake_on_connect: true |
| image: docker.mydomain.com/build/kube-go-make | |
| variables: | |
| DOCKER_TAG: docker.mydomain.com/myapp/home:$CI_COMMIT_REF_SLUG | |
| DOCKER_HOST: tcp://localhost:2375 | |
| DOCKER_DRIVER: overlay | |
| PROD_RSYNC_HOST: myprodserver.com | |
| DOMAIN: mydomain.com | |
| CHART_DIR: chart |
| #!/usr/bin/env python | |
| import argparse | |
| import redis | |
| def connect_redis(conn_dict): | |
| conn = redis.StrictRedis(host=conn_dict['host'], | |
| port=conn_dict['port'], | |
| db=conn_dict['db']) | |
| return conn |