Skip to content

Commit

Permalink
refactor(DeployJob): launch pelias job for both new and existing serv…
Browse files Browse the repository at this point in the history
…er instances
  • Loading branch information
miles-grant-ibigroup committed Sep 30, 2021
1 parent 46c9524 commit 6039987
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/main/java/com/conveyal/datatools/manager/jobs/DeployJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,25 +316,13 @@ public void jobLogic () {
status.fail(String.format("Error uploading/copying deployment bundle to s3://%s", s3Bucket), e);
}
}

// Now that the build was successful, update Pelias
if (deployment.peliasUpdate) {
// Get log upload URI from deploy job
AmazonS3URI logUploadS3URI = getS3FolderURI();

// Execute the pelias update job and keep track of it
PeliasUpdateJob peliasUpdateJob = new PeliasUpdateJob(owner, "Updating Custom Geocoder Database", deployment, logUploadS3URI);
addNextJob(peliasUpdateJob);
}
}

// Handle spinning up new EC2 servers for the load balancer's target group.
if (otpServer.ec2Info != null) {
if ("true".equals(DataManager.getConfigPropertyAsText("modules.deployment.ec2.enabled"))) {
replaceEC2Servers();
tasksCompleted++;
// If creating a new server, there is no need to deploy to an existing one.
return;
} else {
status.fail("Cannot complete deployment. EC2 deployment disabled in server configuration.");
return;
Expand All @@ -350,6 +338,15 @@ public void jobLogic () {
status.baseUrl = otpServer.publicUrl;
}

// Now that the build + deployment was successful, update Pelias
if (deployment.peliasUpdate) {
// Get log upload URI from deploy job
AmazonS3URI logUploadS3URI = getS3FolderURI();

// Execute the pelias update job and keep track of it
PeliasUpdateJob peliasUpdateJob = new PeliasUpdateJob(owner, "Updating Custom Geocoder Database", deployment, logUploadS3URI);
addNextJob(peliasUpdateJob);
}

status.completed = true;
}
Expand Down

0 comments on commit 6039987

Please sign in to comment.