Skip to content

Commit

Permalink
init: 초기 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
leehjhjhj committed Jul 24, 2023
0 parents commit e337e3e
Show file tree
Hide file tree
Showing 24 changed files with 703 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Deploy to EC2

on:
push:
branches: [ main ]

jobs:
deploy:
name: Deploy to EC2
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: write env file
run: |
echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" > .env
- name: Set up and build Docker Compose
run: |
sudo apt-get update
sudo apt-get -y install docker-compose
docker-compose build
- name: Docker Hub login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker Hub Push
run: |
docker-compose push
- name: Copy docker-compose.yml to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.WAS_HOST }}
username: ec2-user
key: ${{ secrets.KEY }}
source: docker-compose.yml
target: /home/ec2-user/

- name: Connect and Deploy to EC2
uses: appleboy/ssh-action@v0.1.6
with:
host: ${{ secrets.WAS_HOST }}
username: ec2-user
key: ${{ secrets.KEY }}
script: |
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
cd /home/ec2-user/
docker-compose pull # Pull the latest images on EC2
docker-compose up -d # Run the containers on EC2
233 changes: 233 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
# Created by https://www.toptal.com/developers/gitignore/api/windows,django,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,django,macos

### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
db.sqlite3-journal
media
local.py
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
# in your Git repository. Update and uncomment the following line accordingly.
# <django-project-name>/staticfiles/

### Django.Python Stack ###
# Byte-compiled / optimized / DLL files
*.py[cod]
*$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

# Django stuff:

# 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

# 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

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

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

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.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/

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
DS_Store
# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/windows,django,macos
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.9.6

ENV PYTHONUNBUFFERED 1

RUN apt-get -y update && apt-get -y install vim apt-utils && apt-get clean
RUN mkdir /project
ADD . /project

WORKDIR /project

RUN pip install --upgrade pip
RUN pip install -r requirements.txt
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 🚖 QRTaxi - 큐택 서버

## 💻 기술 스택
<div style='flex'>
<img src="https://img.shields.io/badge/Python3.9.5-3776AB?style=for-the-badge&logo=Python&logoColor=white" >
<img src="https://img.shields.io/badge/Django-092E20?style=for-the-badge&logo=Django&logoColor=white">
<ing src="https://camo.githubusercontent.com/4590c0af4aeb1b75233885f86e80c1da8cb2afd401173a40e41370f5cad5db20/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4a57542d626c61636b3f7374796c653d666f722d7468652d6261646765266c6f676f3d4a534f4e253230776562253230746f6b656e73">

<img src="https://camo.githubusercontent.com/c1fc168684171582321954905e8b9dc4f59810243ed85e645f3b7938ee3145cb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d7973716c2d3434373941313f7374796c653d666f722d7468652d6261646765266c6f676f3d6d7973716c266c6f676f436f6c6f723d7768697465">
<img src="https://img.shields.io/badge/Docker-2496ED?style=for-the-badge&logo=Docker&logoColor=white">
<ing src="https://camo.githubusercontent.com/cb6a8acb6cd719636cea6cce9de8a98986f895d0a4da406400db37f4a115604c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f636b6572206875622d3234393645443f7374796c653d666f722d7468652d6261646765266c6f676f3d646f636b6572266c6f676f436f6c6f723d7768697465">
<img src="https://img.shields.io/badge/Amazon EC2-FF9900?style=for-the-badge&logo=Amazon EC2&logoColor=white">
<img src="https://img.shields.io/badge/Amazon RDS-527FFF?style=for-the-badge&logo=Amazon RDS&logoColor=white">
</div>

## 🚖 구성원 및 역할분담

</br>

## 🚖 ERD
<img width="785" alt="" src="">
</br>

## 🚖 API 명세서
<img width="912" alt="6" src="">
</br>

</br>
</br>

## 📌 컨벤션
### 커밋 메세지
- feat: : 새로운 기능 추가/수정/삭제
- refactor : 버그를 수정하거나 기능 추가가 없는 단순 코드 변경
- fix: 버그, 오류 해결
- test: : 테스트 코드
- chore: 빌드 업무 수정, settings.py 수정 등
- docs: Readme를 비롯한 문서 변경시
- init: initial commit을 할 시
- build: 라이브러리 추가 등
- !HOTFIX: 치명적 버그를 급하게 수정할 때

### 네이밍 규칙
- class: Pascal ex) MyClass, PersonInfo
- Variable: Snake ex) user_name, total_count
- Function: Snake ex) calculate_total, get_user_data
- Constant : Pascal + Snake pascal ex) MAX_SIZE, DEFAULT_TIMEOUT
### 주석
- Docstring을 활용하여 클래스와 함수단위에 설명을 적어주도록 하자.
```python
def delete_post(post_id):
"""
모든게시판의 Delete를 담당하는 view
"""
```

### 🚷 큐택 서버 규칙

1. 빠른 개발을 위해 각자 branch에서 `main` 브랜치에 PR을 날려요.
2. PR올리면 카톡으로 알려주고, 그 날 자정까지 확인하고 코드 리뷰를 후 승인 뒤에 `merge`해요.
3. DB 관련된 `model` 코드 수정은 한명이 해요. 모델 수정이 필요하면 공유해요.
4. 커밋 메세지를 잘 지켜요.
5. 주석 및 네이밍 규칙도 잘 지켜요.
6. 한 일과, 해야할 일을 솔직하게 공유해요.

</br>
</br>


3 changes: 3 additions & 0 deletions config/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx:1.22.0-alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
Loading

0 comments on commit e337e3e

Please sign in to comment.