Skip to content

Commit 9febb40

Browse files
authored
Merge pull request #4 from golony6449/feature/setup
github action (w/ zappa)로 배포하기
2 parents 8801ed5 + d2cd8bc commit 9febb40

File tree

7 files changed

+59
-16
lines changed

7 files changed

+59
-16
lines changed

.github/workflows/deploy_on_dev.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python-version: [3.8]
13+
python-version: [3.9]
1414

1515
steps:
1616
- uses: actions/checkout@v2
@@ -42,17 +42,18 @@ jobs:
4242
4343
- name: Create Virtualenv
4444
run: |
45-
virtualenv pyconweb2022-zappa
45+
virtualenv zappa-env
4646
4747
# - name: Activate Virtualenv
4848
# run: |
49-
# source ./pyconweb2022-zappa/bin/activate
49+
# source ./zappa-env/bin/activate
5050

5151
- name: Install dependencies
5252
run: |
53-
source ./pyconweb2022-zappa/bin/activate
53+
source ./zappa-env/bin/activate
5454
python -m pip install --upgrade pip
5555
pip install pytest
56+
pip install zappa
5657
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
5758
5859
# Pull request dose not get the gitub action secrets
@@ -69,14 +70,13 @@ jobs:
6970
7071
- name: Test with Django Test
7172
run: |
72-
source ./pyconweb2022-zappa/bin/activate
73-
cd pyconweb2022
73+
source ./zappa-env/bin/activate
7474
python manage.py test
7575
76-
- name: Test with pytest
77-
run: |
78-
source ./pyconweb2022-zappa/bin/activate
79-
pytest pyconweb2022
76+
# - name: Test with pytest
77+
# run: |
78+
# source ./zappa-env/bin/activate
79+
# pytest pyconweb2022
8080

8181
- name: Configure AWS Credentials
8282
uses: aws-actions/configure-aws-credentials@v1
@@ -90,7 +90,6 @@ jobs:
9090
AWS_ACCESS_KEY_ID: ${{ secrets.PYCON_DEV_2021_AWS_KEY }}
9191
AWS_SECRET_ACCESS_KEY: ${{ secrets.PYCON_DEV_2021_AWS_SECRET }}
9292
run: |
93-
source ./pyconweb2022-zappa/bin/activate
94-
cd pyconweb2022
95-
zappa update dev
93+
source ./zappa-env/bin/activate
94+
zappa update dev2023
9695
# zappa manage dev collectstatic
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Pull Request Merge Precondition
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: [3.8]
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: psf/black@stable
16+
with:
17+
options: "--check --verbose"

pyconkr/settings-dev.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,10 @@
1313
"PORT": os.getenv("AWS_RDS_PORT"),
1414
}
1515
}
16+
17+
# django-storages: S3
18+
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
19+
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage'
20+
AWS_S3_ACCESS_KEY_ID = os.getenv("AWS_S3_ACCESS_KEY_ID")
21+
AWS_S3_SECRET_ACCESS_KEY = os.getenv("AWS_S3_SECRET_ACCESS_KEY")
22+
AWS_STORAGE_BUCKET_NAME = "pyconkr-api-v2-static-dev"

pyconkr/settings-prod.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,10 @@
1313
"PORT": os.getenv("AWS_RDS_PORT"),
1414
}
1515
}
16+
17+
# django-storages: S3
18+
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
19+
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage'
20+
AWS_S3_ACCESS_KEY_ID = os.getenv("AWS_S3_ACCESS_KEY_ID")
21+
AWS_S3_SECRET_ACCESS_KEY = os.getenv("AWS_S3_SECRET_ACCESS_KEY")
22+
AWS_STORAGE_BUCKET_NAME = "pyconkr-api-v2-static"

pyconkr/settings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,16 @@
106106
# Internationalization
107107
# https://docs.djangoproject.com/en/4.1/topics/i18n/
108108

109-
LANGUAGE_CODE = "en-us"
109+
LANGUAGE_CODE = "ko-KR"
110110

111-
TIME_ZONE = "UTC"
111+
TIME_ZONE = "Asia/Seoul"
112112

113113
USE_I18N = True
114114

115115
USE_TZ = True
116116

117117

118-
# Static files (CSS, JavaScript, Images)
118+
# Static files (CSS, JavaScript, Images) (w/ django-storages)
119119
# https://docs.djangoproject.com/en/4.1/howto/static-files/
120120

121121
STATIC_URL = "static/"

requirements.txt

-242 Bytes
Binary file not shown.

update_secret.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
# REPO_BASE_URL="github.com/pythonkr/pyconkr-secrets.git"
4+
# REPO_URL="https://${REPO_BASE_URL}"
5+
REPO_URL="[email protected]:pythonkr/pyconkr-secrets.git"
6+
7+
# checkout repo from github
8+
mkdir -p .temp
9+
pushd .temp
10+
git clone --depth=1 ${REPO_URL}
11+
rsync -arv ./pyconkr-secrets/pyconkr-api-v2/ ..
12+
popd
13+
rm -rf ./.temp

0 commit comments

Comments
 (0)