add better Heroku compatibility (#2352)

* use Node/NPM semver range

* use procfile for Heroku auto-deploys

* add Heroku default for empty SERVER_URL

* update README
This commit is contained in:
Amri Toufali 2021-10-20 11:56:09 -07:00 коммит произвёл GitHub
Родитель 355c6c3b77
Коммит fbf3ceecc9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 10 добавлений и 9 удалений

1
Procfile Normal file
Просмотреть файл

@ -0,0 +1 @@
web: npm run build:all && node server.js

Просмотреть файл

@ -199,12 +199,8 @@ Firefox Monitor Breach Alerts is designed with [12-factor](https://12factor.net/
### Deploy on Heroku
You will need to set some required environment variables on Heroku.
We use Heroku apps for dev review only – official stage and production apps are built by the Dockerfile and CircleCI config, with deploy overseen by the Site Reliability Engineering team.
```sh
heroku config:set COOKIE_SECRET=unsafe-cookie-secret-for-heroku
heroku config:set DEBUG_DUMMY_SMTP=1
```
Deploys from the `main` branch to Heroku are automatic. We also employ Heroku's "Review Apps" to check Pull Requests. These are currently set to auto-deploy: you can find the app link in your GitHub Pull Request. Review apps auto-destroy after 2 days of inactivity.
And any others, depending on the features you're running on Heroku - e.g.,
Email or Firefox Accounts.
If you encounter issues with Heroku deploys, be sure to check your environment variables, including those required in `app-constants.js`. Review apps also share a database and you should not assume good data integrity if testing db-related features.

Просмотреть файл

@ -5,6 +5,10 @@
const path = require("path");
require("dotenv").config({path: path.join(__dirname, ".env")});
if (!process.env.SERVER_URL && process.env.NODE_ENV === "heroku") {
process.env.SERVER_URL = `https://${process.env.HEROKU_APP_NAME}.herokuapp.com`;
}
const kEnvironmentVariables = [
"NODE_ENV",
"SERVER_URL",

Просмотреть файл

@ -75,8 +75,8 @@
"sass": "^1.42.1"
},
"engines": {
"node": "14.17",
"npm": "6"
"node": "14.17.x",
"npm": "6.x"
},
"homepage": "https://github.com/mozilla/blurts-server",
"license": "MPL-2.0",