Skip to content

Instantly share code, notes, and snippets.

View saladinjake's full-sized avatar
🏠
Working from home

Example Codes saladinjake

🏠
Working from home
View GitHub Profile
@saladinjake
saladinjake / cleanup_docker.sh
Created May 15, 2019 15:16 — forked from clcollins/cleanup_docker.sh
Cleanup and reset docker on Jenkins workers / slaves
#!/bin/bash
# This script should be located on each Jenkins slave, and the jenkins user should have permission to run it with sudo
# Attempts to cleanly stop and remove all containers, volumes and images.
docker ps -q | xargs --no-run-if-empty docker stop
docker ps -q -a | xargs --no-run-if-empty docker rm --force --volumes
docker volume ls -q | xargs --no-run-if-empty docker volume rm
docker images -a -q | xargs --no-run-if-empty docker rmi -f
# Stops the docker service, unmounts all docker-related mounts, removes the entire docker directory, and starts docker again.

Working With Docker Hub

Documentation for creating/managing repositories and images for the STINGAR organization on Docker Hub.

NOTE: This should ONLY be done this way until we get some automation.

Before you start

@saladinjake
saladinjake / chnserver_deploy.sh
Created May 15, 2019 15:16 — forked from clcollins/chnserver_deploy.sh
CHN-Server Docker Compose file
#!/bin/bash
set -o errexit
set -o nounset
main () {
local mongo_repo="https://github.com/CommunityHoneyNetwork/mongodb.git"
local mongo_commit="c95ab34ba961b4e29b9973a7eec2d0133f15be5c"
local redis_repo="https://github.com/CommunityHoneyNetwork/redis.git"
local redis_commit="b7ad930a8d7a0296fb2fadf955e2a58c3aee73e4"
@saladinjake
saladinjake / Dockerfile
Created May 15, 2019 15:17 — forked from clcollins/Dockerfile
mkdocs in a Docker container
FROM ubuntu:17.10
MAINTAINER Chris Collins <[email protected]>
ENV PKGS python python-pip nginx runit
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y $PKGS
RUN pip install mkdocs
ADD default /etc/nginx/sites-enabled/default
@saladinjake
saladinjake / docker-compose.yml
Created May 15, 2019 15:17 — forked from clcollins/docker-compose.yml
Docker Compose-based, single-server deploy of CHN Server
version: '2'
services:
mongodb:
build:
dockerfile: ./Dockerfile-centos
context: https://github.com/CommunityHoneyNetwork/mongodb.git
image: mongodb:centos
ports:
- "127.0.0.1:27017:27017"
volumes:
@saladinjake
saladinjake / throwaway_ssh_keypair.sh
Created May 15, 2019 15:17 — forked from clcollins/throwaway_ssh_keypair.sh
Generate throwaway SSH key pairs for automated ... things.
#!/bin/bash
error () {
local msg="${1}"
echo "${msg}"
exit 1
}
make_tempdir () {
@saladinjake
saladinjake / run-docker-container.sh
Created May 15, 2019 15:18 — forked from clcollins/run-docker-container.sh
Bash script to easily setup and run Docker containers to test any given project
#!/bin/bash
# Set to true to just see what command
# would be run
DRY_RUN=false
TITLE='MY-TEST-CONTAINER'
IMAGE='MY-IMAGE'
# Local volume to be mapped into the container any time you run it
# usually with config files or whatnot
@saladinjake
saladinjake / wp-upgrade.sh
Created May 15, 2019 15:18 — forked from clcollins/wp-upgrade.sh
WP-CLI Site Upgrade
#!/bin/bash
#
# TODO:
# How to handle NOT running the DB upgrade if it's not needed?
HOSTNAME="$(/bin/hostname)"
TMPDIR='/tmp'
MAILFROM="patch.adams@$HOSTNAME"
MAILTO="$@"
@saladinjake
saladinjake / docker-appstack-wordpress
Created May 15, 2019 15:19 — forked from clcollins/docker-appstack-wordpress
Docker Appstack WP Instance, via command line
#!/bin/bash
# Version 1.2 - 2015-01-07
# https://gist.github.com/clcollins/cfab1f63dc1aa927bf9f
# REQUIRES:
#
# Software -
# 1. Docker: https://docker.com
#
@saladinjake
saladinjake / more-advanced-docker
Created May 15, 2019 15:19 — forked from clcollins/more-advanced-docker
Slightly More Advanced Docker
Other Stuff to Cover
====================
(Used in conjunction with [Linux@Duke Intro To Docker](https://github.com/LinuxAtDuke/Intro-To-Docker))
* Processes Inside/Outside
* Env Vars
* Naming
* Linking
* Logging