diff --git a/.github/workflows/elastic-beanstalk-deploy-prod b/.github/workflows/elastic-beanstalk-deploy-prod deleted file mode 100644 index 5dc20dd..0000000 --- a/.github/workflows/elastic-beanstalk-deploy-prod +++ /dev/null @@ -1,38 +0,0 @@ -name: Deploy to AWS Elastic Beanstalk - -on: - push: - branches: - - main - - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install AWS CLI - run: pip install awsebcli - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION }} - - - name: Deploy to Elastic Beanstalk - run: | - eb deploy ${{ secrets.ENVIRONMENT_NAME }} --profile default - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: ${{ secrets.AWS_REGION }} diff --git a/.github/workflows/elastic-beanstalk-deploy-prod.yaml b/.github/workflows/elastic-beanstalk-deploy-prod.yaml new file mode 100644 index 0000000..94ed62a --- /dev/null +++ b/.github/workflows/elastic-beanstalk-deploy-prod.yaml @@ -0,0 +1,67 @@ +name: Deploy to AWS Elastic Beanstalk Dev + +on: + push: + branches: + - main + + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ 3.12 ] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install black ruff + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - name: Run Black + run: black --check web/project + + - name: Run Ruff + run: ruff check web/project + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Copy Elastic Beanstalk Config + run: | + mkdir -p .elasticbeanstalk + echo "${{ secrets.EB_CONFIG }}" > .elasticbeanstalk/config.yml + + - name: Generate Deployment Package + run: | + mkdir -p deploy + zip -r deploy/deploy.zip . + + - name: Get current time + uses: 1466587594/get-current-time@v2 + id: current-time + with: + format: YYYY-MM-DDTHH-mm-ss + utcOffset: "+09:00" + + - name: Beanstalk Deploy + uses: einaregilsson/beanstalk-deploy@v22 + with: + aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + application_name: duofinder + environment_name: ${{ secrets.ENVIRONMENT_NAME }} + version_label: github-action-${{steps.current-time.outputs.formattedTime}} + region: ap-northeast-2 + deployment_package: deploy/deploy.zip diff --git a/README.md b/README.md index 9e8b964..36a8a47 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ## Development Guide ```bash -git clone https://github.com/boostcampaitech6/level2-3-recsys-finalproject-recsys-05.git duofinder +git clone https://github.com/duofinderkr/web.git duofinder cd duofinder/web ``` diff --git a/poetry.lock b/poetry.lock index 29882a0..16db23f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -123,6 +123,17 @@ files = [ [package.extras] tests = ["mypy (>=0.800)", "pytest", "pytest-asyncio"] +[[package]] +name = "async-timeout" +version = "4.0.3" +description = "Timeout context manager for asyncio programs" +optional = false +python-versions = ">=3.7" +files = [ + {file = "async-timeout-4.0.3.tar.gz", hash = "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f"}, + {file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"}, +] + [[package]] name = "asyncpg" version = "0.29.0" @@ -173,6 +184,9 @@ files = [ {file = "asyncpg-0.29.0.tar.gz", hash = "sha256:d1c49e1f44fffafd9a55e1a9b101590859d881d639ea2922516f5d9c512d354e"}, ] +[package.dependencies] +async-timeout = {version = ">=4.0.3", markers = "python_version < \"3.12.0\""} + [package.extras] docs = ["Sphinx (>=5.3.0,<5.4.0)", "sphinx-rtd-theme (>=1.2.2)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)"] test = ["flake8 (>=6.1,<7.0)", "uvloop (>=0.15.3)"] @@ -598,6 +612,19 @@ files = [ django = ">=3.2.4" sqlparse = ">=0.2" +[[package]] +name = "django-ebhealthcheck" +version = "2.0.2" +description = "Django app to add an instance's public IP to ALLOWED_HOSTS for Elastic Beanstalk's health check system" +optional = false +python-versions = "*" +files = [ + {file = "django_ebhealthcheck-2.0.2-py2.py3-none-any.whl", hash = "sha256:d492a31db8dc6129f8b3dcf970ee5d287f6a7a945688a50e1e9bc0a83cd67ea1"}, +] + +[package.dependencies] +requests = "*" + [[package]] name = "django-environ" version = "0.11.2" @@ -1496,5 +1523,5 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" -python-versions = "^3.12" -content-hash = "0689bb5b135f02ad1a2fc1aaecff6bc01245a664557915539aec720493678aa8" +python-versions = ">=3.11, <3.13" +content-hash = "606098f90518b7a938aeb13f3ffdd6ffe420d01d89bd81d1f4134727dc5680a2" diff --git a/project/project/settings.py b/project/project/settings.py index eea0b53..4713c14 100644 --- a/project/project/settings.py +++ b/project/project/settings.py @@ -57,6 +57,7 @@ "allauth.account", "allauth.socialaccount", "allauth.socialaccount.providers.discord", + "ebhealthcheck.apps.EBHealthCheckConfig", ] SITE_ID = 1 diff --git a/pyproject.toml b/pyproject.toml index f72a15a..1556fcb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = ["nohkwanok "] readme = "README.md" [tool.poetry.dependencies] -python = "^3.12" +python = ">=3.11, <3.13" django = "^5.0.2" jinja2 = "^3.1.3" black = "^24.2.0" @@ -26,6 +26,7 @@ psycopg-binary = "^3.1.18" boto3 = "^1.34.69" python-dotenv = "^1.0.1" django-storages = "^1.14.2" +django-ebhealthcheck = "^2.0.2" [build-system]