Skip to content

Commit

Permalink
Adjust how we limit CPU count for Oracle Dev Services
Browse files Browse the repository at this point in the history
Fixes quarkusio#38003

Co-authored-by: Fedor Dudinskiy <[email protected]>
  • Loading branch information
gsmet and fedinskiy committed Nov 25, 2024
1 parent a3ce841 commit eb959d0
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import static io.quarkus.datasource.deployment.spi.DatabaseDefaultSetupConfig.DEFAULT_DATABASE_USERNAME;

import java.time.Duration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.OptionalInt;

Expand Down Expand Up @@ -68,14 +70,14 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt
Labels.addDataSourceLabel(container, datasourceName);
Volumes.addVolumes(container, containerConfig.getVolumes());

container.withEnv(containerConfig.getContainerEnv());

// We need to limit the maximum amount of CPUs being used by the container;
// otherwise the hardcoded memory configuration of the DB might not be enough to successfully boot it.
// See https://github.com/gvenzl/oci-oracle-xe/issues/64
// I choose to limit it to "2 cpus": should be more than enough for any local testing needs,
// and keeps things simple.
container.withCreateContainerCmdModifier(cmd -> cmd.getHostConfig().withNanoCPUs(2_000_000_000l));
Map<String, String> containerEnv = new HashMap<>(containerConfig.getContainerEnv());
containerEnv.put("CPU_COUNT", "2");
container.withEnv(containerEnv);

containerConfig.getAdditionalJdbcUrlProperties().forEach(container::withUrlParam);
containerConfig.getCommand().ifPresent(container::setCommand);
Expand Down

0 comments on commit eb959d0

Please sign in to comment.