This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#write out current crontab | |
crontab -l > /tmp/mycron | |
cat << EOF >> /tmp/mycron | |
# please pay atention, 168h is 7 days, which mean is it only keep the images created in 14 days, other will be removed. | |
0 0 * * * docker image prune -a --filter "until=$(date +'%Y-%m-%dT%H:%M:%S' --date='-14 days')" | |
5 0 * * * docker container prune -f | |
10 0 * * * docker volume prune -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
docker run --rm mysql:5.7 mysqldump \ | |
-uUSERNAME \ | |
-hmysq.example.com \ | |
-pPASSWORD database_name | gzip > /path/to/your/backup/folder/backup_$(date +"%Y%m%d_%H%M%S").sql.gz | |
# only keep 5 backups | |
ls -1tr | head -n -5 | xargs -d '\n' rm -f -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
cat << EOF | sudo tee /etc/systemd/system/docker.service.d/aws-credentials.conf | |
[Service] | |
Environment="AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" | |
Environment="AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" | |
EOF | |
sudo systemctl daemon-reload | |
sudo systemctl start docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
reverse-proxy: | |
image: traefik:v2.2 | |
restart: always | |
command: | |
# - "--log.level=DEBUG" | |
- "--api.insecure=true" | |
- "--providers.docker=true" | |
- "--providers.docker.exposedbydefault=false" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
sudo yum install -y yum-utils \ | |
device-mapper-persistent-data \ | |
lvm2 | |
sudo yum-config-manager \ | |
--add-repo \ | |
https://download.docker.com/linux/centos/docker-ce.repo | |
sudo yum makecache fast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
sudo hostname $NEW_HOSTNAME | |
hostname | sudo tee /etc/hostname | |
sudo sed -i -e "s/ $(hostname)//g" -e "/127.0.0.1/s/\$/ $(hostname)/" /etc/hosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env | |
sudo dd if=/dev/zero of=/swapfile bs=4096 count=1024k && \ | |
sudo chmod 600 /swapfile && \ | |
sudo mkswap /swapfile && \ | |
sudo swapon /swapfile && \ | |
sudo cp /etc/fstab{,.bak} && \ | |
sudo echo "/swapfile swap swap sw 0 0" | \ | |
sudo tee -a /etc/fstab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat <<EOF > ~/.emacs | |
(custom-set-variables | |
'(auto-save-default nil) | |
'(create-lockfiles nil) | |
'(make-backup-files nil)) | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install stuff # | |
################# | |
# Install development tools and some misc. necessary packages | |
yum -y groupinstall "Development tools" | |
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel mysql-devel libxml2-devel libxslt-devel unixODBC-devel sqlite sqlite-devel -y | |
# Alias shasum to == sha1sum (will prevent some people's scripts from breaking) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM phusion/passenger-full | |
# Set correct environment variables. | |
ENV HOME /root | |
# Use baseimage-docker's init process. | |
CMD ["/sbin/my_init"] | |
EXPOSE 80 |
NewerOlder