File tree Expand file tree Collapse file tree 3 files changed +36
-13
lines changed Expand file tree Collapse file tree 3 files changed +36
-13
lines changed Original file line number Diff line number Diff line change 6565 selector :
6666 matchLabels :
6767 app : web-editor
68- replicas : 3
68+ replicas : 4
6969 template :
7070 metadata :
7171 labels :
@@ -99,8 +99,8 @@ metadata:
9999 name : web-editor-node
100100 namespace : production
101101spec :
102- maxReplicas : 6
103- minReplicas : 2
102+ maxReplicas : 9
103+ minReplicas : 3
104104 scaleTargetRef :
105105 apiVersion : extensions/v1beta1
106106 kind : Deployment
Original file line number Diff line number Diff line change @@ -15,12 +15,24 @@ const app = new Express();
1515// This also works if you take out the mongoose connection
1616// but i have no idea why
1717const mongoConnectionString = process . env . MONGO_URL ;
18+
1819// 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+
2436mongoose . set ( 'useCreateIndex' , true ) ;
2537mongoose . connection . on ( 'error' , ( ) => {
2638 console . error (
Original file line number Diff line number Diff line change @@ -152,11 +152,22 @@ app.use('/', passportRoutes);
152152require ( './config/passport' ) ;
153153
154154// 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+
160171mongoose . set ( 'useCreateIndex' , true ) ;
161172mongoose . connection . on ( 'error' , ( ) => {
162173 console . error (
You can’t perform that action at this time.
0 commit comments