Skip to content

Commit

Permalink
Merge pull request #99 from chibiegg/feat/roll
Browse files Browse the repository at this point in the history
ローリングアップデートに対応
  • Loading branch information
chibiegg authored Sep 18, 2019
2 parents 5f14214 + 6c9e921 commit 6569e8a
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ README.md
.git/
media/icons/*
docs/
kubernates/
kubernetes/
nginx/
logs/
data/
37 changes: 19 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
all: nginx app
all: image

.PHONY: nginx app apply delete
.PHONY: image apply delete restart

nginx: nginx/Dockerfile
cd nginx && docker build -t isucon/portal-nginx .

app: Dockerfile
image:
docker build -t isucon/portal-app .
cd nginx && docker build -t isucon/portal-nginx .

apply:
kubectl apply -f kubernates/00-*.yml
kubectl apply -f kubernates/01-*.yml
kubectl apply -f kubernates/02-*.yml
kubectl apply -f kubernates/03-*.yml
kubectl apply -f kubernates/04-*.yml
kubectl apply -f kubernates/05-*.yml
kubectl apply -f kubernetes/00-*.yml
kubectl apply -f kubernetes/01-*.yml
kubectl apply -f kubernetes/02-*.yml
kubectl apply -f kubernetes/03-*.yml
kubectl apply -f kubernetes/04-*.yml
kubectl apply -f kubernetes/05-*.yml

delete:
kubectl delete -f kubernates/05-*.yml
kubectl delete -f kubernates/04-*.yml
kubectl delete -f kubernates/03-*.yml
kubectl delete -f kubernates/02-*.yml
kubectl delete -f kubernates/01-*.yml
kubectl delete -f kubernates/00-*.yml
kubectl delete -f kubernetes/05-*.yml
kubectl delete -f kubernetes/04-*.yml
kubectl delete -f kubernetes/03-*.yml
kubectl delete -f kubernetes/02-*.yml
kubectl delete -f kubernetes/01-*.yml
kubectl delete -f kubernetes/00-*.yml

restart:
kubectl rollout restart deployment/portal-app
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ python manage.py runserver
```


## kubernates (minikube)
## kubernetes (minikube)

```bash
make
Expand Down
2 changes: 1 addition & 1 deletion isucon/portal/docker_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True if os.environ.get('DJANGO_DEBUG', "true").lower() == "true" else False

ALLOWED_HOSTS = [os.environ.get('DJANGO_ALLOWED_HOST', "*")]
ALLOWED_HOSTS = [os.environ.get('DJANGO_ALLOWED_HOST', "*"), "localhost"]

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 11 additions & 1 deletion kubernates/04-app.yml → kubernetes/04-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ spec:
matchLabels:
app: portal-app
strategy:
type: Recreate
type: RollingUpdate
rollingUpdate:
maxSurge: 2
maxUnavailable: 0
template:
metadata:
labels:
Expand Down Expand Up @@ -73,6 +76,13 @@ spec:
ports:
- containerPort: 5000
name: portal-app
livenessProbe:
httpGet:
path: /
port: 5000
httpHeaders:
- name: Host
value: localhost
volumeMounts:
- name: static-volume
mountPath: /opt/app/static
Expand Down
File renamed without changes.

0 comments on commit 6569e8a

Please sign in to comment.