File tree 3 files changed +36
-13
lines changed
3 files changed +36
-13
lines changed Original file line number Diff line number Diff line change 65
65
selector :
66
66
matchLabels :
67
67
app : web-editor
68
- replicas : 3
68
+ replicas : 4
69
69
template :
70
70
metadata :
71
71
labels :
@@ -99,8 +99,8 @@ metadata:
99
99
name : web-editor-node
100
100
namespace : production
101
101
spec :
102
- maxReplicas : 6
103
- minReplicas : 2
102
+ maxReplicas : 9
103
+ minReplicas : 3
104
104
scaleTargetRef :
105
105
apiVersion : extensions/v1beta1
106
106
kind : Deployment
Original file line number Diff line number Diff line change @@ -15,12 +15,24 @@ const app = new Express();
15
15
// This also works if you take out the mongoose connection
16
16
// but i have no idea why
17
17
const mongoConnectionString = process . env . MONGO_URL ;
18
+
18
19
// Connect to MongoDB
19
- mongoose . Promise = global . Promise ;
20
- mongoose . connect ( mongoConnectionString , {
21
- useNewUrlParser : true ,
22
- useUnifiedTopology : true
23
- } ) ;
20
+ const connectToMongoDB = async ( ) => {
21
+ try {
22
+ await mongoose . connect ( mongoConnectionString , {
23
+ useNewUrlParser : true ,
24
+ useUnifiedTopology : true ,
25
+ useCreateIndex : true ,
26
+ useFindAndModify : false
27
+ } ) ;
28
+ } catch ( error ) {
29
+ console . error ( 'Failed to connect to MongoDB: ' , error ) ;
30
+ process . exit ( 1 ) ;
31
+ }
32
+ } ;
33
+
34
+ connectToMongoDB ( ) ;
35
+
24
36
mongoose . set ( 'useCreateIndex' , true ) ;
25
37
mongoose . connection . on ( 'error' , ( ) => {
26
38
console . error (
Original file line number Diff line number Diff line change @@ -152,11 +152,22 @@ app.use('/', passportRoutes);
152
152
require ( './config/passport' ) ;
153
153
154
154
// Connect to MongoDB
155
- mongoose . Promise = global . Promise ;
156
- mongoose . connect ( mongoConnectionString , {
157
- useNewUrlParser : true ,
158
- useUnifiedTopology : true
159
- } ) ;
155
+ const connectToMongoDB = async ( ) => {
156
+ try {
157
+ await mongoose . connect ( mongoConnectionString , {
158
+ useNewUrlParser : true ,
159
+ useUnifiedTopology : true ,
160
+ useCreateIndex : true ,
161
+ useFindAndModify : false
162
+ } ) ;
163
+ } catch ( error ) {
164
+ console . error ( 'Failed to connect to MongoDB: ' , error ) ;
165
+ process . exit ( 1 ) ;
166
+ }
167
+ } ;
168
+
169
+ connectToMongoDB ( ) ;
170
+
160
171
mongoose . set ( 'useCreateIndex' , true ) ;
161
172
mongoose . connection . on ( 'error' , ( ) => {
162
173
console . error (
You can’t perform that action at this time.
0 commit comments