From f933d0e40076e30d56e9fe447c198c726a64d13f Mon Sep 17 00:00:00 2001 From: Fredy Pasaud <fredypasaud@gmail.com> Date: Thu, 10 Mar 2022 13:17:29 +0700 Subject: [PATCH] Deploying to heroku --- .gitignore | 165 ++++++++++++++++++++++++++++++++++++++++++++++- .gitlab-ci.yml | 18 ++++++ Procfile | 2 + db.sqlite3 | Bin 155648 -> 155648 bytes deployment.sh | 3 + requirements.txt | 2 +- 6 files changed, 188 insertions(+), 2 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 Procfile create mode 100644 deployment.sh diff --git a/.gitignore b/.gitignore index 600d2d33..89debfa2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,164 @@ -.vscode \ No newline at end of file +# Created by https://www.gitignore.io/api/python,intellij+iml + +### Intellij+iml ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +### Intellij+iml Patch ### +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# 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/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# dotenv +.env + +# virtualenv +.venv +venv/ +ENV/ + +# Spyder project settings +.spyderproject + +# Rope project settings +.ropeproject + +# End of https://www.gitignore.io/api/python,intellij+iml + +#Ignore files for Lab1 +/lab-1/.idea/ +/lab-1/db.sqlite3/ +/lab-1/hello_name/migrations/*.py + +# Sumimasen, ini khusus buat anak vs +.vscode/ +.vscode + +#ignore chromedriver +chromedriver +chromedriver.exe +/pratikum/static/* + +.DS_Store diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..e2c0399b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,18 @@ +stages: + - deploy + +Deployment: + image: ruby:2.4 + stage: deploy + only: + - master + before_script: + - gem install dpl + - wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh + script: + - dpl --provider=heroku --app=$HEROKU_APPNAME --api-key=$HEROKU_APIKEY + - export HEROKU_API_KEY=$HEROKU_APIKEY + - heroku run --app $HEROKU_APPNAME python manage.py migrate + environment: + name: production + url: $HEROKU_APP_HOST diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..fb9433e7 --- /dev/null +++ b/Procfile @@ -0,0 +1,2 @@ +migrate: bash deployment.sh +web: gunicorn oauthservice.wsgi --log-file - diff --git a/db.sqlite3 b/db.sqlite3 index 34df0b60159dc70d491dec918bd926873b4c78cb..348a8c24c6af11761c21c7216166dd35ffdec1d0 100644 GIT binary patch delta 223 zcmZoTz}awsbAmLZ?L--8M%#@E9r}#y%`f%0ztm@x{vgE8e~*Fx5C3=mPyBEBU+_QX zzqeVi-~>M_3o|Dp`}W8BOo{?R>^zSc`1|-}_*U^*@E+q0;d!*N@eEIW0XrK*Y%Hgv zYkIz6n14#8VNj`sV}@^5wy}3wx__2OSy{Mwm3gICp09bKMM{8WL~4kCL~(?nnW<-3 zeuig+cS>56f3izuVrZUQq(P2vR=!b+foWc)k%5tsu7R<xp@D*dnU#UDm5I5Yv5Bd% Vp>Y8l#72LM&`jg)iM~wpg#ZESMH&DA delta 68 zcmZoTz}awsbAmLZ^+XwGM(d3U9r}!H%`f%0ztm@x{;-{81LGh5Z3av%0s?HjAq@O| Z{4#v2_$+vj@rG<{bl}|{;>)x~2mlJ;6=nbc diff --git a/deployment.sh b/deployment.sh new file mode 100644 index 00000000..c03974f2 --- /dev/null +++ b/deployment.sh @@ -0,0 +1,3 @@ +#!/bin/bash +python manage.py makemigrations +python manage.py migrate diff --git a/requirements.txt b/requirements.txt index be6c414f..d80bd138 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ django -django-rest \ No newline at end of file +djangorestframework \ No newline at end of file -- GitLab