Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Who's the culprit #30

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ $ sudo docker pull minicrane/blog-nginx:0.2.0
# Linux의 cron을 이용하여 action 따라하기


# docker compose 사용하여 AUTO LB 적용하기

## 감사 - 디자인템플릿 공여자에게
감사합니다.

15 changes: 9 additions & 6 deletions docker/blog-a/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# blog-a
FROM ubuntu:22.04

RUN apt update && apt install -y nginx
RUN apt-get update
RUN apt install -y nginx
RUN apt install -y git
RUN apt install cron
RUN git clone https://github.com/papercrane55123/papercrane55123.github.io.git /var/www/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
RUN rm -rf /var/www/html
RUN git clone https://github.com/papercrane55123/papercrane55123.github.io.git /var/www/html/
#CMD [/start.sh]
COPY pull.sh /var/www/html
COPY blog-pull-cronjob /etc/cron.d/
RUN crontab /etc/cron.d/blog-pull-cronjob
CMD service cron start;nginx -g 'daemon off;'
4 changes: 4 additions & 0 deletions docker/blog-a/blog-pull-cronjob
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

* * * * * sh /var/www/html/pull.sh >> /var/log/pull.log 2>&1
# new crontab file is missing newline before EOF, can't install.

9 changes: 9 additions & 0 deletions docker/blog-a/pull.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

echo "start pull-->"
date "+%Y-%m-%d %H:%M:%S"

cd /var/www/html
git pull

echo "<--end pull"
5 changes: 5 additions & 0 deletions docker/blog-a/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

nginx -g daemon off;
cd /var/www/html
cp blog-pull-cronjob /etc/cron.d/
38 changes: 38 additions & 0 deletions docker/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '2'
name: awsgoo
services:
nginx-proxy:
image: nginxproxy/nginx-proxy # https://github.com/nginx-proxy/nginx-proxy
ports:
- "9889:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
depends_on:
- blog
deploy:
resources:
limits:
cpus: '0.20'
memory: 100M
reservations:
cpus: '0.10'
memory: 10M

blog:
# build: ../../docker_file/httpd
image: minicrane/blog-a:0.1.0
deploy:
mode: replicated
replicas: 20 # https://docs.docker.com/compose/compose-file/deploy/#replicas 복제 개수
resources: # https://docs.docker.com/compose/compose-file/compose-file-v3/#resources
limits:
cpus: '0.10'
memory: 70M
reservations:
cpus: '0.01'
memory: 10M
expose:
- "80"
environment:
- VIRTUAL_HOST=aws.google.com
- VIRTUAL_PORT=80