Closed ekryski closed 6 years ago
That would be sweet!
Hey,
I recently started using feathers js and I found this thread. I managed to get the heroku chat example app running on heroku. Here are the steps in case you want to give them a try:
Clone repo: git clone https://github.com/feathersjs/feathers-chat.git Install feathers-cli: npm install -g feathers-cli Create heroku app: heroku create APP.NAME run npm install in your project to make sure all dependencies are downloaded Make sure it runs in local: npm start modify your index.js’s port variable to the following: const port = process.env.PORT || app.get('port');
commit changes and push changes to heroku: git add -A && git commit -m “Adapting app for heroku” && git push heroku master run pm install in your heroku box: heroku run npm install add the following variable to the env: NODE_ENV with value “development”
This should get your app up and running on heroku.
I think we need to update the config/*.json though I'm new enough to feathersjs that I'm not sure what to put where. Any advice?
The above instructions got me 98% of the way there (thanks btw) I just am not getting auth to work while it does work locally.
@brec-c someone else complained about that as well I think. Did you have any success? I'll be able to dig into it next week for sure.
i haven't tried. Sorry.
ok. I'll keep you posted. Some people have successfully deployed to Heroku. I haven't had a chance to do it will all the new stuff that has gone in. Been using Digital Ocean but I have a project coming next week where we are putting it on Heroku.
ok, got it working. It was pretty simple. I only needed to add config vars to the heroku project for the NEDB_BASE_PATH and the FEATHERS_AUTH_SECRET. I just set them to be the same as in the default.json.
There's probably a way to set config vars via the heroku toolbelt cli but I just used the web interface.
Hope that helps.
@brec-c yup you got it mate! I have a proper guide coming as I just did a fresh deploy a couple days ago.
@ekryski Are you on this or would you like some help? If you want help just send me what you have and I will type something up.
@ekryski How's the guide coming?
@ekryski Still working on the guide?
I am yes. It's pretty easy though. Basically set your heroku config vars and your heroku remote like any other NodeJS project and run git push heroku master
.
Why do I need to do this NODE_ENV with value “development”
I want my app to be in production.
Deploying a Feathers (REST only) application to Heroku has just been insanely simple for me, using dpl! After creating an application from the Heroku dashboard, here is what I had to do on my CI tool (GitLab CI) from a node:6
Docker image:
# installing npm dependencies
- npm set progress=false
- npm install --silent
# installing dpl
- apt-get -qq update
- apt-get install -yqq ruby ruby-dev --silent
- gem install dpl
# deploying the app to Heroku!
- dpl --provider=heroku --app=$HEROKU_APP_NAME --api-key=$HEROKU_API_KEY
Your Heroku API key is on your Account page. Both $HEROKU_APP_NAME
and $HEROKU_API_KEY
are Secret Variables configured in the CI tool.
Then, you HAVE TO use Heroku port environment variable in /src/index.js
:
const port = process.env.PORT || app.get('port');
Not sure if it's useful but I changed the host too in the /config/production.json
file for my-application-name.herokuapp.com
.
The latest CLI (npm i -g @feathersjs/cli
) generates an application that is fully compatible with Heroku by just adding a Procfile
like
web: node src/
And setting the NODE_ENV
environment variable to production
. I'd be delighted if anybody would be interested in turning this into a blog post but for now this should do as a reference.
The latest CLI (
npm i -g @feathersjs/cli
) generates an application that is fully compatible with Heroku by just adding aProcfile
likeweb: node src/
And setting the
NODE_ENV
environment variable toproduction
. I'd be delighted if anybody would be interested in turning this into a blog post but for now this should do as a reference.
If using subpaths, make it relative like this:
web: ./node src/
I also had to set NPM_CONFIG_PRODUCTION to false in environment variables to get it work. Else it wont install devDependencies and it wont work.
Please, I am a newbie stuck with deploying my MERN app with feathers
to heroku. It's my project files and I am in dire need of help: Project structure : How do I push the app to heroku? The above speaks of Procfile. Is it in the front end or the backend . If someone's got a complete process I will be grateful.
I had to do two other things to get my app working (I'm using sequelize):
1) in sequelize.js, set connectionString to process.env.DATABASE_URL
2) if there are errors with connecting to the database, check out this SO: https://stackoverflow.com/questions/58965011/sequelizeconnectionerror-self-signed-certificate
Deploying a Feathers (REST only) application to Heroku has just been insanely simple for me, using dpl! After creating an application from the Heroku dashboard, here is what I had to do on my CI tool (GitLab CI) from a
node:6
Docker image:# installing npm dependencies - npm set progress=false - npm install --silent # installing dpl - apt-get -qq update - apt-get install -yqq ruby ruby-dev --silent - gem install dpl # deploying the app to Heroku! - dpl --provider=heroku --app=$HEROKU_APP_NAME --api-key=$HEROKU_API_KEY
Your Heroku API key is on your Account page. Both
$HEROKU_APP_NAME
and$HEROKU_API_KEY
are Secret Variables configured in the CI tool.Then, you HAVE TO use Heroku port environment variable in
/src/index.js
:const port = process.env.PORT || app.get('port');
Not sure if it's useful but I changed the host too in the
/config/production.json
file formy-application-name.herokuapp.com
.
challlluunyyyyyyyyy
I can probably tackle this one as I plan on using Heroku in the near future.