Skip to content

docs (generators): heroku setup manually #2304

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

Merged
merged 4 commits into from
Oct 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 33 additions & 12 deletions docs/generators/heroku.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,47 @@
### Heroku

Deploying to heroku only takes a few steps.
#### Setup
You need a [Heroku](www.heroku.com) account and have the [Heroku Toolbelt](https://devcenter.heroku.com/articles/getting-started-with-nodejs#set-up) installed.

Create an app on Heroku and give it a name (e.g. myapp) :
```
yo angular-fullstack:heroku
heroku apps:create myapp
```
You can also use Heroku dashboard to create an app.

To work with your new heroku app using the command line, you will need to run any `heroku` commands from the `dist` folder.
If you're using mongoDB you will need to add a database to your app (e.g. [mlab](https://mlab.com/) or [compose](https://www.compose.com/mongodb)):
Here we use mlab:
```
heroku addons:create mongolab
```

Now, build your app by running:
```
gulp build
```
This creates a folder called `dist`.

If you're using mongoDB you will need to add a database to your app:
Now go to `dist` and set it up as a git repository:
```
git init
```

Add Heroku's app as your `dist` folder's remote repository:
```
heroku addons:create mongolab
heroku git:remote -a myapp
```

Note: if you get an `Error: No valid replicaset instance servers found` you need to modify moongose connection options in config/environment/production.js as follows:
It is time to push your local repository to Heroku. From your app's root run:
```
gulp buildcontrol:heroku
```

Your app should be live now. To view your app run:
```
heroku open
```

Note on MongoDB setup: if you get an `Error: No valid replicaset instance servers found` you need to modify moongose connection options in config/environment/production.js as follows:
```
options: {
db: {
Expand All @@ -25,10 +51,8 @@ options: {
}
}
```
One of the odd things about the Node driver is that the default timeout for replica set connections is only 1 second, so make sure you're setting it to something more like 30s like in this example.


Your app should now be live. To view it run `heroku open`.
One of the odd things about the Node driver is that the default timeout for replica set connections is only 1 second, so make sure you're setting it to something more like 30s like in this example.

>
> If you're using any oAuth strategies, you must set environment variables for your selected oAuth. For example, if we're using **Facebook** oAuth we would do this :
Expand All @@ -47,16 +71,13 @@ Your app should now be live. To view it run `heroku open`.
> ```
>

To make your deployment process easier consider using [grunt-build-control](https://github.com/robwierzbowski/grunt-build-control).

#### Pushing Updates

```
gulp build
```

Commit and push the resulting build, located in your dist folder:

```
gulp buildcontrol:heroku
```