initial commit
This commit is contained in:
commit
8af910aba5
18
.devcontainer/dc.dev.yml
Normal file
18
.devcontainer/dc.dev.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
cookbook:
|
||||||
|
build: ./devimage
|
||||||
|
working_dir: /cookbook
|
||||||
|
tty: true
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
- ./..:/cookbook:cached
|
||||||
|
- ~/.ssh:/root/.ssh:ro
|
||||||
|
postgres:
|
||||||
|
build: ../postgres
|
||||||
|
image: postgres-wal2json
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=cookbook
|
||||||
|
- POSTGRES_PASSWORD=cookbook
|
||||||
|
- POSTGRES_DB=cookbook
|
||||||
16
.devcontainer/devcontainer.json
Normal file
16
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "cookbook",
|
||||||
|
"dockerComposeFile": "./dc.dev.yml",
|
||||||
|
"service": "cookbook",
|
||||||
|
"workspaceFolder": "/cookbook",
|
||||||
|
"containerUser": "node",
|
||||||
|
"remoteUser": "node",
|
||||||
|
"extensions": [
|
||||||
|
"cweijan.vscode-mysql-client2",
|
||||||
|
"mutantdino.resourcemonitor",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
"streetsidesoftware.code-spell-checker",
|
||||||
|
"eamodio.gitlens",
|
||||||
|
],
|
||||||
|
}
|
||||||
17
.devcontainer/devimage/.bashrc
Normal file
17
.devcontainer/devimage/.bashrc
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
export GITAWAREPROMPT=~/.bash/git-aware-prompt
|
||||||
|
source "/opt/git-prompt/prompt.sh"
|
||||||
|
PS1='\A \[$txtcyn\]$git_branch\[$bldred\]$git_dirty\[$bldwht\] $? \w>\[$txtrst\] '
|
||||||
|
# \u@\h
|
||||||
|
|
||||||
|
source /etc/profile.d/bash_completion.sh
|
||||||
|
|
||||||
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias fgrep='fgrep --color=auto'
|
||||||
|
alias egrep='egrep --color=auto'
|
||||||
|
|
||||||
|
alias ll='ls -l'
|
||||||
|
alias la='ls -A'
|
||||||
|
alias l='ls -CF'
|
||||||
422
.devcontainer/devimage/.vimrc
Normal file
422
.devcontainer/devimage/.vimrc
Normal file
@ -0,0 +1,422 @@
|
|||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Maintainer:
|
||||||
|
" Amir Salihefendic
|
||||||
|
" http://amix.dk - amix@amix.dk
|
||||||
|
"
|
||||||
|
" Version:
|
||||||
|
" 5.0 - 29/05/12 15:43:36
|
||||||
|
"
|
||||||
|
" Blog_post:
|
||||||
|
" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github
|
||||||
|
"
|
||||||
|
" Awesome_version:
|
||||||
|
" Get this config, nice color schemes and lots of plugins!
|
||||||
|
"
|
||||||
|
" Install the awesome version from:
|
||||||
|
"
|
||||||
|
" https://github.com/amix/vimrc
|
||||||
|
"
|
||||||
|
" Syntax_highlighted:
|
||||||
|
" http://amix.dk/vim/vimrc.html
|
||||||
|
"
|
||||||
|
" Raw_version:
|
||||||
|
" http://amix.dk/vim/vimrc.txt
|
||||||
|
"
|
||||||
|
" Sections:
|
||||||
|
" -> General
|
||||||
|
" -> VIM user interface
|
||||||
|
" -> Colors and Fonts
|
||||||
|
" -> Files and backups
|
||||||
|
" -> Text, tab and indent related
|
||||||
|
" -> Visual mode related
|
||||||
|
" -> Moving around, tabs and buffers
|
||||||
|
" -> Status line
|
||||||
|
" -> Editing mappings
|
||||||
|
" -> vimgrep searching and cope displaying
|
||||||
|
" -> Spell checking
|
||||||
|
" -> Misc
|
||||||
|
" -> Helper functions
|
||||||
|
"
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
set nocompatible " be iMproved, required
|
||||||
|
filetype off " required
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" => General
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Sets how many lines of history VIM has to remember
|
||||||
|
set history=500
|
||||||
|
|
||||||
|
" Enable filetype plugins
|
||||||
|
filetype plugin on
|
||||||
|
filetype indent on
|
||||||
|
|
||||||
|
" Set to auto read when a file is changed from the outside
|
||||||
|
set autoread
|
||||||
|
|
||||||
|
" With a map leader it's possible to do extra key combinations
|
||||||
|
" like <leader>w saves the current file
|
||||||
|
let mapleader = ","
|
||||||
|
let g:mapleader = ","
|
||||||
|
|
||||||
|
" Fast saving
|
||||||
|
nmap <leader>w :w!<cr>
|
||||||
|
|
||||||
|
" :W sudo saves the file
|
||||||
|
" (useful for handling the permission-denied error)
|
||||||
|
command W w !sudo tee % > /dev/null
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" => VIM user interface
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Set 7 lines to the cursor - when moving vertically using j/k
|
||||||
|
set so=7
|
||||||
|
|
||||||
|
" Avoid garbled characters in Chinese language windows OS
|
||||||
|
let $LANG='en'
|
||||||
|
set langmenu=en
|
||||||
|
source $VIMRUNTIME/delmenu.vim
|
||||||
|
source $VIMRUNTIME/menu.vim
|
||||||
|
|
||||||
|
" Turn on the WiLd menu
|
||||||
|
set wildmenu
|
||||||
|
|
||||||
|
" Ignore compiled files
|
||||||
|
set wildignore=*.o,*~,*.pyc
|
||||||
|
if has("win16") || has("win32")
|
||||||
|
set wildignore+=.git\*,.hg\*,.svn\*
|
||||||
|
else
|
||||||
|
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
|
||||||
|
endif
|
||||||
|
|
||||||
|
"Always show current position
|
||||||
|
set ruler
|
||||||
|
|
||||||
|
" Height of the command bar
|
||||||
|
set cmdheight=2
|
||||||
|
|
||||||
|
" A buffer becomes hidden when it is abandoned
|
||||||
|
set hid
|
||||||
|
|
||||||
|
" Configure backspace so it acts as it should act
|
||||||
|
set backspace=eol,start,indent
|
||||||
|
set whichwrap+=<,>,h,l
|
||||||
|
|
||||||
|
" Ignore case when searching
|
||||||
|
set ignorecase
|
||||||
|
|
||||||
|
" When searching try to be smart about cases
|
||||||
|
set smartcase
|
||||||
|
|
||||||
|
" Highlight search results
|
||||||
|
set hlsearch
|
||||||
|
|
||||||
|
" Makes search act like search in modern browsers
|
||||||
|
set incsearch
|
||||||
|
|
||||||
|
" Don't redraw while executing macros (good performance config)
|
||||||
|
set lazyredraw
|
||||||
|
|
||||||
|
" For regular expressions turn magic on
|
||||||
|
set magic
|
||||||
|
|
||||||
|
" Show matching brackets when text indicator is over them
|
||||||
|
set showmatch
|
||||||
|
" How many tenths of a second to blink when matching brackets
|
||||||
|
set mat=2
|
||||||
|
|
||||||
|
" No annoying sound on errors
|
||||||
|
set noerrorbells
|
||||||
|
set novisualbell
|
||||||
|
set t_vb=
|
||||||
|
set tm=500
|
||||||
|
|
||||||
|
" Add a bit extra margin to the left
|
||||||
|
set foldcolumn=1
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" => Colors and Fonts
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Enable syntax highlighting
|
||||||
|
syntax enable
|
||||||
|
|
||||||
|
try
|
||||||
|
colorscheme desert
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
|
|
||||||
|
set background=dark
|
||||||
|
|
||||||
|
" Set extra options when running in GUI mode
|
||||||
|
if has("gui_running")
|
||||||
|
set guioptions-=T
|
||||||
|
set guioptions-=e
|
||||||
|
set t_Co=256
|
||||||
|
set guitablabel=%M\ %t
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Set utf8 as standard encoding and en_US as the standard language
|
||||||
|
set encoding=utf8
|
||||||
|
|
||||||
|
" Use Unix as the standard file type
|
||||||
|
set ffs=unix,dos,mac
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" => Files, backups and undo
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Turn backup off, since most stuff is in SVN, git et.c anyway...
|
||||||
|
set nobackup
|
||||||
|
set nowb
|
||||||
|
set noswapfile
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" => Text, tab and indent related
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Use spaces instead of tabs
|
||||||
|
set expandtab
|
||||||
|
|
||||||
|
" Be smart when using tabs ;)
|
||||||
|
set smarttab
|
||||||
|
|
||||||
|
" 1 tab == 4 spaces
|
||||||
|
set shiftwidth=4
|
||||||
|
set tabstop=4
|
||||||
|
|
||||||
|
" Linebreak on 500 characters
|
||||||
|
set lbr
|
||||||
|
set tw=500
|
||||||
|
|
||||||
|
set ai "Auto indent
|
||||||
|
set si "Smart indent
|
||||||
|
set wrap "Wrap lines
|
||||||
|
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""""
|
||||||
|
" => Visual mode related
|
||||||
|
""""""""""""""""""""""""""""""
|
||||||
|
" Visual mode pressing * or # searches for the current selection
|
||||||
|
" Super useful! From an idea by Michael Naumann
|
||||||
|
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
|
||||||
|
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" => Moving around, tabs, windows and buffers
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
|
||||||
|
map <space> /
|
||||||
|
map <c-space> ?
|
||||||
|
|
||||||
|
" Disable highlight when <leader><cr> is pressed
|
||||||
|
map <silent> <leader><cr> :noh<cr>
|
||||||
|
|
||||||
|
" Smart way to move between windows
|
||||||
|
map <C-j> <C-W>j
|
||||||
|
map <C-k> <C-W>k
|
||||||
|
map <C-h> <C-W>h
|
||||||
|
map <C-l> <C-W>l
|
||||||
|
|
||||||
|
" Close the current buffer
|
||||||
|
map <leader>bd :Bclose<cr>:tabclose<cr>gT
|
||||||
|
|
||||||
|
" Close all the buffers
|
||||||
|
map <leader>ba :bufdo bd<cr>
|
||||||
|
|
||||||
|
map <leader>l :bnext<cr>
|
||||||
|
map <leader>h :bprevious<cr>
|
||||||
|
|
||||||
|
" Useful mappings for managing tabs
|
||||||
|
map <leader>tn :tabnew<cr>
|
||||||
|
map <leader>to :tabonly<cr>
|
||||||
|
map <leader>tc :tabclose<cr>
|
||||||
|
map <leader>tm :tabmove
|
||||||
|
map <leader>t<leader> :tabnext
|
||||||
|
|
||||||
|
" Let 'tl' toggle between this and the last accessed tab
|
||||||
|
let g:lasttab = 1
|
||||||
|
nmap <Leader>tl :exe "tabn ".g:lasttab<CR>
|
||||||
|
au TabLeave * let g:lasttab = tabpagenr()
|
||||||
|
|
||||||
|
|
||||||
|
" Opens a new tab with the current buffer's path
|
||||||
|
" Super useful when editing files in the same directory
|
||||||
|
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
|
||||||
|
|
||||||
|
" Switch CWD to the directory of the open buffer
|
||||||
|
map <leader>cd :cd %:p:h<cr>:pwd<cr>
|
||||||
|
|
||||||
|
" Specify the behavior when switching between buffers
|
||||||
|
try
|
||||||
|
set switchbuf=useopen,usetab,newtab
|
||||||
|
set stal=2
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
|
|
||||||
|
" Return to last edit position when opening files (You want this!)
|
||||||
|
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||||
|
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""""
|
||||||
|
" => Status line
|
||||||
|
""""""""""""""""""""""""""""""
|
||||||
|
" Always show the status line
|
||||||
|
set laststatus=2
|
||||||
|
|
||||||
|
" Format the status line
|
||||||
|
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" => Editing mappings
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Remap VIM 0 to first non-blank character
|
||||||
|
map 0 ^
|
||||||
|
|
||||||
|
" Move a line of text using ALT+[jk] or Command+[jk] on mac
|
||||||
|
nmap <M-j> mz:m+<cr>`z
|
||||||
|
nmap <M-k> mz:m-2<cr>`z
|
||||||
|
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
|
||||||
|
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
|
||||||
|
|
||||||
|
if has("mac") || has("macunix")
|
||||||
|
nmap <D-j> <M-j>
|
||||||
|
nmap <D-k> <M-k>
|
||||||
|
vmap <D-j> <M-j>
|
||||||
|
vmap <D-k> <M-k>
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Delete trailing white space on save, useful for Python and CoffeeScript ;)
|
||||||
|
func! DeleteTrailingWS()
|
||||||
|
exe "normal mz"
|
||||||
|
%s/\s\+$//ge
|
||||||
|
exe "normal `z"
|
||||||
|
endfunc
|
||||||
|
autocmd BufWrite *.py :call DeleteTrailingWS()
|
||||||
|
autocmd BufWrite *.coffee :call DeleteTrailingWS()
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" => Ag searching and cope displaying
|
||||||
|
" requires ag.vim - it's much better than vimgrep/grep
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" When you press gv you Ag after the selected text
|
||||||
|
vnoremap <silent> gv :call VisualSelection('gv', '')<CR>
|
||||||
|
|
||||||
|
" Open Ag and put the cursor in the right position
|
||||||
|
map <leader>g :Ag
|
||||||
|
|
||||||
|
" When you press <leader>r you can search and replace the selected text
|
||||||
|
vnoremap <silent> <leader>r :call VisualSelection('replace', '')<CR>
|
||||||
|
|
||||||
|
" Do :help cope if you are unsure what cope is. It's super useful!
|
||||||
|
"
|
||||||
|
" When you search with Ag, display your results in cope by doing:
|
||||||
|
" <leader>cc
|
||||||
|
"
|
||||||
|
" To go to the next search result do:
|
||||||
|
" <leader>n
|
||||||
|
"
|
||||||
|
" To go to the previous search results do:
|
||||||
|
" <leader>p
|
||||||
|
"
|
||||||
|
map <leader>cc :botright cope<cr>
|
||||||
|
map <leader>co ggVGy:tabnew<cr>:set syntax=qf<cr>pgg
|
||||||
|
map <leader>n :cn<cr>
|
||||||
|
map <leader>p :cp<cr>
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" => Spell checking
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Pressing ,ss will toggle and untoggle spell checking
|
||||||
|
map <leader>ss :setlocal spell!<cr>
|
||||||
|
|
||||||
|
" Shortcuts using <leader>
|
||||||
|
map <leader>sn ]s
|
||||||
|
map <leader>sp [s
|
||||||
|
map <leader>sa zg
|
||||||
|
map <leader>s? z=
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" => Misc
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Remove the Windows ^M - when the encodings gets messed up
|
||||||
|
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
|
||||||
|
|
||||||
|
" Quickly open a buffer for scribble
|
||||||
|
map <leader>q :e ~/buffer<cr>
|
||||||
|
|
||||||
|
" Quickly open a markdown buffer for scribble
|
||||||
|
map <leader>x :e ~/buffer.md<cr>
|
||||||
|
|
||||||
|
" Toggle paste mode on and off
|
||||||
|
map <leader>pp :setlocal paste!<cr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" => Helper functions
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
function! CmdLine(str)
|
||||||
|
exe "menu Foo.Bar :" . a:str
|
||||||
|
emenu Foo.Bar
|
||||||
|
unmenu Foo
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! VisualSelection(direction, extra_filter) range
|
||||||
|
let l:saved_reg = @"
|
||||||
|
execute "normal! vgvy"
|
||||||
|
|
||||||
|
let l:pattern = escape(@", '\\/.*$^~[]')
|
||||||
|
let l:pattern = substitute(l:pattern, "\n$", "", "")
|
||||||
|
|
||||||
|
if a:direction == 'gv'
|
||||||
|
call CmdLine("Ag \"" . l:pattern . "\" " )
|
||||||
|
elseif a:direction == 'replace'
|
||||||
|
call CmdLine("%s" . '/'. l:pattern . '/')
|
||||||
|
endif
|
||||||
|
|
||||||
|
let @/ = l:pattern
|
||||||
|
let @" = l:saved_reg
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Returns true if paste mode is enabled
|
||||||
|
function! HasPaste()
|
||||||
|
if &paste
|
||||||
|
return 'PASTE MODE '
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Don't close window, when deleting a buffer
|
||||||
|
command! Bclose call <SID>BufcloseCloseIt()
|
||||||
|
function! <SID>BufcloseCloseIt()
|
||||||
|
let l:currentBufNum = bufnr("%")
|
||||||
|
let l:alternateBufNum = bufnr("#")
|
||||||
|
|
||||||
|
if buflisted(l:alternateBufNum)
|
||||||
|
buffer #
|
||||||
|
else
|
||||||
|
bnext
|
||||||
|
endif
|
||||||
|
|
||||||
|
if bufnr("%") == l:currentBufNum
|
||||||
|
new
|
||||||
|
endif
|
||||||
|
|
||||||
|
if buflisted(l:currentBufNum)
|
||||||
|
execute("bdelete! ".l:currentBufNum)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Make VIM remember position in file after reopen
|
||||||
|
" if has("autocmd")
|
||||||
|
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||||
|
"endif
|
||||||
30
.devcontainer/devimage/Dockerfile
Normal file
30
.devcontainer/devimage/Dockerfile
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
FROM node:lts-bullseye
|
||||||
|
RUN apt-get update && apt-get install -y vim htop lsb-release gnupg sudo locales bash-completion
|
||||||
|
|
||||||
|
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && dpkg-reconfigure --frontend=noninteractive locales
|
||||||
|
ENV LANG en_US.UTF-8
|
||||||
|
ENV LANGUAGE en_US.UTF-8
|
||||||
|
ENV LC_ALL en_US.UTF-8
|
||||||
|
env TZ=Europe/Berlin
|
||||||
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
|
||||||
|
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
|
||||||
|
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
|
||||||
|
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list \
|
||||||
|
&& apt-get update && apt-get install -y docker-ce-cli \
|
||||||
|
&& curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
|
||||||
|
&& chmod +x /usr/local/bin/docker-compose
|
||||||
|
|
||||||
|
RUN mkdir -p /opt/bin
|
||||||
|
|
||||||
|
COPY psql /opt/bin/psql
|
||||||
|
COPY dc /opt/bin/dc
|
||||||
|
COPY git-prompt /opt/git-prompt
|
||||||
|
|
||||||
|
RUN groupadd --gid 998 docker && usermod --append --groups docker root && usermod --append --groups docker node
|
||||||
|
RUN echo "node ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/node && chmod 0440 /etc/sudoers.d/node
|
||||||
|
|
||||||
|
USER node
|
||||||
|
COPY .bashrc /home/node/.bashrc
|
||||||
|
COPY .vimrc /home/node/.vimrc
|
||||||
|
ENV PATH="/opt/bin/:${PATH}"
|
||||||
2
.devcontainer/devimage/dc
Executable file
2
.devcontainer/devimage/dc
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
docker-compose -f /cookbook/.devcontainer/dc.dev.yml -p cookbook "$@"
|
||||||
42
.devcontainer/devimage/git-prompt/colors.sh
Normal file
42
.devcontainer/devimage/git-prompt/colors.sh
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Regular
|
||||||
|
txtblk="$(tput setaf 0 2>/dev/null || echo '\e[0;30m')" # Black
|
||||||
|
txtred="$(tput setaf 1 2>/dev/null || echo '\e[0;31m')" # Red
|
||||||
|
txtgrn="$(tput setaf 2 2>/dev/null || echo '\e[0;32m')" # Green
|
||||||
|
txtylw="$(tput setaf 3 2>/dev/null || echo '\e[0;33m')" # Yellow
|
||||||
|
txtblu="$(tput setaf 4 2>/dev/null || echo '\e[0;34m')" # Blue
|
||||||
|
txtpur="$(tput setaf 5 2>/dev/null || echo '\e[0;35m')" # Purple
|
||||||
|
txtcyn="$(tput setaf 6 2>/dev/null || echo '\e[0;36m')" # Cyan
|
||||||
|
txtwht="$(tput setaf 7 2>/dev/null || echo '\e[0;37m')" # White
|
||||||
|
|
||||||
|
# Bold
|
||||||
|
bldblk="$(tput setaf 0 2>/dev/null)$(tput bold 2>/dev/null || echo '\e[1;30m')" # Black
|
||||||
|
bldred="$(tput setaf 1 2>/dev/null)$(tput bold 2>/dev/null || echo '\e[1;31m')" # Red
|
||||||
|
bldgrn="$(tput setaf 2 2>/dev/null)$(tput bold 2>/dev/null || echo '\e[1;32m')" # Green
|
||||||
|
bldylw="$(tput setaf 3 2>/dev/null)$(tput bold 2>/dev/null || echo '\e[1;33m')" # Yellow
|
||||||
|
bldblu="$(tput setaf 4 2>/dev/null)$(tput bold 2>/dev/null || echo '\e[1;34m')" # Blue
|
||||||
|
bldpur="$(tput setaf 5 2>/dev/null)$(tput bold 2>/dev/null || echo '\e[1;35m')" # Purple
|
||||||
|
bldcyn="$(tput setaf 6 2>/dev/null)$(tput bold 2>/dev/null || echo '\e[1;36m')" # Cyan
|
||||||
|
bldwht="$(tput setaf 7 2>/dev/null)$(tput bold 2>/dev/null || echo '\e[1;37m')" # White
|
||||||
|
|
||||||
|
# Underline
|
||||||
|
undblk="$(tput setaf 0 2>/dev/null)$(tput smul 2>/dev/null || echo '\e[4;30m')" # Black
|
||||||
|
undred="$(tput setaf 1 2>/dev/null)$(tput smul 2>/dev/null || echo '\e[4;31m')" # Red
|
||||||
|
undgrn="$(tput setaf 2 2>/dev/null)$(tput smul 2>/dev/null || echo '\e[4;32m')" # Green
|
||||||
|
undylw="$(tput setaf 3 2>/dev/null)$(tput smul 2>/dev/null || echo '\e[4;33m')" # Yellow
|
||||||
|
undblu="$(tput setaf 4 2>/dev/null)$(tput smul 2>/dev/null || echo '\e[4;34m')" # Blue
|
||||||
|
undpur="$(tput setaf 5 2>/dev/null)$(tput smul 2>/dev/null || echo '\e[4;35m')" # Purple
|
||||||
|
undcyn="$(tput setaf 6 2>/dev/null)$(tput smul 2>/dev/null || echo '\e[4;36m')" # Cyan
|
||||||
|
undwht="$(tput setaf 7 2>/dev/null)$(tput smul 2>/dev/null || echo '\e[4;37m')" # White
|
||||||
|
|
||||||
|
# Background
|
||||||
|
bakblk="$(tput setab 0 2>/dev/null || echo '\e[40m')" # Black
|
||||||
|
bakred="$(tput setab 1 2>/dev/null || echo '\e[41m')" # Red
|
||||||
|
bakgrn="$(tput setab 2 2>/dev/null || echo '\e[42m')" # Green
|
||||||
|
bakylw="$(tput setab 3 2>/dev/null || echo '\e[43m')" # Yellow
|
||||||
|
bakblu="$(tput setab 4 2>/dev/null || echo '\e[44m')" # Blue
|
||||||
|
bakpur="$(tput setab 5 2>/dev/null || echo '\e[45m')" # Purple
|
||||||
|
bakcyn="$(tput setab 6 2>/dev/null || echo '\e[46m')" # Cyan
|
||||||
|
bakwht="$(tput setab 7 2>/dev/null || echo '\e[47m')" # White
|
||||||
|
|
||||||
|
# Reset
|
||||||
|
txtrst="$(tput sgr 0 2>/dev/null || echo '\e[0m')" # Text Reset
|
||||||
25
.devcontainer/devimage/git-prompt/prompt.sh
Normal file
25
.devcontainer/devimage/git-prompt/prompt.sh
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
source "/opt/git-prompt/colors.sh"
|
||||||
|
|
||||||
|
find_git_branch() {
|
||||||
|
# Based on: http://stackoverflow.com/a/13003854/170413
|
||||||
|
local branch
|
||||||
|
if branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null); then
|
||||||
|
if [[ "$branch" == "HEAD" ]]; then
|
||||||
|
branch='detached*'
|
||||||
|
fi
|
||||||
|
git_branch="($branch)"
|
||||||
|
else
|
||||||
|
git_branch=""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
find_git_dirty() {
|
||||||
|
local status=$(git status --porcelain 2> /dev/null)
|
||||||
|
if [[ "$status" != "" ]]; then
|
||||||
|
git_dirty='*'
|
||||||
|
else
|
||||||
|
git_dirty=''
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT_COMMAND="find_git_branch; find_git_dirty; $PROMPT_COMMAND"
|
||||||
2
.devcontainer/devimage/psql
Executable file
2
.devcontainer/devimage/psql
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
dc exec postgres psql -U cookbook
|
||||||
4
.devcontainer/tmp
Normal file
4
.devcontainer/tmp
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
"workspaceFolder": "/cookbook",
|
||||||
|
"workspaceMount": "source=${localWorkspaceFolder},target=/cookbook,type=bind,consistency=cached",
|
||||||
|
"postCreateCommand": "/home/node/bin/post-create.sh",
|
||||||
10
cookboook.code-workspace
Normal file
10
cookboook.code-workspace
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{"path": ".", "name": "root"},
|
||||||
|
{"path": ".devcontainer", "name": "devcontainer"},
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"editor.insertSpaces": true,
|
||||||
|
"gitlens.currentLine.enabled": true,
|
||||||
|
}
|
||||||
|
}
|
||||||
6
postgres/Dockerfile
Normal file
6
postgres/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FROM postgres:14
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends postgresql-14-wal2json \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
RUN echo "wal_level = logical" >> /usr/share/postgresql/postgresql.conf.sample
|
||||||
10
postgres/info.txt
Normal file
10
postgres/info.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
dc exec postgresql psql "user=cookbook replication=database"
|
||||||
|
|
||||||
|
IDENTIFY_SYSTEM;
|
||||||
|
CREATE_REPLICATION_SLOT test LOGICAL wal2json;
|
||||||
|
START_REPLICATION SLOT test 0/0000000
|
||||||
|
|
||||||
|
https://www.postgresql.org/docs/14/protocol-replication.html
|
||||||
|
https://github.com/postgres/postgres/blob/master/src/bin/pg_basebackup/pg_recvlogical.c
|
||||||
|
https://github.com/kibae/pg-logical-replication/blob/master/index.js
|
||||||
|
https://github.com/eulerto/wal2json
|
||||||
Loading…
x
Reference in New Issue
Block a user