From 7efe0825542fda9594e5d3fa653fa1e6dc6a1dec Mon Sep 17 00:00:00 2001 From: cdpath Date: Mon, 14 May 2018 15:47:14 +0800 Subject: [PATCH] Deploy to Heroku (#117) * Specify Node.js version * Deploy to Heroku --- Dockerfile | 4 ++-- Procfile | 1 + app.json | 39 +++++++++++++++++++++++++++++++++++++++ config.js | 4 ++-- docs/install/README.md | 6 +++++- package.json | 3 +++ 6 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 Procfile create mode 100644 app.json diff --git a/Dockerfile b/Dockerfile index 275be4503cd378..0a61d30b8d6c0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM keymetrics/pm2:8-alpine ENV NODE_ENV production WORKDIR /usr/src/app COPY ["package.json", "./"] -RUN yarn --prod -s && mv node_modules ../ +RUN yarn --ignore-engines --prod -s && mv node_modules ../ COPY . . EXPOSE 1200 -CMD pm2-runtime start process.json \ No newline at end of file +CMD pm2-runtime start process.json diff --git a/Procfile b/Procfile new file mode 100644 index 00000000000000..1da0cd6f6dce4b --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: node index.js diff --git a/app.json b/app.json new file mode 100644 index 00000000000000..8ad1353633cd4d --- /dev/null +++ b/app.json @@ -0,0 +1,39 @@ +{ + "name": "RSSHub", + "description": "Connect the world with RSS", + "repository": "https://github.com/DIYgod/RSSHub", + "website": "https://rsshub.js.org/", + "logo": "https://i.imgur.com/NZpRScX.png", + "keywords": ["RSS"], + "env": { + "PORT": { + "value": "80", + "required": false + }, + "PIXIV_USERNAME": { + "required": false + }, + "PIXIV_PASSWORD": { + "required": false + }, + "DISQUS_API_KEY": { + "required": false + }, + "TWITTER_CONSUMER_KEY": { + "required": false + }, + "TWITTER_CONSUMER_SECRET": { + "required": false + }, + "TWITTER_ACCESS_TOKEN": { + "required": false + }, + "TWITTER_ACCESS_TOKEN_SECRET": { + "required": false + }, + "YOUTUBE_KEY": { + "required": false + } + } +} + diff --git a/config.js b/config.js index 472a546c1d2fdc..2b528ee7af0af6 100644 --- a/config.js +++ b/config.js @@ -1,5 +1,5 @@ module.exports = { - port: 1200, + port: process.env.PORT || 1200, cacheType: 'memory', // support memory and redis, set empty to disable cache cacheExpire: 5 * 60, ua: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36', @@ -21,4 +21,4 @@ module.exports = { youtube: { key: process.env.YOUTUBE_KEY } -}; \ No newline at end of file +}; diff --git a/docs/install/README.md b/docs/install/README.md index 2df85913afa538..3ddf9de8da3599 100644 --- a/docs/install/README.md +++ b/docs/install/README.md @@ -30,4 +30,8 @@ `twitter`: [申请地址](https://apps.twitter.com) -`youtube`: [申请地址](https://console.developers.google.com/) \ No newline at end of file +`youtube`: [申请地址](https://console.developers.google.com/) + +## 部署到 Heroku +[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) + diff --git a/package.json b/package.json index ce5871638487e5..a50b0a347d4831 100644 --- a/package.json +++ b/package.json @@ -41,5 +41,8 @@ "readall": "1.0.0", "twit": "2.2.9", "winston": "3.0.0-rc3" + }, + "engines": { + "node": ">=10.0.0" } }