Keep going with my idea to use Saleor with my wife's e-commerce, I need to deploy the app at Heroku. The Saleor Docs is not the best one, but it give me a path to reach it. After many tries I ended with the steps of how to deploy Saleor at Heroku.
First, I removed the git remote from Saleor:
$git remote -v output ... origin https://github.com/mirumee/saleor.git (fetch) origin https://github.com/mirumee/saleor.git (push) ... $git remote remove origin
Now, the git remote server doesn't exist anymore. So let's create a Heroku app and add the git from this app for future deploys.
If you don't have the Heroku CLI, check how to install to your platform here Heroku CLI.
$heroku apps:create MYAPP_NAME Creating ⬢ MYAPP_NAME... done https://MYAPP_NAME.herokuapp.com/ | https://git.heroku.com/MYAPP_NAME.git
If you check with
git remote -v, you'll see that the above command created the app and add the git to your current directory.
Now follow the commands bellow to deploy to Heroku:
Setting the Buildpacks at heroku to deploy the App, first the nodejs buildpack
$heroku buildpacks:add --index 1 heroku/nodejs Buildpack added. Next release on feltro-store will use heroku/nodejs. Run git push heroku master to create a new release using this buildpack.
And now the python buildpack
$heroku buildpacks:add --index 2 https://github.com/heroku/heroku-buildpack-python.git Buildpack added. Next release on MYAPP_NAME will use https://github.com/heroku/heroku-buildpack-python.git. Run git push heroku master to create a new release using this buildpack.
heroku buildpacks to see the buildpacks that will be uses by Heroku in the deploys.
Install Postgres Database
$heroku addons:create heroku-postgresql Creating heroku-postgresql on ⬢ MYAPP_NAME... free Database has been created and is available ! This database is empty. If upgrading, you can transfer ! data from another database with pg:copy Created postgresql-adjacent-10925 as DATABASE_URL Use heroku addons:docs heroku-postgresql to view documentation
Install Redis - A in-memory data structure store, cache and message broker...
$heroku addons:create heroku-redis reating heroku-redis on ⬢ MYAPP_NAME... free Your add-on should be available in a few minutes. ! WARNING: Data stored in hobby plans on Heroku Redis are not persisted. redis-tapered-60545 is being created in the background. The app will restart when complete...
Install Bonsai Elasticsearch for fast search in your site:
$heroku addons:create bonsai:sandbox-10 Creating bonsai:sandbox-10 on ⬢ MYAPP_NAME... free Thanks for adding Bonsai! Please log in to the Bonsai dashboard to finalize your account setup. Use `heroku addons:open bonsai` to view the dashboard. Created bonsai-tetrahedral-23283 as BONSAI_URL Use heroku addons:docs bonsai to view documentation
Install SendGrid - Email Delivery. Simplified.
$heroku addons:create sendgrid:starter Creating sendgrid:starter on ⬢ MYAPP_NAME... free Created sendgrid-octagonal-79001 as SENDGRID_PASSWORD, SENDGRID_USERNAME Use heroku addons:docs sendgrid to view documentation
Set the SECRET_KEY at Heroku
$heroku config:set SECRET_KEY='COPY_YOUR SECRET FROM SETTINGS.PY' Setting SECRET_KEY and restarting ⬢ MYAPP_NAME... done, v7
Set the ALLOWED_HOSTS at Heroku (is not a good idea to set a * at this, but we will correct this later.)
$heroku config:set ALLOWED_HOSTS='*' Setting ALLOWED_HOSTS and restarting ⬢ MYAPP_NAME... done, v9 ALLOWED_HOSTS: *
Setting Debug = True at this time, because if something goes wrong we'll see the log. Don't forget to set this to False later when we finish the deployment.
$heroku config:set DEBUG=True Setting DEBUG and restarting ⬢ MYAPP_NAME... done, v8
Setting some variable to deploy without errors:
$heroku config:set DEFAULT_FROM_EMAILfirstname.lastname@example.org' $heroku config:set DJANGO_SETTINGS_MODULE='saleor.settings' $heroku config:set NODE_ENV='test' $heroku config:set NPM_CONFIG_PRODUCTION='false'
Now hold your breath and let's try the Deploy
$git push heroku master
If everything was ok, let's prepare the database for the first time.
$heroku run python manage.py makemigrations $heroku run python manage.py migrate $heroku run python manage.py createsuperuser
In the next posts I'll explain how to customize your e-commerce. Things like Logo, Language, Categories...