You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/generators/heroku.md
+33-12
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,47 @@
1
1
### Heroku
2
2
3
-
Deploying to heroku only takes a few steps.
3
+
#### Setup
4
+
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.
4
5
6
+
Create an app on Heroku and give it a name (e.g. myapp) :
5
7
```
6
-
yo angular-fullstack:heroku
8
+
heroku apps:create myapp
7
9
```
10
+
You can also use Heroku dashboard to create an app.
8
11
9
-
To work with your new heroku app using the command line, you will need to run any `heroku` commands from the `dist` folder.
12
+
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)):
13
+
Here we use mlab:
14
+
```
15
+
heroku addons:create mongolab
16
+
```
10
17
18
+
Now, build your app by running:
19
+
```
20
+
gulp build
21
+
```
22
+
This creates a folder called `dist`.
11
23
12
-
If you're using mongoDB you will need to add a database to your app:
24
+
Now go to `dist` and set it up as a git repository:
25
+
```
26
+
git init
27
+
```
13
28
29
+
Add Heroku's app as your `dist` folder's remote repository:
14
30
```
15
-
heroku addons:create mongolab
31
+
heroku git:remote -a myapp
16
32
```
17
33
18
-
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:
34
+
It is time to push your local repository to Heroku. From your app's root run:
35
+
```
36
+
gulp buildcontrol:heroku
37
+
```
38
+
39
+
Your app should be live now. To view your app run:
40
+
```
41
+
heroku open
42
+
```
43
+
44
+
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:
19
45
```
20
46
options: {
21
47
db: {
@@ -25,10 +51,8 @@ options: {
25
51
}
26
52
}
27
53
```
28
-
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.
29
-
30
54
31
-
Your app should now be live. To view it run `heroku open`.
55
+
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.
32
56
33
57
>
34
58
> 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 :
@@ -47,16 +71,13 @@ Your app should now be live. To view it run `heroku open`.
47
71
> ```
48
72
>
49
73
50
-
To make your deployment process easier consider using [grunt-build-control](https://github.com/robwierzbowski/grunt-build-control).
51
-
52
74
#### Pushing Updates
53
75
54
76
```
55
77
gulp build
56
78
```
57
79
58
80
Commit and push the resulting build, located in your dist folder:
0 commit comments