Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
a1b252c
chore: initialize Django project
hepheir Nov 25, 2025
7db2ad1
chore: install DRF and Swagger
hepheir Nov 25, 2025
0f2be0f
feat(swagger): add `/swagger/` endpoint for Swagger support
hepheir Nov 25, 2025
5f7eb5b
build(docker): add Dockerfile
hepheir Nov 25, 2025
3314675
feat: add `/health` endpoint and Docker `HEALTHCHECK`
hepheir Nov 25, 2025
c5ba2b4
build(docker): change image `python:3.9` to `python:3.11-slim`
hepheir Nov 26, 2025
7082a8d
fix(docker): improve Dockerfile structure and healthcheck configuration
hepheir Nov 26, 2025
3f35757
fix(views): add `/health` endpoint가 GET 요청만 처리하도록 수정
hepheir Nov 27, 2025
3944e80
fix(entrypoint): ensure script exits on error by adding `set -e`
hepheir Nov 27, 2025
c4359e8
build(docker): use `gunicorn` to run server & removed entrypoint.sh
hepheir Nov 27, 2025
b2ff57d
fix(docker): add `RUN` command to install `curl`
hepheir Nov 27, 2025
6848d6d
build(docker): replace healthcheck script with inline `HEALTHCHECK` c…
hepheir Nov 27, 2025
22f6ee5
build(docker): gunicorn 이 멀티스레드로 동작하도록 변경 (4 workers, 2 threads)
hepheir Nov 27, 2025
8578187
build(docker): use non-root user for security best practices
hepheir Nov 27, 2025
c30f0e1
chore(docker): migrate 명령을 제거하라는 TODO 메시지 삽입
hepheir Nov 27, 2025
b078b7e
chore(gitignore): 최상위 경로의 `.`으로 시작하는 파일/폴더를 무시하도록 변경
hepheir Nov 27, 2025
f8a2311
chore: add .dockerignore
hepheir Nov 27, 2025
24dab47
settings: `SECRET_KEY`, `DEBUG`, `ALLOWED_HOSTS` 속성을 환경변수에서 불러오도록 변경
hepheir Nov 27, 2025
52d0d66
feat: static 경로 추가
hepheir Nov 27, 2025
85acb0d
build(docker): entrypoint.sh 을 사용하여 `DEBUG` 모드 시에만 DB migration 수행하도록 변경
hepheir Nov 27, 2025
a20783c
refactor: `/health/` endpoint에 대한 Swagger 지원이 정상적으로 되고 있지 않던 문제 수정 (F…
hepheir Nov 27, 2025
6ae436f
refactor: `HealthCheck` 클래스 이름 변경 (-> `HealthCheckAPIView`) & 하드코딩된 상…
hepheir Nov 27, 2025
b746487
fix(docker): 상태 코드가 200 OK가 아니어도 healthy 로 판별되는 오류 수정
hepheir Nov 27, 2025
f558b0e
fix(settings): ensure `ALLOWED_HOSTS` is set when `DEBUG` is off
hepheir Nov 27, 2025
a8e1ac4
fix(docker): update entrypoint.sh to use `python` command for manage.py
hepheir Nov 27, 2025
73229c4
fix(urls): 관리자 페이지나 Swagger, static 파일 서빙은 `DEBUG` 모드에서만 하도록 변경
hepheir Nov 27, 2025
29863e1
build(docker): multi-container 환경을 고려하여 migration은 별도로 수행하도록 명령 제거
hepheir Nov 27, 2025
bc6c749
refactor: entrypoint argument 출력 메시지 수정 [DEBUG] -> [ENTRYPOINT]
hepheir Nov 27, 2025
a1abf3f
refactor(urls): 정규표현식 기반 url은 `re_path()`로 매핑하도록 변경
hepheir Nov 27, 2025
1460cbf
docs(views): `HealthCheckAPIView` 응답에 대한 설명 추가
hepheir Nov 27, 2025
f9550e8
test(app): add `HealthCheckAPIView` 에 대한 테스트 추가
hepheir Nov 28, 2025
68e8129
chore: 균일한 인덴트 적용 (코드 스타일)
hepheir Nov 28, 2025
a769a1b
build(docker): replace entrypoint script with inline `ENTRYPOINT` com…
hepheir Nov 28, 2025
35def21
feat: settings.py 에서 truthy, falsy 값을 구분하는 로직 추가
hepheir Nov 28, 2025
0eee093
chore(settings): improve error message for empty `ALLOWED_HOSTS`
hepheir Nov 28, 2025
dea4722
fix(docker): remove outdated entrypoint script permission change
hepheir Nov 28, 2025
57c843a
fix(settings): `is_truthy()` 함수가 None을 포함한 여러 타입을 처리할 수 있도록 수정
hepheir Nov 28, 2025
af185de
"build(docker): [Revert] replace entrypoint script with inline `ENTRY…
hepheir Nov 28, 2025
af36d4c
refactor(docker): django shell 을 사용하여 `DEBUG` 모드인지 검사하도록 변경
hepheir Nov 28, 2025
1ca8e7a
refactor(settings): `get_env()` 함수 작성 및 dotenv 의존성 제거
hepheir Nov 28, 2025
d5ff410
build(docker): 개발용 docker compose 구성 추가
hepheir Nov 28, 2025
346e5a5
settings: load `SECRET_KEY` from `SECRET_KEY_FILE` file if not set in…
hepheir Nov 28, 2025
003dd4b
settings: 데이터베이스를 PostgreSQL을 사용하도록 변경
hepheir Nov 28, 2025
f5e1b65
build(docker): docker compose 에서 Postgres DB를 자동으로 구성하도록 수정
hepheir Nov 28, 2025
9ce235b
docs: README.md 작성 (개발 환경 설정 및 배포방법 간략하게 기재)
hepheir Nov 28, 2025
fc75d37
docs: Amazon Q Dev의 README.md 첨삭 (Claude Sonnet 4)
hepheir Nov 28, 2025
87275ff
feat(app.env): add environment variable utility functions
hepheir Nov 28, 2025
aa5ef8a
test(app): app/env.py 의 유틸리티 함수들에 대한 단위테스트 추가
hepheir Nov 28, 2025
6a1b839
refactor(settings): replace custom environment variable functions wit…
hepheir Nov 28, 2025
378b1f2
fix(docker): change `ENTRYPOINT` to use bash for script execution
hepheir Nov 28, 2025
48d4483
fix(docker): update `DEBUG` and `ALLOWED_HOSTS` environment variables…
hepheir Nov 28, 2025
dd6eba6
feat(app.env): load environment variables using dotenv
hepheir Nov 28, 2025
4b9ef3f
docs: correct wording for file watcher feature in development mode
hepheir Nov 28, 2025
73f0233
fix(app.settings): remove `DEBUG` condition from `ALLOWED_HOSTS` asse…
hepheir Nov 28, 2025
9342b8a
fix(docker): ensure auth-database dependency has health check and res…
hepheir Nov 28, 2025
5fc332e
refactor(app.settings): 명료하지 않은 함수 인자나 예외처리 명료화
hepheir Nov 28, 2025
87bf64f
refactor(docker): yaml boolean 으로 처리될 수 있는 소지의 환경변수를 문자열로 변환
hepheir Nov 28, 2025
1a5afb4
fix: `set -e` flag 를 코드 최상단으로 이동하여 error checking을 모든 line에서 보장할 수 있도록 함
hepheir Nov 28, 2025
e027e45
feat(healthcheck): add database connectivity check to `HealthCheckAPI…
hepheir Nov 29, 2025
dd1a97c
fix(settings): set default `ALLOWED_HOSTS` to include localhost and 1…
hepheir Nov 29, 2025
eb8beb6
refactor(docker): remove version specification from docker-compose file
hepheir Nov 29, 2025
ffe5ab1
refactor(docker): rename services and update environment variables in…
hepheir Nov 29, 2025
f34633b
fix(env): [security] 예외 메시지에서 환경 변수 값을 노출하지 않도록 수정
hepheir Nov 29, 2025
7fc9fa8
fix(entrypoint): allow `collectstatic` to continue on failure in `DEB…
hepheir Nov 29, 2025
08ca2f5
test(healthcheck): 데이터베이스 연결에 실패하면 `/health/` 가 500을 반환하는지 검사하는 테스트 추가
hepheir Nov 29, 2025
e2b5004
refactor(entrypoint): encapsulate `DEBUG` mode check in a separate fu…
hepheir Nov 29, 2025
eafe260
docs: docker compose에서 변경된 서비스명을 README.md의 포트 설정 변경 섹션에 적용
hepheir Nov 29, 2025
dff722c
chore(app.env): correct typo Conectivity -> Connectivity
hepheir Nov 29, 2025
b290711
chore(app.env): 부자연스런 오류 메시지 수정
hepheir Nov 29, 2025
6e33709
refactor(entrypoint): 불필요한 return 문 제거
hepheir Nov 29, 2025
37b1520
feat(app.env): `get_array()` 함수에 `allow_empty` 옵션 추가
hepheir Nov 29, 2025
0204747
refactor(settings): enforce non-empty `ALLOWED_HOSTS` configuration
hepheir Nov 29, 2025
3ae8000
refactor(app.env): 환경변수 파싱 로직에서 early return 지양
hepheir Nov 29, 2025
4cbca7e
refactor(app.env): `get_array()`의 인자명 변경 `allow_empty` -> `empty`
hepheir Nov 29, 2025
da574ea
feat(app.env): add `get_json()` support JSON parsed value
hepheir Nov 29, 2025
8f4b0d0
test(app.env): add JSON parsing tests for environment variables
hepheir Nov 29, 2025
09d90a2
refactor(app.settings): `ALLOWED_HOSTS` 환경변수를 `env.get_json()`으로 불러오도…
hepheir Nov 29, 2025
1b22925
refactor(app.env): remove unused `get_array()` function and related t…
hepheir Nov 29, 2025
1fd668a
fix(app.views): health check시 DB 커넥션 연결 확인 후 커넥션을 종료하도록 수정
hepheir Nov 29, 2025
63b9cd1
refactor(app.settings): remove validation for `ALLOWED_HOSTS` environ…
hepheir Nov 29, 2025
8720421
refactor(entrypoint.sh): `collectstatic` 오류 발생시 무시하지 않도록 수정하고 주석에 이유를 명시
hepheir Nov 29, 2025
d89f9d4
refactor(entrypoint.sh): `main` 함수가 최상단으로 가도록 수정
hepheir Nov 29, 2025
3353f2f
feat(entrypoint.sh): DB가 ready 될 때까지 기다리는 로직 추가
hepheir Nov 29, 2025
9e78309
feat(app.env): 파일 콘텐츠를 읽어올 때 strip 하도록 변경
hepheir Nov 29, 2025
8b870dd
test(app.env): 파일 콘텐츠를 읽어올 때 strip 하는지 검사하는 단위테스트 작성
hepheir Nov 29, 2025
0698fa0
build(docker): update develop sync configuration to ignore additional…
hepheir Nov 29, 2025
966dd8d
build(docker): Dockerfile 최적화 - 의존성 설치 과정을 병합하여 이미지 레이어 개수 감소
hepheir Nov 29, 2025
2e2f272
chore(app.env): `get_json()` 함수에 대한 docstring 추가
hepheir Nov 29, 2025
506a12f
docs: 환경변수 설명에 `ALLOWED_HOSTS` 추가
hepheir Nov 29, 2025
c0519cc
fix(app.views): `HealthCheckAPIView` 에서 연결오류 외의 `DatabaseError` 도 다루도…
hepheir Nov 29, 2025
5abc80d
test(app.tests): add tests for handling `DatabaseError` and `Interfac…
hepheir Nov 29, 2025
211ee01
fix(app.views): handle unexpected errors in `HealthCheckAPIView` inst…
hepheir Nov 29, 2025
e9818f5
build(docker-compose): ensure tle-auth-service always restarts
hepheir Nov 29, 2025
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
219 changes: 219 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .dockerignore file includes a typo in the file extension pattern *.py[codz] which should be *.py[cod]. The pattern is meant to ignore compiled Python files (.pyc, .pyo, .pyd), but z is not a valid Python compiled extension.

Suggested change
*.py[codz]
*.py[cod]

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 패턴은 GitHub에서 공식적으로 제공하는 Python.gitignore 에서 가져온 것입니다. 또한 .gitignore 문법상으로도 유효한 패턴이므로 본 제안은 기각합니다.

*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py.cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
# Pipfile.lock

# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# uv.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
# poetry.lock
# poetry.toml

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
# pdm.lock
# pdm.toml
.pdm-python
.pdm-build/

# pixi
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
# pixi.lock
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
# in the .venv directory. It is recommended not to include this directory in version control.
.pixi

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# Redis
*.rdb
*.aof
*.pid

# RabbitMQ
mnesia/
rabbitmq/
rabbitmq-data/

# ActiveMQ
activemq-data/

# SageMath parsed files
*.sage.py

# Environments
.env
.envrc
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
# .idea/

# Abstra
# Abstra is an AI-powered process automation framework.
# Ignore directories containing user credentials, local state, and settings.
# Learn more at https://abstra.io/docs
.abstra/

# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc

# Marimo
marimo/_static/
marimo/_lsp/
__marimo__/

# Streamlit
.streamlit/secrets.toml

# Dot files
.*
Copy link

Copilot AI Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security best practice: The static files are being served by Django in DEBUG mode, but the static files directory (.static) is not excluded from the Docker image. This could lead to stale static files being included in the image. Consider adding .static/ to .dockerignore to prevent build-time static files from being included.

Copilot uses AI. Check for mistakes.
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ cython_debug/
.abstra/

# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/

Expand All @@ -214,3 +214,8 @@ __marimo__/

# Streamlit
.streamlit/secrets.toml

# Dot files
.*
!.dockerignore
!.gitignore
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM python:3.11-slim

# Set the working directory inside the container
WORKDIR /app

# Set environment variables
# Prevents Python from writing pyc files to disk
ENV PYTHONDONTWRITEBYTECODE=1
# Prevents Python from buffering stdout and stderr
ENV PYTHONUNBUFFERED=1

# Copy the Django project and install dependencies
COPY requirements.txt /app/

# Run this command to install all dependencies
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
apt-get update && \
apt-get install -y curl && \
rm -rf /var/lib/apt/lists/*

COPY . /app/

# Create non-root user
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser

# Schedule health check
HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=3 CMD ["curl", "--silent", "--fail", "http://localhost:8000/health/"]

# Run server
ENTRYPOINT ["bash", "/app/entrypoint.sh"]
CMD ["--bind", "0.0.0.0:8000", "--workers", "4", "--threads", "2"]
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing database migrations step. Django applications typically need to run python manage.py migrate before starting the server. Without this, the container will fail if any models require database tables. Consider adding a migration command before starting gunicorn, either in an entrypoint script or by using a compound command like: CMD ["sh", "-c", "python manage.py migrate && gunicorn app.wsgi:application --bind 0.0.0.0:8000 --workers 4 --threads 2"]

Suggested change
CMD ["--bind", "0.0.0.0:8000", "--workers", "4", "--threads", "2"]
CMD ["sh", "-c", "python manage.py migrate && gunicorn app.wsgi:application --bind 0.0.0.0:8000 --workers 4 --threads 2"]

Copilot uses AI. Check for mistakes.
Loading