📖 updated deployment with heroku

This commit is contained in:
Abdullah Adeel 2022-01-15 19:54:32 +05:00
parent 2d20199c8c
commit 3a126ea2af

View File

@ -8,21 +8,61 @@ Script
Run these commands to deploy the project to Heroku:
.. code-block:: bash
#. Create app on Heroku ::
heroku create --buildpack heroku/python
heroku addons:create heroku-postgresql:hobby-dev
#. Database setup
#. Postgres
.. code-block:: bash
# Postgres
# On Windows use double quotes for the time zone, e.g.
# heroku pg:backups schedule --at "02:00 America/Los_Angeles" DATABASE_URL
heroku pg:backups schedule --at '02:00 America/Los_Angeles' DATABASE_URL
heroku pg:promote DATABASE_URL
#. MySQL
To add mysql to yout app when deploying it on heroku, you have to add it through some add-on that support MySQL.
Check the full list of add-ons on `Heroku Add-ons`_. Here **JAWSDB Add-ons** is being used.
.. code-block:: bash
heroku addons:create jawsdb --app <name_of_your_app>
# or
heroku addons:create jawsdb --app <name_of_your_app> --version=<your_desired_mysql_version>
# once database is delployed, you can run the following command to get the connection url,
heroku config:get JAWSDB_URL
>> mysql://username:password@hostname:port/default_schema
# backups
heroku addons:create jawsdb --bkpwindowstart 00:30 --bkpwindowend 01:00 --mntwindowstart Tue:23:30 --mntwindowend Wed:00:00 --app <name_of_your_app>
# To find more about jawsdb backups
# https://devcenter.heroku.com/articles/jawsdb#backup-import-data-from-jawsdb-or-another-mysql-database
#. Redis connection setup
.. code-block:: bash
heroku addons:create heroku-redis:hobby-dev
#. Mailgun
.. code-block:: bash
# Assuming you chose Mailgun as mail service (see below for others)
heroku addons:create mailgun:starter
#. Setting up environment variables
.. code-block:: bash
heroku config:set PYTHONHASHSEED=random
heroku config:set WEB_CONCURRENCY=4
@ -46,6 +86,10 @@ Run these commands to deploy the project to Heroku:
# Assign with AWS_STORAGE_BUCKET_NAME
heroku config:set DJANGO_AWS_STORAGE_BUCKET_NAME=
#. Deploying
.. code-block:: bash
git push heroku master
heroku run python manage.py createsuperuser
@ -54,6 +98,8 @@ Run these commands to deploy the project to Heroku:
heroku open
.. _Heroku Add-ons: https://elements.heroku.com/addons
Notes
-----