之
我们做过的尝试
团队的痛点
团队的痛点
我们做过的尝试
version: '2'
services:
app:
build:
context: ./app
dockerfile: Dockerfile
ports:
- "80:80"
env_file:
- ./config/env/local
links:
- db:db.local.chatops.in
volumes:
- "./app/src:/app/src"
depends_on:
- db
....
db:
image: "mysql:5.5.53"
privileged: true
ports:
- "3306:3306"
env_file:
- ./config/env/local
├── auto
│ ├── authenticate
│ ├── build
│ ├── down
│ ├── functions
│ ├── recreate
│ ├── release
│ ├── restart
│ ├── start
│ ├── stop
│ └── up
├── config
│ └── env
│ └── local
├── docker-compose.yaml
团队的痛点
我们做过的尝试
我们的实践
https://github.com/phoenix-zhu/devops-practice
团队的痛点
我们做过的尝试
我们的实践
Demo
version: '2'
services:
app:
build:
context: ./app
dockerfile: Dockerfile
ports:
- "80:80"
env_file:
- ./config/env/local
links:
- db:db.local.chatops.in
volumes:
- "./app/src:/app/src"
depends_on:
- db
- migration
...
db:
image: "mysql:5.5.53"
privileged: true
ports:
- "3306:3306"
env_file:
- ./config/env/local
version: '2'
services:
app:
image: "devopssession/ip2citydemo"
ports:
- "80:80"
env_file:
- ./config/env/local
links:
- db:db.local.chatops.in
volumes:
- "./app/src:/app/src"
depends_on:
- db
- migration
...
db:
image: "mysql:5.5.53"
privileged: true
ports:
- "3306:3306"
env_file:
- ./config/env/local
RUN mkdir -p "${RBENV_ROOT}/plugins/ruby_build" \
&& wget -q -O - https://github.com/sstephenson/rbenv/archive/master.tar.gz | \
tar -xzf - --strip-components=1 -C "${RBENV_ROOT}" \
&& wget -q -O - https://github.com/sstephenson/ruby-build/archive/master.tar.gz | \
tar -xzf - --strip-components=1 -C "${RBENV_ROOT}/plugins/ruby_build" \
&& ln -snf "${RBENV_ROOT}/bin/rbenv" /usr/local/bin/rbenv \
&& echo -e 'export RBENV_ROOT=/usr/local/rbenv \n \
eval "$(/usr/local/bin/rbenv init -)"' > /etc/profile.d/rbenv.sh \
&& RBENV_ROOT=${RBENV_ROOT} /usr/local/bin/rbenv install 2.2.2 \
&& rm -f /tmp/ruby-build.*.log \
&& rbenv global 2.2.2
#!/bin/bash
echo "Trying to connect to ${DB_HOST} ..."
while ! mysql -h${DB_HOST} -u${DB_USER} -p${DB_PASSWORD} -e "show databases;" 1>/dev/null
do
echo "Failed to connect to ${DB_HOST}, trying again in 3 seconds..."
sleep 3
done
echo "Database connection successful. Continuing..."
exec $@
...
migration:
build:
context: ./migration
dockerfile: Dockerfile
env_file:
- ./config/env/local
links:
- db:db.local.chatops.in
volumes:
- "./migration:/app"
depends_on:
- db
...
FROM python:2.7-slim
MAINTAINER "DevOps Meetup" <devops@meetup.org>
WORKDIR /app
RUN pip install awscli --upgrade
COPY requirements.txt .
COPY lambda lambda
RUN pip install -r requirements.txt -t lambda
VOLUME /app/lambda
COPY . /app/
CMD ["/app/auto/deploy"]
团队的痛点
我们做过的尝试
我们的实践
Demo
需要注意的点
vs
vs
vs