diff --git a/build.gradle b/build.gradle index d5c905e73..c3629696e 100644 --- a/build.gradle +++ b/build.gradle @@ -84,10 +84,10 @@ tasks.build.dependsOn(tasks.checkLicense) // Paths to main and test sources. ext.projectRootDir = "${rootDir}" -// Tasks to deploy/stage all App Engine services +// Tasks to deploy/stage all services task deploy { group = 'deployment' - description = 'Deploys all services to App Engine.' + description = 'Deploys all services.' } task stage { diff --git a/common/src/main/java/google/registry/util/DateTimeUtils.java b/common/src/main/java/google/registry/util/DateTimeUtils.java index b82de8130..b085fbabd 100644 --- a/common/src/main/java/google/registry/util/DateTimeUtils.java +++ b/common/src/main/java/google/registry/util/DateTimeUtils.java @@ -33,8 +33,8 @@ public abstract class DateTimeUtils { /** * A date in the far future that we can treat as infinity. * - *

This value is (2^63-1)/1000 rounded down. AppEngine stores dates as 64 bit microseconds, but - * Java uses milliseconds, so this is the largest representable date that will survive a + *

This value is (2^63-1)/1000 rounded down. Postgres can store dates as 64 bit microseconds, + * but Java uses milliseconds, so this is the largest representable date that will survive a * round-trip through the database. */ public static final DateTime END_OF_TIME = new DateTime(Long.MAX_VALUE / 1000, DateTimeZone.UTC); diff --git a/config/nom_build.py b/config/nom_build.py index 45d02c9e7..095a91541 100644 --- a/config/nom_build.py +++ b/config/nom_build.py @@ -104,7 +104,7 @@ PROPERTIES = [ Property('testFilter', 'Comma separated list of test patterns, if specified run only ' 'these.'), - Property('environment', 'GAE Environment for deployment and staging.'), + Property('environment', 'Environment for deployment and staging.'), # Cloud SQL properties Property('dbServer', diff --git a/console-webapp/README.md b/console-webapp/README.md index bf4adaa37..99866a140 100644 --- a/console-webapp/README.md +++ b/console-webapp/README.md @@ -9,7 +9,7 @@ expected to change. ## Deployment -Webapp is deployed with the nomulus default service war to Google App Engine. +The webapp is deployed with the nomulus default service war to GKE. During nomulus default service war build task, gradle script triggers the following: diff --git a/core/build.gradle b/core/build.gradle index c40058ec8..f4c5b0bcc 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -110,7 +110,7 @@ configurations { // for details. nomulus_test - // Exclude non-canonical servlet-api jars. Our AppEngine deployment uses + // Exclude non-canonical servlet-api jars. Our deployment uses // javax.servlet:servlet-api:2.5 // For reasons we do not understand, marking the following dependencies as // compileOnly instead of compile does not exclude them from runtimeClasspath. diff --git a/core/src/main/java/google/registry/batch/CloudTasksUtils.java b/core/src/main/java/google/registry/batch/CloudTasksUtils.java index a11d48615..06b7d5fb1 100644 --- a/core/src/main/java/google/registry/batch/CloudTasksUtils.java +++ b/core/src/main/java/google/registry/batch/CloudTasksUtils.java @@ -55,8 +55,6 @@ import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Optional; import java.util.Random; -import java.util.function.BiConsumer; -import java.util.function.Consumer; import java.util.function.Supplier; import org.joda.time.Duration; @@ -118,19 +116,13 @@ public class CloudTasksUtils implements Serializable { *

For GET requests we add them on to the URL, and for POST requests we add them in the body of * the request. * - *

The parameters {@code putHeadersFunction} and {@code setBodyFunction} are used so that this - * method can be called with either an AppEngine HTTP request or a standard non-AppEngine HTTP - * request. The two objects do not have the same methods, but both have ways of setting headers / - * body. - * * @return the resulting path (unchanged for POST requests, with params added for GET requests) */ private static String processRequestParameters( String path, Method method, Multimap params, - BiConsumer putHeadersFunction, - Consumer setBodyFunction) { + HttpRequest.Builder requestBuilder) { if (CollectionUtils.isNullOrEmpty(params)) { return path; } @@ -148,8 +140,8 @@ public class CloudTasksUtils implements Serializable { if (method.equals(Method.GET)) { return String.format("%s?%s", path, encodedParams); } - putHeadersFunction.accept(HttpHeaders.CONTENT_TYPE, MediaType.FORM_DATA.toString()); - setBodyFunction.accept(ByteString.copyFrom(encodedParams, StandardCharsets.UTF_8)); + requestBuilder.putHeaders(HttpHeaders.CONTENT_TYPE, MediaType.FORM_DATA.toString()); + requestBuilder.setBody(ByteString.copyFrom(encodedParams, StandardCharsets.UTF_8)); return path; } @@ -160,18 +152,17 @@ public class CloudTasksUtils implements Serializable { * default service account as the principal. That account must have permission to submit tasks to * Cloud Tasks. * - *

The caller of this method is responsible for passing in the appropriate service based on the - * runtime (GAE/GKE). Use the overload that takes an action class if possible. + *

The caller of this method is responsible for passing in the appropriate service. Use the + * overload that takes an action class if possible. * * @param path the relative URI (staring with a slash and ending without one). * @param method the HTTP method to be used for the request. - * @param service the GAE/GKE service to route the request to. + * @param service the service to route the request to. * @param params a multimap of URL query parameters. Duplicate keys are saved as is, and it is up * to the server to process the duplicate keys. * @return the enqueued task. - * @see Specifyinig - * the worker service + * @see Creating + * HTTP target tasks */ protected Task createTask( String path, Method method, Action.Service service, Multimap params) { @@ -180,9 +171,7 @@ public class CloudTasksUtils implements Serializable { "The path must start with a '/'."); HttpRequest.Builder requestBuilder = HttpRequest.newBuilder().setHttpMethod(HttpMethod.valueOf(method.name())); - path = - processRequestParameters( - path, method, params, requestBuilder::putHeaders, requestBuilder::setBody); + path = processRequestParameters(path, method, params, requestBuilder); OidcToken.Builder oidcTokenBuilder = OidcToken.newBuilder() .setServiceAccountEmail(credential.serviceAccount()) @@ -204,16 +193,15 @@ public class CloudTasksUtils implements Serializable { * Cloud Tasks. * *

Prefer this overload over the one where the path and service are explicitly defined, as this - * class will automatically determine the service to use based on the action and the runtime. + * class will automatically determine the service to use based on the action. * * @param actionClazz the action class to run, must be annotated with {@link Action}. * @param method the HTTP method to be used for the request. * @param params a multimap of URL query parameters. Duplicate keys are saved as is, and it is up * to the server to process the duplicate keys. * @return the enqueued task. - * @see Specifyinig - * the worker service + * @see Creating + * HTTP target tasks */ public Task createTask( Class actionClazz, Method method, Multimap params) { @@ -236,19 +224,18 @@ public class CloudTasksUtils implements Serializable { /** * Create a {@link Task} to be enqueued with a random delay up to {@code jitterSeconds}. * - *

The caller of this method is responsible for passing in the appropriate service based on the - * runtime (GAE/GKE). Use the overload that takes an action class if possible. + *

The caller of this method is responsible for passing in the appropriate service. Use the + * overload that takes an action class if possible. * * @param path the relative URI (staring with a slash and ending without one). * @param method the HTTP method to be used for the request. - * @param service the GAE/GKE service to route the request to. + * @param service the service to route the request to. * @param params a multimap of URL query parameters. Duplicate keys are saved as is, and it is up * to the server to process the duplicate keys. * @param jitterSeconds the number of seconds that a task is randomly delayed up to. * @return the enqueued task. - * @see Specifyinig - * the worker service + * @see Creating + * HTTP target tasks */ public Task createTaskWithJitter( String path, @@ -271,7 +258,7 @@ public class CloudTasksUtils implements Serializable { * Create a {@link Task} to be enqueued with a random delay up to {@code jitterSeconds}. * *

Prefer this overload over the one where the path and service are explicitly defined, as this - * class will automatically determine the service to use based on the action and the runtime. + * class will automatically determine the service to use based on the action. * * @param actionClazz the action class to run, must be annotated with {@link Action}. * @param method the HTTP method to be used for the request. @@ -279,9 +266,8 @@ public class CloudTasksUtils implements Serializable { * to the server to process the duplicate keys. * @param jitterSeconds the number of seconds that a task is randomly delayed up to. * @return the enqueued task. - * @see Specifyinig - * the worker service + * @see Creating + * HTTP target tasks */ public Task createTaskWithJitter( Class actionClazz, @@ -302,14 +288,13 @@ public class CloudTasksUtils implements Serializable { * * @param path the relative URI (staring with a slash and ending without one). * @param method the HTTP method to be used for the request. - * @param service the GAE/GKE service to route the request to. + * @param service the service to route the request to. * @param params a multimap of URL query parameters. Duplicate keys are saved as is, and it is up * to the server to process the duplicate keys. * @param delay the amount of time that a task needs to be delayed for. * @return the enqueued task. - * @see Specifyinig - * the worker service + * @see Creating + * HTTP target tasks */ private Task createTaskWithDelay( String path, @@ -330,7 +315,7 @@ public class CloudTasksUtils implements Serializable { * Create a {@link Task} to be enqueued with delay of {@code duration}. * *

Prefer this overload over the one where the path and service are explicitly defined, as this - * class will automatically determine the service to use based on the action and the runtime. + * class will automatically determine the service to use based on the action. * * @param actionClazz the action class to run, must be annotated with {@link Action}. * @param method the HTTP method to be used for the request. @@ -338,9 +323,8 @@ public class CloudTasksUtils implements Serializable { * to the server to process the duplicate keys. * @param delay the amount of time that a task needs to be delayed for. * @return the enqueued task. - * @see Specifyinig - * the worker service + * @see Creating + * HTTP target tasks */ public Task createTaskWithDelay( Class actionClazz, diff --git a/core/src/main/java/google/registry/batch/RelockDomainAction.java b/core/src/main/java/google/registry/batch/RelockDomainAction.java index 710ead346..f9a5ab5be 100644 --- a/core/src/main/java/google/registry/batch/RelockDomainAction.java +++ b/core/src/main/java/google/registry/batch/RelockDomainAction.java @@ -112,11 +112,11 @@ public class RelockDomainAction implements Runnable { public void run() { /* We wish to manually control our retry behavior, in order to limit the number of retries * and/or notify registrars / support only after a certain number of retries, or only - * with a certain type of failure. AppEngine will automatically retry on any non-2xx status + * with a certain type of failure. Cloud Tasks will automatically retry on any non-2xx status * code, so return SC_NO_CONTENT (204) by default to avoid this auto-retry. * - * See https://cloud.google.com/appengine/docs/standard/java/taskqueue/push/retrying-tasks - * for more details on retry behavior. */ + * See https://docs.cloud.google.com/tasks/docs/configuring-queues#retry for more details on + * retry behavior. */ response.setStatus(SC_NO_CONTENT); response.setContentType(MediaType.PLAIN_TEXT_UTF_8); tm().transact(this::relockDomain); diff --git a/core/src/main/java/google/registry/beam/common/RegistryPipelineWorkerInitializer.java b/core/src/main/java/google/registry/beam/common/RegistryPipelineWorkerInitializer.java index 7b98135f6..5dd54019b 100644 --- a/core/src/main/java/google/registry/beam/common/RegistryPipelineWorkerInitializer.java +++ b/core/src/main/java/google/registry/beam/common/RegistryPipelineWorkerInitializer.java @@ -40,8 +40,6 @@ public class RegistryPipelineWorkerInitializer implements JvmInitializer { @Override public void beforeProcessing(PipelineOptions options) { - // TODO(b/416299900): remove next line after GAE is removed. - System.setProperty("google.registry.jetty", "true"); RegistryPipelineOptions registryOptions = options.as(RegistryPipelineOptions.class); RegistryEnvironment environment = registryOptions.getRegistryEnvironment(); if (environment == null || environment.equals(RegistryEnvironment.UNITTEST)) { diff --git a/core/src/main/java/google/registry/bigquery/BigqueryConnection.java b/core/src/main/java/google/registry/bigquery/BigqueryConnection.java index 4f542896c..93bf6fae9 100644 --- a/core/src/main/java/google/registry/bigquery/BigqueryConnection.java +++ b/core/src/main/java/google/registry/bigquery/BigqueryConnection.java @@ -279,20 +279,6 @@ public class BigqueryConnection implements AutoCloseable { private TableReference getTableReference() { return table.getTableReference().clone(); } - - /** Returns a string representation of the TableReference for the wrapped table. */ - public String getStringReference() { - return tableReferenceToString(table.getTableReference()); - } - - /** Returns a string representation of the given TableReference. */ - private static String tableReferenceToString(TableReference tableRef) { - return String.format( - "%s:%s.%s", - tableRef.getProjectId(), - tableRef.getDatasetId(), - tableRef.getTableId()); - } } /** @@ -398,29 +384,12 @@ public class BigqueryConnection implements AutoCloseable { } /** - * Starts an asynchronous query job to dump the results of the specified query into a local - * ImmutableTable object, row-keyed by the row number (indexed from 1), column-keyed by the - * TableFieldSchema for that column, and with the value object as the cell value. Note that null - * values will not actually be null, but they can be checked for using Data.isNull(). + * Dumps the results of the specified query into a local ImmutableTable object, row-keyed by the + * row number (indexed from 1), column-keyed by the TableFieldSchema for that column, and with the + * value object as the cell value. * - *

Returns a ListenableFuture that holds the ImmutableTable on success. - */ - public ListenableFuture> - queryToLocalTable(String querySql) { - Job job = new Job() - .setConfiguration(new JobConfiguration() - .setQuery(new JobConfigurationQuery() - .setQuery(querySql) - .setDefaultDataset(getDataset()))); - return transform(runJobToCompletion(job), this::getQueryResults, directExecutor()); - } - - /** - * Returns the result of calling queryToLocalTable, but synchronously to avoid spawning new - * background threads, which App Engine doesn't support. - * - * @see App Engine - * Runtime + *

Note that null values will not actually be null, but they can be checked for using + * Data.isNull() */ public ImmutableTable queryToLocalTableSync(String querySql) { Job job = new Job() @@ -634,10 +603,6 @@ public class BigqueryConnection implements AutoCloseable { }); } - private ListenableFuture runJobToCompletion(final Job job) { - return service.submit(() -> runJob(job, null)); - } - /** Helper that returns true if a dataset with this name exists. */ public boolean checkDatasetExists(String datasetName) throws IOException { try { @@ -676,14 +641,6 @@ public class BigqueryConnection implements AutoCloseable { .setDatasetId(getDatasetId()); } - /** Returns table reference with the projectId and datasetId filled out for you. */ - public TableReference getTable(String tableName) { - return new TableReference() - .setProjectId(getProjectId()) - .setDatasetId(getDatasetId()) - .setTableId(tableName); - } - /** * Helper that creates a dataset with this name if it doesn't already exist, and returns true if * creation took place. diff --git a/core/src/main/java/google/registry/bsa/BsaDiffCreator.java b/core/src/main/java/google/registry/bsa/BsaDiffCreator.java index e7fe88eee..ee8676693 100644 --- a/core/src/main/java/google/registry/bsa/BsaDiffCreator.java +++ b/core/src/main/java/google/registry/bsa/BsaDiffCreator.java @@ -71,9 +71,7 @@ class BsaDiffCreator { Optional previousJobName = schedule.latestCompleted().map(CompletedJob::jobName); /* * Memory usage is a concern when creating a diff, when the newest download needs to be held in - * memory in its entirety. The top-grade AppEngine VM has 3GB of memory, leaving less than 1.5GB - * to application memory footprint after subtracting overheads due to copying garbage collection - * and non-heap data etc. Assuming 400K labels, each of which on average included in 5 orders, + * memory in its entirety. Assuming 400K labels, each of which on average included in 5 orders, * the memory footprint is at least 300MB when loaded into a Hashset-backed Multimap (64-bit * JVM, with 12-byte object header, 16-byte array header, and 16-byte alignment). * diff --git a/core/src/main/java/google/registry/config/CredentialModule.java b/core/src/main/java/google/registry/config/CredentialModule.java index 7b6c0e6e6..4aac137fa 100644 --- a/core/src/main/java/google/registry/config/CredentialModule.java +++ b/core/src/main/java/google/registry/config/CredentialModule.java @@ -44,8 +44,6 @@ public abstract class CredentialModule { *

The credential returned by the Cloud Runtime depends on the runtime environment: * *