Last active
September 21, 2020 16:34
-
-
Save jbasinger/58b7c4af6adf6d64c620abbf76449149 to your computer and use it in GitHub Desktop.
Revisions
-
jbasinger revised this gist
Sep 21, 2020 . 1 changed file with 12 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ version: "3.8" services: tools: hostname: tools container_name: tools build: context: ./tools volumes: - "/Volumes/dev:/code" stdin_open: true tty: true -
jbasinger revised this gist
Sep 21, 2020 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ FROM ubuntu:latest ENV TERM xterm-256color WORKDIR /root RUN apt-get update \ && apt-get install -y \ ripgrep \ jq \ zsh \ curl \ git RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k COPY . /root WORKDIR /code ENTRYPOINT ["/bin/zsh"] -
jbasinger revised this gist
Sep 21, 2020 . 2 changed files with 55 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ #!/bin/bash CONTAINER="ms_db" PASS="mysecretpassword!" BAKS=$(ls -r backup/*.bak) for BAK in $BAKS do echo "Restoring backup: $BAK" # echo "RESTORE FILELISTONLY FROM DISK = '/$BAK'" VOLS=$(docker exec -it $CONTAINER /opt/mssql-tools/bin/sqlcmd \ -S localhost -U SA -P $PASS \ -Q "RESTORE FILELISTONLY FROM DISK = '/$BAK'" \ | tr -s ' ' | cut -d ' ' -f 1 | sed 1,2d | tail -r | sed 1,2d | tail -r) i=0 SQL="RESTORE DATABASE " for VOL in $VOLS do if [[ $i -eq 0 ]] then SQL+="$VOL FROM DISK = '/$BAK' WITH MOVE '$VOL' TO '/var/opt/mssql/data/$VOL.mdf'" else SQL+=", MOVE '$VOL' TO '/var/opt/mssql/data/$VOL.ldf'" fi i+=1 done # echo $SQL docker exec -it $CONTAINER /opt/mssql-tools/bin/sqlcmd \ -S localhost -U SA -P $PASS \ -Q "$SQL" done This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #!/bin/bash if [ -z "$1" ] then echo "Please specify a script" exit 1 fi CONTAINER="ms_db" PASS="mysecretpassword!" SCRIPT=$1 docker exec -it $CONTAINER /opt/mssql-tools/bin/sqlcmd \ -S localhost -U SA -P $PASS \ -i "/$SCRIPT" -
jbasinger revised this gist
Sep 21, 2020 . No changes.There are no files selected for viewing
-
jbasinger created this gist
Sep 21, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ version: "3.8" services: ms-db: image: mcr.microsoft.com/mssql/server:2017-latest container_name: ms_db ports: - "1433:1433" environment: - "ACCEPT_EULA=Y" - "SA_PASSWORD=mysecretpassword!" volumes: - ms_db:/var/opt/mssql - ./backup:/backup - ./scripts:/scripts networks: - database volumes: ms_db: networks: database: