feathersjs / docs

[MOVED] Legacy Feathers documentation
https://crow.docs.feathersjs.com/
MIT License
242 stars 531 forks source link

Write a guide on deploying to Heroku #66

Closed ekryski closed 6 years ago

niallobrien commented 8 years ago

I can probably tackle this one as I plan on using Heroku in the near future.

ekryski commented 8 years ago

That would be sweet!

SirFixAL0t commented 8 years ago

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.

brec-c commented 8 years ago

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.

ekryski commented 8 years ago

@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.

brec-c commented 8 years ago

i haven't tried. Sorry.

ekryski commented 8 years ago

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.

brec-c commented 8 years ago

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.

ekryski commented 8 years ago

@brec-c yup you got it mate! I have a proper guide coming as I just did a fresh deploy a couple days ago.

thejones commented 8 years 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.

olowe commented 8 years ago

@ekryski How's the guide coming?

arashsa commented 8 years ago

@ekryski Still working on the guide?

ekryski commented 8 years ago

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.

alexventuraio commented 8 years ago

Why do I need to do this NODE_ENV with value “development” I want my app to be in production.

clorichel commented 7 years ago

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.

daffl commented 6 years ago

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.

steffanhalvorsen commented 4 years ago

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.

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.

edksam commented 3 years ago

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 :Screenshot from 2021-01-18 12-00-38 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.

jpdh9881 commented 3 years ago

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

anon-000 commented 3 years ago

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.

challlluunyyyyyyyyy