Skip to content

Instantly share code, notes, and snippets.

@kerasai
kerasai / dccleanup.sh
Created January 27, 2020 15:45
Docker Container Clean-Up
# TODO: document these.
docker rm -v $(docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null
docker rmi $(docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null
@kerasai
kerasai / pantheon_backup.bash
Created October 17, 2019 17:41
Pantheon Backup
#!/bin/bash
terminus backup:create site.env --element db &>/dev/null &
disown
@kerasai
kerasai / docker_prune.sh
Last active June 19, 2020 14:39
Docker prune
#!/bin/bash
docker system prune -f
docker image prune -f
docker volume prune -f
@kerasai
kerasai / gitlab_docker_image_create.md
Last active September 3, 2019 18:37
Create a docker image

The "magical" whale.

Creating Docker images for GitLab CI

  1. Remove existing image, if needed. See "Misc commands" for details.
  2. Build the new image docker build -t app .

To run a local image

  1. Find the image ID docker images
  2. docker run -t -d --name my_app
certbot certonly --manual --preferred-challenges dns -d '*.domain.com' -d domain.com
# Will have to add 2 DNS records in separate steps.
# Verify records are there.
nslookup -q=txt _acme-challenge.domain.com
dig -t txt _acme-challenge.domain.com +short
# Place files, if needed.
# Restart webserver.
@kerasai
kerasai / renew.sh
Created May 30, 2019 14:30
Let's Encrypt Renewal
certbot certonly --manual --preferred-challenges dns --manual-public-ip-logging-ok -d '*.domain.com' -d domain.com
# update TXT records for authentication
sudo service apache2 reload
@kerasai
kerasai / renew.sh
Created May 30, 2019 14:30
Let's Encrypt Renewal
certbot certonly --manual --preferred-challenges dns --manual-public-ip-logging-ok -d '*.domain.com' -d domain.com
# update TXT records for authentication
sudo service apache2 reload
@kerasai
kerasai / Pantheon RSYNC
Last active May 12, 2021 15:40
Pantheon RSYNC command to pull files, excluding the nonsense.
# https://pantheon.io/docs/rsync-and-sftp/
# $ENV is dev/test/live or multidev
# $SITE is UUID
# Ran from the 'sites/default' directory (or applicable site directory).
rsync -rvlz \
--copy-unsafe-links \
--size-only \
--ipv4 \
@kerasai
kerasai / box.sh
Created February 21, 2019 23:51
Box PHAR Compilation
#!/usr/bin/bash
sudo mkdir -p /opt/box
cd /opt/box
sudo curl -OL https://github.com/humbug/box/releases/download/3.4.0/box.phar
sudo chmod +x box.phar
sudo mv box.phar box-3.4.0.phar
sudo update-alternatives --install /usr/bin/box box /opt/box/box-3.4.0.phar 10
@kerasai
kerasai / bootstrap_node.sh
Last active September 5, 2019 17:28
Install Node
#!/usr/bin/env bash
# USE NVM instead https://github.com/nvm-sh/nvm.
set -e
cd /tmp
curl -O https://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.xz
tar xf node-v10.15.1-linux-x64.tar.xz