# Heroku

You can deploy 2FAuth to Heroku by clicking the button below:

# Restrictions

Heroku uses an ephemeral filesystem, which means 2FAuth cannot use this file system to store and retrieve the 2FA icons across multiple sessions. For now, the only workaround is to disable icon display in 2FAuth:

Uncheck the Show icons option in the 2FAuth's Settings > Options section

# Configuration

Although the Heroku button tends to ease the installation process, you have to configure some environment variables when creating the apps at Heroku.

# Security keys

2FAuth needs an RSA key pair for Laravel Passport to generate security tokens. Normally, these keys are generated automatically and stored in a 2FAuth subfolder, but the Heroku ephemeral filesystem breaks this behavior. You have to generate the keys on your own and then set the corresponding env vars.

# Generate RSA keys

Run the following command to generate a private private.pem RSA key:

openssl genrsa 

Then derivates a public key public.pem from the newly created private.pem key:

openssl rsa -in private.pem -pubout -out public.pem

# Set Heroku env vars

Set the PASSPORT_PRIVATE_KEY environment var with the content of the private.pem file.
Set the PASSPORT_PUBLIC_KEY environment var with the content of the public.pem file.

They should look like this:

-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4gvRXnfAg7Tve9tZ0NVw
gUXvjevT6bz/n1ujVkWApxPBJNXKBp7MCNkNSJ+zuraqxiQo+zAMPF9DiLqT3MjS
urhmKJdQxAbC9xn/JLiSc5oFojR1ARodReo0f0TRl91pmuPxIEbWurWdmjj3/PpA
DthJ+cSTVmkpoienFkkVOooVdcL86ryA4D9vHZpX/peLpfpwhuuVP//6Egt59a4s
cyOJFK1773COcYT+ssKawollV0p/UgW19jnzHtPlRS77Y8TA7sj6hOO5Qgqv+c0e
xMxkIGCRBT50CHUnoInsEE+Uofzaihe40FF2KDpCAp+AQeL+/W+CHd3AEZsxPlqy
qbEi5onG+9CUWBJzqYRaec6WtxFEICYC1wJ4nGNZO9CaZ9aA5Y8PZMsON32weI2q
Z2hK2v48ucPYRV3dO/H8+xokX73U4dBJT+GU/e8rctWeewnqi9tPc2S2oQs7v3PS
LlGtChc5PFetT+doUE8m/JVvkyT3JzYkOM7FoLnk8sGDp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GjV1NL4brzZXoloHBItLp9N
DEm3eJO1FIydjmjG/r0x2naWINwCjz3AQZD/cJkC+I5BRwNaCKiiiVmUcg3KqA2Q
3oc26a3uc/3QkTPAMcf9QoDbNKeZnbJ0uFdkJk2CkcoZg4zkRPFhU4F6m+8=
-----END RSA PRIVATE KEY-----

# Email

When using the Deploy to Heroku button, you will be prompted to set email vars for a basic SMTP configuration.
It will be appropriate most of the time, but this is not the only possible configuration supported by Laravel.

The Email configuration depends on your email provider. You should refer to its documentation to find the relevant values.
As an example, here is the configuration for an OVH hosting using SSL:

MAIL_HOST=SSL0.OVH.NET
MAIL_PORT=465
MAIL_ENCRYPTION=ssl

Read more about email configuration at https://laravel.com/docs/mail.

# Free resources

2FAuth offers a basic Heroku setup which only uses free resources: A single add-ons, Heroku Postgres with Hobby plan, and a single Web Dyno with NGINX. This way, any Heroku user can deploy the app, even if the user account is not verified.

Be aware that the Postgres has some limitations, but that should not be a problem as 2FAuth has very few database needs.
Read more about the Heroku Postgres plans at devcenter.heroku.com