Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ env:


install:
# install languages
- nvm install 8.12.0

# install dependencies
- (cd frontend && npm ci --quiet)
- (cd backend && pip install --quiet -r requirements/dev.txt)
- (cd frontend && npm ci)
- (cd backend && pip install -r requirements/dev.txt)

# prepare database
- psql -U postgres -c "CREATE USER \"pah-fm\" WITH PASSWORD 'pah-fm';"
Expand Down
16 changes: 3 additions & 13 deletions backend/pah_fm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,9 @@

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/

if os.environ.get("S3_BUCKET") and os.environ.get("S3_KEY"):
STATICFILES_STORAGE = "django_s3_storage.storage.StaticS3Storage"
S3_BUCKET = os.environ.get("S3_BUCKET")
S3_KEY = os.environ.get("S3_KEY")

AWS_S3_BUCKET_NAME_STATIC = S3_BUCKET
AWS_S3_CUSTOM_DOMAIN = f"{S3_BUCKET}.s3.amazonaws.com"
STATIC_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{S3_KEY}"
else:
STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATICFILES_DIRS = [os.path.join(BASE_DIR, "pah_fm/static")]
STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATICFILES_DIRS = [os.path.join(BASE_DIR, "pah_fm/static")]

# Email settings
EMAIL_HOST = "localhost"
Expand Down
2 changes: 1 addition & 1 deletion backend/requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Pygments==2.3.1
django-countries==5.3.3
django-import-export==2.0.2
serverless-wsgi==1.7.4
psycopg2==2.7.5 --no-binary psycopg2
psycopg2-binary==2.8.5
9 changes: 4 additions & 5 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ docker push codeforpoznan/pah-fm-frontend
docker push codeforpoznan/pah-fm-backend

echo "build and push statics"
(cd frontend && npm run build && cp -r dist ../public)
mkdir public
(cd frontend && npm run build && cp -r dist/* ../public)
(cd backend && python3 manage.py collectstatic --no-input && cp -r static ../public)
aws s3 sync --quiet public s3://codeforpoznan-public/dev_pah_fm
aws s3 sync --delete public s3://codeforpoznan-public/dev_pah_fm
aws cloudfront create-invalidation --paths "/*" --distribution-id EEQ58KIXKBEQ9

echo "bundle application"
pip install --quiet -r backend/requirements/base.txt --target packages
(cd packages && rm -r psycopg2 && svn checkout https://github.com/jkehler/awslambda-psycopg2/trunk/psycopg2-3.6 && mv psycopg2-3.6 psycopg2)
(cd packages && cp psycopg2/_psycopg*.so psycopg2/_psycopg.so) # hotfix
pip install -r backend/requirements/base.txt --target packages
(cd packages && rm -rf *-info && zip -qgr9 ../lambda.zip .)
(cd backend && rm -rf static && zip -qgr9 ../lambda.zip .)

Expand Down