fixed setup for kuberneetes
This commit is contained in:
		
							parent
							
								
									ce270f3057
								
							
						
					
					
						commit
						ef72400656
					
				
					 5 changed files with 34 additions and 7 deletions
				
			
		|  | @ -41,21 +41,27 @@ public class SEBServerMigrationStrategy implements FlywayMigrationStrategy { | ||||||
|     @Override |     @Override | ||||||
|     public void migrate(final Flyway flyway) { |     public void migrate(final Flyway flyway) { | ||||||
|         try { |         try { | ||||||
|  | 
 | ||||||
|             // If we are in a distributed setup only apply migration task if this is the master service |             // If we are in a distributed setup only apply migration task if this is the master service | ||||||
|             if (this.webserviceInfo.isDistributed() |             // or if there was no data base initialization yet at all. | ||||||
|                     && !this.webserviceInfoDAO.isMaster(this.webserviceInfo.getWebserviceUUID())) { |             if (this.webserviceInfo.isDistributed()) { | ||||||
|  |                 if (this.webserviceInfoDAO.isInitialized()) { | ||||||
|  |                     final boolean isMaster = this.webserviceInfoDAO.isMaster(this.webserviceInfo.getWebserviceUUID()); | ||||||
|  |                     if (!isMaster) { | ||||||
|  |                         log.info( | ||||||
|  |                                 "Skip migration task since this is not a master instance: {}", | ||||||
|  |                                 this.webserviceInfo.getWebserviceUUID()); | ||||||
| 
 | 
 | ||||||
|                 log.info( |                         return; | ||||||
|                         "Skip migration task since this is not a master instance: {}", |                     } | ||||||
|                         this.webserviceInfo.getWebserviceUUID()); |                 } | ||||||
| 
 |  | ||||||
|                 return; |  | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             if (this.cleanDBOnStartup) { |             if (this.cleanDBOnStartup) { | ||||||
|                 flyway.clean(); |                 flyway.clean(); | ||||||
|             } |             } | ||||||
|             flyway.migrate(); |             flyway.migrate(); | ||||||
|  | 
 | ||||||
|         } catch (final Exception e) { |         } catch (final Exception e) { | ||||||
|             log.error("Failed to apply migration task: ", e); |             log.error("Failed to apply migration task: ", e); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -14,6 +14,8 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.dao; | ||||||
|  * the persistent data table. */ |  * the persistent data table. */ | ||||||
| public interface WebserviceInfoDAO { | public interface WebserviceInfoDAO { | ||||||
| 
 | 
 | ||||||
|  |     boolean isInitialized(); | ||||||
|  | 
 | ||||||
|     /** Register a SEB webservice within the persistent storage |     /** Register a SEB webservice within the persistent storage | ||||||
|      * |      * | ||||||
|      * @param uuid A unique identifier that was generated by the webservice on startup |      * @param uuid A unique identifier that was generated by the webservice on startup | ||||||
|  |  | ||||||
|  | @ -47,6 +47,20 @@ public class WebserviceInfoDAOImpl implements WebserviceInfoDAO { | ||||||
|         this.forceMaster = forceMaster; |         this.forceMaster = forceMaster; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|  |     @Transactional | ||||||
|  |     public boolean isInitialized() { | ||||||
|  |         try { | ||||||
|  |             this.webserviceServerInfoRecordMapper | ||||||
|  |                     .selectByExample() | ||||||
|  |                     .build() | ||||||
|  |                     .execute(); | ||||||
|  |             return true; | ||||||
|  |         } catch (final Exception e) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     @Transactional |     @Transactional | ||||||
|     @Override |     @Override | ||||||
|     public boolean register(final String uuid, final String address) { |     public boolean register(final String uuid, final String address) { | ||||||
|  |  | ||||||
|  | @ -269,6 +269,10 @@ public class ExamAPI_V1_Controller { | ||||||
|         final String pingNumString = request.getParameter(API.EXAM_API_PING_NUMBER); |         final String pingNumString = request.getParameter(API.EXAM_API_PING_NUMBER); | ||||||
|         final String instructionConfirm = request.getParameter(API.EXAM_API_PING_INSTRUCTION_CONFIRM); |         final String instructionConfirm = request.getParameter(API.EXAM_API_PING_INSTRUCTION_CONFIRM); | ||||||
| 
 | 
 | ||||||
|  |         if (log.isTraceEnabled()) { | ||||||
|  |             log.trace("****************** SEB client connection: {}", connectionToken); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         if (instructionConfirm != null) { |         if (instructionConfirm != null) { | ||||||
|             this.sebClientConnectionService.confirmInstructionDone(connectionToken, instructionConfirm); |             this.sebClientConnectionService.confirmInstructionDone(connectionToken, instructionConfirm); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -11,6 +11,7 @@ logging.level.ch=INFO | ||||||
| logging.level.org.springframework.cache=INFO | logging.level.org.springframework.cache=INFO | ||||||
| logging.level.ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl=DEBUG | logging.level.ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl=DEBUG | ||||||
| logging.level.ch.ethz.seb.sebserver.webservice.servicelayer.session=DEBUG | logging.level.ch.ethz.seb.sebserver.webservice.servicelayer.session=DEBUG | ||||||
|  | logging.level.ch.ethz.seb.sebserver.webservice.weblayer.api.ExamAPI_V1_Controller=TRACE | ||||||
| 
 | 
 | ||||||
| sebserver.http.client.connect-timeout=150000 | sebserver.http.client.connect-timeout=150000 | ||||||
| sebserver.http.client.connection-request-timeout=100000 | sebserver.http.client.connection-request-timeout=100000 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue