Skip to content

Instantly share code, notes, and snippets.

@gblok
gblok / Instructions.md
Created January 13, 2019 11:09 — forked from pgilad/Instructions.md
Generate SSL Certificate for use with Webpack Dev Server (OSX)

Generate private key

$ openssl genrsa -out private.key 4096

Generate a Certificate Signing Request

openssl req -new -sha256 \
@gblok
gblok / nginx-and-certbot-config.md
Last active January 15, 2019 07:48 — forked from rkaramandi/nginx-and-certbot-config.md
Running NGINX and CertBot Containers on the Same Host

Running NGINX and CertBot Containers on the Same Host

The Problem

A lot of people run into the problem of running Let's Encrypt's CertBot Tool and an NGINX on the same container host. A big part of this has to do with CertBot needing either port 80 or 443 open for the tool to work as intended. This tends to conflict with NGINX as most people usually use port 80 (HTTP) or 443 (HTTPS) for their reverse proxy. Section 1 outlines how to configure NGINX to get this to work, and Section 2 is the Docker command to run CertBot.

1. NGINX Configuration

I use Docker Compose (docker-compose) for my NGINX server. My docker-compose.yml file looks something like this:

@gblok
gblok / DNS prefetching
Created January 19, 2019 18:23
Common Prefetch Links
<!-- Amazon S3 -->
<link rel="dns-prefetch" href="//s3.amazonaws.com">
<!-- Google CDN -->
<link rel="dns-prefetch" href="//ajax.googleapis.com">
<!-- Microsoft CDN -->
<link rel="dns-prefetch" href="//ajax.microsoft.com">
<link rel="dns-prefetch" href="//ajax.aspnetcdn.com">
@gblok
gblok / nginx.conf
Created January 19, 2019 20:32 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@gblok
gblok / gist:ec48dcdea14d1d0f27e843efa80d90fe
Created January 23, 2019 04:59 — forked from dexalex84/gist:132a4833fae76a202544ddace912ddb2
Creating postgresql container via docker-compose
create folder
1)
mkdir docker-compose-pg
cd docker-compose-pg
2)
vi docker-compose.yml
insert this text:
"
@gblok
gblok / restore
Created January 23, 2019 05:00 — forked from jrgifford/restore
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
@gblok
gblok / .gitlab.ci.yml
Created February 10, 2019 19:01 — forked from yannhowe/.gitlab.ci.yml
.gitlab.ci.yml for SSH with private key.
# Image neeeds to have ssh-client
image: docker:git
services:
- docker:dind
stages:
- staging
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
@gblok
gblok / vagrantfile
Created February 28, 2019 11:32 — forked from paruljain/vagrantfile
Vagrantfile for Alpine Linux with docker
Vagrant.configure("2") do |config|
config.vm.box = "maier/alpine-3.3.1-x86_64"
config.vm.network "public_network", ip: "192.168.1.31", auto_config: true
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider "virtualbox" do |vb|
vb.name = 'Alpine1'
vb.cpus = 1
vb.memory = 1024
#vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
# Display the VirtualBox GUI when booting the machine
@gblok
gblok / fix.sh
Last active March 9, 2019 13:10 — forked from TheBeachMaster/fix.sh
Fix Docker WARNING: bridge-nf-call-iptables is disabled on Centos
sudo sysctl net.ipv4.conf.all.forwarding=1
sudo sysctl net.bridge.bridge-nf-call-iptables=1
sudo sysctl net.bridge.bridge-nf-call-ip6tables=1
//or
/sbin/sysctl -w net.ipv4.conf.all.forwarding=1
/sbin/sysctl -w net.bridge.bridge-nf-call-ip6tables=1
/sbin/sysctl -w net.bridge.bridge-nf-call-iptables=1
git config --global core.autocrlf false
git config core.eol lf
git config core.autocrlf input