Skip to content

Commit 1bda05e

Browse files
Create deployment
1 parent f488337 commit 1bda05e

6 files changed

Lines changed: 46 additions & 8 deletions

File tree

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ jobs:
4747
with:
4848
task-definition: ${{ steps.task-def.outputs.task-definition }}
4949
service: toynet-django-service
50-
cluster: toynet-django-container
50+
cluster: toynet-django-cluster
5151
wait-for-service-stability: true

Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
FROM python:3.8-slim
1+
FROM ubuntu:latest
22

33
WORKDIR app
44

5-
RUN apt-get update && apt-get install -y \
6-
graphviz \
7-
&& rm -rf /var/lib/apt/lists/*
5+
ENV DEBIAN_FRONTEND=noninteractive
6+
RUN apt-get update
7+
RUN apt-get -y install python3.7
8+
RUN apt-get -y install python3-pip
9+
RUN apt-get -y install graphviz
10+
RUN pip3 install diagrams==0.9.0
811

912
COPY requirements.txt requirements.txt
1013

11-
RUN python -m pip install -r requirements.txt
14+
RUN python3 -m pip install -r requirements.txt
1215

1316
COPY engine engine
1417
RUN cd engine
1518

1619
EXPOSE 8000
1720

18-
CMD [ "python", "/app/engine/manage.py", "runserver", "0.0.0.0:8000" ]
21+
CMD [ "python3", "/app/engine/manage.py", "runserver", "0.0.0.0:8000" ]

engine/engine/settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@
2929
SECRET_KEY = os.environ['SECRET_KEY']
3030

3131
# SECURITY WARNING: don't run with debug turned on in production!
32-
DEBUG = True
32+
DEBUG = False
3333

3434
ALLOWED_HOSTS = [
3535
'backend',
3636
'localhost',
37+
'*',
38+
'internal-toynet-django-lb-182235266.us-east-2.elb.amazonaws.com',
3739
]
3840

3941

@@ -52,6 +54,7 @@
5254
'article.apps.ArticleConfig',
5355
'quiz.apps.QuizConfig',
5456
'rest_framework',
57+
'health_check',
5558
]
5659

5760
MIDDLEWARE = [

engine/engine/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from api.viewset.router import router
1919

2020
urlpatterns = [
21+
path('healthcheck/', include('health_check.urls')),
2122
path('admin/', admin.site.urls),
2223
path('api/', include('api.urls')),
2324
path('data/', include(router.urls)),

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ astroid==2.4.2
44
diagrams==0.16.0
55
distlib==0.3.1
66
Django==3.0.8
7+
django-health-check==3.12.1
78
djangorestframework==3.11.0
89
filelock==3.0.12
910
graphviz==0.13.2

task-definition.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"containerDefinitions": [
3+
{
4+
"name": "toynet-django-container",
5+
"image": "909056806605.dkr.ecr.us-east-2.amazonaws.com/toynet-django",
6+
"cpu": 0,
7+
"memoryReservation": 64,
8+
"portMappings": [{
9+
"hostPort": 0,
10+
"containerPort": 8000,
11+
"protocol": "tcp"
12+
}],
13+
"essential": true,
14+
"mountPoints": [],
15+
"volumesFrom": [],
16+
"secrets": [{
17+
"name": "SECRET_KEY",
18+
"valueFrom": "arn:aws:secretsmanager:us-east-2:909056806605:secret:toynet-django-secretkey-dHbN5I"
19+
}]
20+
}
21+
],
22+
"executionRoleArn": "arn:aws:iam::909056806605:role/ecsTaskExecutionRole-toynet-django",
23+
"family": "toynet-django",
24+
"volumes": [],
25+
"placementConstraints": [],
26+
"requiresCompatibilities": [
27+
"EC2"
28+
],
29+
"memory": "64"
30+
}

0 commit comments

Comments
 (0)