Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
writer0713 authored Apr 24, 2018
2 parents 2a56354 + 4e27f19 commit 92c480c
Show file tree
Hide file tree
Showing 24 changed files with 1,212 additions and 43 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# study
# Welcome
안녕하세요. 반갑습니다. 이름은 백기선이고 온라인에서 주로 Whiteship이라는 아이디로 활동하고 있습니다.
여기는 제가 공부한 것들 정리해서 올리는 저장소입니다.

# Study
## [:tv: InfoQ](infoq.md)
## [:tv: 하이버네이트 ORM 레퍼런스 코딩](hibernate-orm-reference-coding.md)
## [:book: 이팩티브 자바](https://github.com/keesun/study/tree/master/effective-java)
## [:tv: 스프링 부트 2.0 레퍼런스 코딩 1-39 (完)](spring-boot-reference-coding.md)
## [:tv: 도커 시작하기 1-3 (完)](doker-getting-started.md)
## [:tv: 쿠버네티스 시작하기 1-3(完)](kubernetes-getting-started.md)

# Cheet Sheet
## [Docker 명령어 모음](docker-cmds.md)
## [스프링 부트 2.0 레퍼런스 코딩](spring-boot-reference-coding.md)
37 changes: 37 additions & 0 deletions doker-getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 도커 시작하기

## 참고

[도커 시작하기](https://docs.docker.com/get-started/)
[유툽/백기선/도커](https://www.youtube.com/playlist?list=PLfI752FpVCS84hxOeCyI4SBPUwt4Itd0T)

## 유툽 인덱스

[![도커 시작하기 1](https://img.youtube.com/vi/9tW0QSsrhwc/0.jpg)](https://youtu.be/9tW0QSsrhwc)

파트 1에서는 도커에 대한 기본적인 설명과 특징을 살펴봤습니다.

파트 2에서는 Dockerfile을 사용해서 간단한 파이썬 이미지를 만들었고, docker run을 사용해서 컨테이너를 실행하고, 이미지를 태깅하고, 도커 레지스트리에 등록하는 것까지 따라해 보았습니다.

[![도커 시작하기 2](https://img.youtube.com/vi/p58k2_HMWRM/0.jpg)](https://youtu.be/p58k2_HMWRM)

오늘은 시작하기 파트3 과 파트4를 봤습니다. 도커의 서비스라는 개념을 살펴봤으며 docker-compose.yml 파일을 사용해서 간단히 서비스를 정의하고 실행해 봤습니다.

파트3에서 실행할 때는 로컬 머신에서 도커 스왐을 만들고 docker stack deploy를 사용했는데, 파트 4에서는 VM을 두개 만들어서 본격적으로 스왐을 구성합니다.

myvm1은 스왐 매니저로 만들고 myvm2는 워커로 만들었습니다. 스왐 매니저만 도커 명령을 실행할 수 있기 때문에 매번 docker-machine ssh myvm1 "docker ..." 이런식으로 도커를 실행해야 하는 번거로움이 있는데, docker-machine env 를 사용해서 그런 수고를 덜 수 있는 방법을 살펴봤습니다. (그런데 간혹 로컬에 있는 도커랑 햇갈릴듯..)

혹시나 맥에서 VirtualBox 설치할 때 문제 있으신 분들은 아래 링크 참고하셔서 해결하시기 바랍니다. 혹은 제 영상 보시면 간략히 설명해 드렸으니까 참고하세요.

https://stackoverflow.com/questions/46546192/virtualbox-not-installing-on-high-sierra

[![도커 시작하기 3](https://img.youtube.com/vi/X--WPFfSbFc/0.jpg)](https://youtu.be/X--WPFfSbFc)

마지막은 이전까지 만들었던 docker-compose.yml에 서비스를 두개 더 추가하고 AWS나 Azure에 배포하는 방법을 소개하고 있습니다.

기존 서비스와는 독립적인 서비스 (컨테이너 배포 상황을 보여주는 이미지)와 기존 서비스가 사용하는 서비스 (레디스)를 각각 추가해서 동작하는걸 데모로 해봤습니다. 중간에 맥 쓰시는 분들은 아마도 저처럼 문제(비주얼라이저 컨테이너가 잘 안뜨는)가 생길 수 있을텐데요. 영상에서 해결했사오니 궁금하신 분들은 확인해 보세요.

아쉽게도 6부 AWS나 Azure에 배포하는건 따라해보지 못했습니다. 차마 그쪽까지 세팅할만큼 부지런하질 못해서... 대신 개념적으로만 살펴봤는데요. 결국엔 AWS든 Azure든 도커 스왐으로 묶어서 docker-compose.yml 파일을 배포하는건 똑같더라구요. 대신 손만 조금 더 많이 가게 생겼더군요.

각 서비스 계정 열어야지, 도커 인스턴스 만들어야지, 스왐으로 연결 해야지, 컨테이너 관련된 포트를 열어줘야지.. @_@..

25 changes: 25 additions & 0 deletions effective-java-3rd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/target/
!.mvn/wrapper/maven-wrapper.jar

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
Binary file added effective-java-3rd/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 1 addition & 0 deletions effective-java-3rd/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip
225 changes: 225 additions & 0 deletions effective-java-3rd/mvnw
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------

if [ -z "$MAVEN_SKIP_RC" ] ; then

if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi

if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi

fi

# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac

if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi

if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"

# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done

saveddir=`pwd`

M2_HOME=`dirname "$PRG"`/..

# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`

cd "$saveddir"
# echo Using m2 at $M2_HOME
fi

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi

# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
# TODO classpath?
fi

if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi

if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi

if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi

if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi

CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher

# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {

if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi

basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}

# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}

BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi

export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
echo $MAVEN_PROJECTBASEDIR
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi

WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
Loading

0 comments on commit 92c480c

Please sign in to comment.