-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Q: "node app.js" doesn't work after "grunt build" command #590
Comments
This generator has two deploy options built in: openshift and heroku. The best thing to do would be to add targets to buildcontrol task if you're using a different service, e.g. azure. |
On the production server you need to setup your environment properly. There are a lot of ways to do this, depending on what type of server you're on. @JaKXz has it right if you're using that kind of service. I'd also add that if you're just trying to get it to run from your development server, you might try running it like this:
That will set the If you're deploying to a stand-alone linux box (perhaps a VPS) then I have a blog post that describes how I recently deployed a project built by this generator to an Ubuntu VPS. |
Thanks @JaKXz , Indeed the Heroku build-control is working fine and it does a good job ( But again my question is how can I run my project from the "/dist" folder on my production server? I'm using an Amazon Server (EC2).
I find crazy that deploy the "dist/" folder to the server won't work, or the crazy one is me? |
@mescalito check out #501. There's good info in there about using |
@mescalito I too would expect running |
@mescalito, @Awk34 there are two way that are very simple to use when deploying a built project locally:
The main thing to point out is the Hope that gets you guys going :) |
I think the I find very stupid that I can't just commit and deploy the I love you so much but please stop being intrusive over my Your build-control for Heroku and the other is great but there is more than that out there and we can depend on build-control to deploy to every fricking cloud. PLEASE!!! Just give me a deployable |
The "excuse" is with one build you can produce a |
As mentioned, there is a working recipe in #501, so I'm going to close this issue as well and welcome a PR for the grunt-ec2 task. |
I think we should make the server launchable into development mode from the dist folder without setting the node environment. It would be very easy to do: just rename the references to the You still should be starting your app environment to production mode when its deployed, but it would make it a little easier to test out. |
@remicastaing in that way you should be able to config what you are talking about (multiple instances) from the grunt file. For my having a ENV file for each cloud-server is over kill. I prefer to use multiple GIT branches and merge master into. The problem is that the Generator doesn't know where to stop and what is the line where their job ends. |
@mescalito I see what you are saying, however there are others who think that the generator should do more; this is likely not an easy debate. Also I understand that in your case the style of this generator has inconvenienced your workflow. If you don't mind, could you describe to me (and others) what you see as an acceptable solution for configuring your app's settings? I'm hoping we can work together to possibly find a way that meets your needs and those of others. I like it when everybody wins :) Thanks for the feedback. |
I was thinking of filling some infos on client side during the build process (cf. #605). Perhaps the same principle could be applied for @mescalito need.
during the build process. |
@mescalito I noticed how you use GIT to manage your different configs(?) thats a really good use of git I think :) I'm wondering how you typically deploy a node application? Something like this: |
@kingcody Before finding Grunt I used multiple GIT branches to manage all my servers (production, staging, testing, etc). Each branch has its own config/ENV file independently with the DB, oAuth, etc. information and the proper "gitignore" file. @remicastaing I had no idea the existence of the |
I just can't figure out how to get the app to set environment variables in production mode. I've read a lot here and tried a lot. Somehow editing my .bash_profile (or something else?) managed to set my FACEBOOK_ID and secret to their api keys, and the NODE_ENV to production using a bash method described in #501 but the same method doesn't work for TWITTER_CONSUMER_ID or DOMAIN... (although somehow my app seems to be getting the domain accurately in another way). IF I hard code my Twitter API's into the ./config/environment/index section as the default value, my Twitter Oauth is working pretty well. I'm just not sure what I'm missing ... I tried using require('.config/local.env') at the beginning of app.js as kingcody suggested in #513 but it didn't work. I guess I'd just like to be able to set api keys and stuff from a .env file . I'm fairly(very) clueless on what happens if a web site starts getting traffic and requires multiple instances and unsure about whether I should be setting environment variables for each instance vih bash or shel or etc or if having them in a file (not tracked on a cloud git repo) is better ?? Thanks for any help. FWIW , I'm grateful for the generous work you guys have shared with AFS . I'm also satisfied enough with creating a production dist file with grunt serve:dist on my laptop and then cutting and pasting the files into a local "dist"-only repo where I can edit a few things then push. (I bet I could get rid of a lot of dev dependencies that are still getting included in dist huh? ) |
thanks for your time! I'm new using yeoman so i don't know what is exactly going on .
When using the
grunt build
command everything seems to works fine and the "/dist" folder is generated ok, but why thenode app.js
command doesn't fully work inside the "/dist/server" folder?To make my app working on the "/dist" folder I have to open file app.js and then in like no.8 change 'development' into 'production'
File app.js line no.8
After digging into the grunt.js I realized I can run this command
grunt serve:dist
and then the server seems to work fine, but obviously I won't have that option into my production server, I just want the "/dist" folder.The text was updated successfully, but these errors were encountered: