-
Clone the template
# You can use either the Vapor Toolbox, or just git clone directly. $ vapor new YourApp --template=vzsg/heroku-vapor-template # Or: $ git clone https://github.com/vzsg/heroku-vapor-template YourApp $ cd YourApp $ rm -rf .git # detach folder from template repo $ git init # start new Git repo # Optional: edit Package.swift - change "VaporApp" to whatever you like
-
Create a Heroku application
# Append --region=eu if you want to use the EU region $ heroku apps:create your-heroku-app-name
-
Set up buildpack
$ heroku buildpacks:set vapor/vapor
-
Add a free database
$ heroku addons:create heroku-postgresql:hobby-dev
-
Commit and push
$ git add . $ git commit -m "Initial commit" $ git push heroku master
-
Test if it's working
$ heroku open
- PostgreSQL is used instead of SQLite, which is configured with the
DATABASE_URL
environment variable if provided. The configuration is compatible with both the free and paid plans of Heroku Postgres. - The provided Procfile ensures that all required command line parameters are passed to the app.
- The HSTSMiddleware automatically redirects HTTP calls to their HTTPS equivalents.