Skip to content

Instantly share code, notes, and snippets.

@tomkrush
Last active June 11, 2019 18:52
Show Gist options
  • Save tomkrush/005d01047d64bbf0885f356baa27ea25 to your computer and use it in GitHub Desktop.
Save tomkrush/005d01047d64bbf0885f356baa27ea25 to your computer and use it in GitHub Desktop.
Vanilla WP Install
version: '2'
services:
webserver:
container_name: wordpress_webserver
build: .
ports:
- "3000:80"
volumes:
- ./wordpress:/var/www/html/
links:
- wordpress_db
wordpress_db:
container_name: wordpress_db
image: mysql:5.7
ports:
- "33306:3306"
environment:
- MYSQL_ROOT_PASSWORD=wordpress
- MYSQL_DATABASE=wordpress
- MYSQL_USER=wordpress
- MYSQL_PASSWORD=wordpress
FROM php:7.1-apache
WORKDIR /var/www/html
ENV APP_ENV "local"
RUN apt-get update && apt-get install -y \
libmcrypt-dev \
libpng-dev \
zip \
exif \
git \
libfreetype6-dev \
libjpeg62-turbo-dev -qy \
&& docker-php-ext-install mcrypt pdo_mysql mysqli \
&& docker-php-ext-install exif
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd
RUN docker-php-ext-install opcache
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN echo 'opcache.enable=1' >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo 'opcache.revalidate_freq=0' >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo 'opcache.validate_timestamps=1' >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo 'opcache.max_accelerated_files=10000' >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo 'opcache.validate_timestamps=1' >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo 'opcache.memory_consumption=192' >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo 'opcache.max_wasted_percentage=10' >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo 'opcache.interned_strings_buffer=16' >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo 'opcache.fast_shutdown=1' >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN a2enmod rewrite
RUN a2enmod headers
RUN service apache2 restart
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
RUN chmod +x wp-cli.phar
RUN mv wp-cli.phar /usr/local/bin/wp
wget https://gist.githubusercontent.com/tomkrush/005d01047d64bbf0885f356baa27ea25/raw/a363e7c4525828aed5781b83521b876f62ee2ba9/install.sh && bash install.sh
echo "Download Additional Files"
wget https://gist.githubusercontent.com/tomkrush/005d01047d64bbf0885f356baa27ea25/raw/b692d908c57c1c7f4af7ed62bdbb89139761ee8e/docker-compose.yml
wget https://gist.githubusercontent.com/tomkrush/005d01047d64bbf0885f356baa27ea25/raw/b692d908c57c1c7f4af7ed62bdbb89139761ee8e/dockerfile
wget https://gist.githubusercontent.com/tomkrush/005d01047d64bbf0885f356baa27ea25/raw/b692d908c57c1c7f4af7ed62bdbb89139761ee8e/dockerfile
wget https://gist.githubusercontent.com/tomkrush/005d01047d64bbf0885f356baa27ea25/raw/668092a48a95f73cffb2d747c65d5fa8f5c56982/vimrc
wget https://gist.githubusercontent.com/tomkrush/005d01047d64bbf0885f356baa27ea25/raw/668092a48a95f73cffb2d747c65d5fa8f5c56982/tmux.conf
echo "Move Dot files"
mv vimrc ~/.vimrc
mv tmux.conf ~/.tmux.conf
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
echo "Install VIM Plugins"
vim +PluginInstall +qall
echo "Install Docker"
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce -y
echo ""
echo "Docker Installed"
sudo apt install docker-compose -y
sudo apt install unzip -y
echo "Install PHP"
sudo apt-get install php7.1 php-mysql php-xdebug -y
echo "Install Ack"
sudo apt-get install ack -y
echo "Install Wordpress"
wget https://wordpress.org/latest.zip
unzip latest.zip
rm latest.zip
echo "Install WP Cli"
cp wordpress/wp-config-sample.php wordpress/wp-config.php
sed wordpress/wp-config.php -i -e 's/database_name_here/wordpress/g'
sed wordpress/wp-config.php -i -e 's/username_here/wordpress/g'
sed wordpress/wp-config.php -i -e 's/password_here/wordpress/g'
sed wordpress/wp-config.php -i -e 's/localhost/wordpress_db/g'
echo "Build image"
docker-compose up -d
echo "Install WP Database "
host=$(dig +short myip.opendns.com @resolver1.opendns.com)
docker exec -it wordpress_webserver wp core install --url="${host}:3000" --title="Wordpress" --admin_user="admin" --admin_password="admin" --admin_email="example@example.com" --skip-email --allow-root --path="/var/www/html/"
docker exec -it wordpress_webserver wp plugin install https://downloads.wordpress.org/plugin/classic-editor.1.5.zip --allow-root --path="/var/www/html/"
docker exec -it wordpress_webserver wp plugin activate classic-editor --allow-root --path="/var/www/html/"
echo "Tmux Setup"
tmuxstart() {
tmux new-session -d -s $1 >/dev/null
tmux new-window -t $1
tmux new-window -t $1
tmux new-window -t $1
tmux new-window -t $1
tmux rename-window -t $1:1 'code'
tmux rename-window -t $1:2 'version-control'
tmux rename-window -t $1:3 'tests'
tmux rename-window -t $1:4 'search'
}
tmuxstart "wordpress"
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi C-\ select-pane -l
set -g default-terminal "screen-256color"
set -g status-right '#(date +%%H:%%M:%%S)'
set -g status-bg colour60
set -g status-fg colour255
set -g base-index 1
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Plugins
Plugin 'scrooloose/nerdtree'
Plugin 'VundleVim/Vundle.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'nanotech/jellybeans.vim'
Plugin 'godlygeek/tabular'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'stanangeloff/php.vim'
Plugin '2072/PHP-Indenting-for-VIm'
"Plugin 'rayburgemeestre/phpfolding.vim'
Plugin 'dikiaap/minimalist'
Plugin 'majutsushi/tagbar'
Plugin 'ludovicchabant/vim-gutentags'
Plugin 'scrooloose/nerdcommenter'
Plugin 'airblade/vim-gitgutter'
Plugin 'NLKNguyen/papercolor-theme'
Plugin 'mileszs/ack.vim'
Plugin 'vim-vdebug/vdebug'
call vundle#end()
filetype plugin indent on
if !exists('g:vdebug_options')
let g:vdebug_options = {}
endif
let g:vdebug_options.port = 9001
let g:vdebug_options.path_maps = {"/var/www/html/": "/Users/tkrush/code/wordpress/"}
let g:vdebug_options.break_on_open = 0
" Vim Tabs
nmap <leader>t :tabe<CR>
nnoremap gt :tabnext<CR>
nnoremap gT :tabprev<CR>
" Editor Settings
set encoding=utf-8
let mapleader = ','
set number
set directory=$HOME/.vim/swapfiles/
set ruler
set wildmenu
set hlsearch
set incsearch
set cursorline
set laststatus=1
let g:netrw_winsize = 20
"set winwidth=80
" netrw
let g:netrw_banner = 0
" Folding
set foldenable
set foldlevelstart=10
set foldnestmax=10
nnoremap <space> za
set foldmethod=indent
" Theme Settings
syntax on
set term=screen-256color
set background=light
"set background=dark
"colorscheme jellybeans
colorscheme PaperColor
set t_Co=256
" Control P
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](\.(git|hg|svn)|\_site|node_modules|vendor|mockery|deps)$',
\ 'file': '\v\.(exe|so|dll|class|png|jpg|jpeg)$',
\}
nmap <leader>p :CtrlP<cr>
" Easy bindings for its various modes
nmap <leader>bb :CtrlPBuffer<cr>
nmap <leader>bm :CtrlPMixed<cr>
nmap <leader>bs :CtrlPMRU<cr>
nmap <leader>rr :%s/) : /): /g<cr>
" Go Bindings
nmap <leader>gh :GoInfo<CR>
" Nerd Tree
"nmap <leader>n :Vex<cr>
map <C-n> :NERDTreeToggle<CR>
let g:NERDTreeDirArrows=0
nmap ,n :NERDTreeFind<CR>
nmap ,t :TagbarToggle<CR>
nmap ,cc :NERDComComment<CR>
" Pane Navigation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Gutentags
let g:gutentags_ctags_exclude = ['*.css', '*.html', '*.js', '*.json', '*.xml',
\ '*.phar', '*.ini', '*.rst', '*.md',
\ '*vendor/*/test*', '*vendor/*/Test*',
\ '*vendor/*/fixture*', '*vendor/*/Fixture*',
\ '*var/cache*', '*var/log*']
let g:gutentags_cache_dir = '~/.vim/gutentags'
set backspace=indent,eol,start
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment