Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions cli/internal/cli/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,6 @@ service:
image: nginx:1.27
replicas:
count: 1
resources:
cpuCores: 2
memoryMb: 1024
ports:
- port: 80
public: false
Expand Down
3 changes: 3 additions & 0 deletions cli/internal/cli/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ func TestInitCreatesManifest(t *testing.T) {
if !strings.Contains(string(raw), "image: nginx:1.27") {
t.Fatalf("manifest = %s", raw)
}
if strings.Contains(string(raw), "resources:") {
t.Fatalf("manifest should not set default resource limits: %s", raw)
}
}

func TestLogsRejectsInvalidTailBeforeConfig(t *testing.T) {
Expand Down
6 changes: 4 additions & 2 deletions web/actions/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
workQueue,
} from "@/db/schema";
import { requireDeveloperRole, verifyDeleteConfirmation } from "@/lib/auth";
import { DEFAULT_RESOURCE_LIMITS } from "@/lib/constants";
import { deployServiceInternal } from "@/lib/deploy-service";
import {
isObservedReady,
Expand Down Expand Up @@ -429,7 +428,10 @@ const SERVICE_CARD_WIDTH = 320;
export async function createService(input: CreateServiceInput) {
await requireDeveloperRole();
const { projectId, environmentId, name, image, github } = input;
const resourceLimits = input.resourceLimits ?? DEFAULT_RESOURCE_LIMITS;
const resourceLimits = input.resourceLimits ?? {
cpuCores: null,
memoryMb: null,
};
const env = await getEnvironment(environmentId);
if (!env) {
throw new Error("Environment not found");
Expand Down
5 changes: 2 additions & 3 deletions web/components/service/details/resource-limits-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
NativeSelectOption,
} from "@/components/ui/native-select";
import type { ServiceWithDetails as Service } from "@/db/types";
import { DEFAULT_RESOURCE_LIMITS } from "@/lib/constants";

type Preset = {
label: string;
Expand All @@ -25,8 +24,8 @@ const PRESETS: Record<string, Preset> = {
medium: { label: "Medium (1 CPU, 512MB)", cpuCores: 1, memoryMb: 512 },
large: {
label: "Large (2 CPU, 1024MB)",
cpuCores: DEFAULT_RESOURCE_LIMITS.cpuCores,
memoryMb: DEFAULT_RESOURCE_LIMITS.memoryMb,
cpuCores: 2,
memoryMb: 1024,
},
xlarge: { label: "X-Large (4 CPU, 2048MB)", cpuCores: 4, memoryMb: 2048 },
custom: { label: "Custom", cpuCores: null, memoryMb: null },
Expand Down
1 change: 0 additions & 1 deletion web/components/service/details/secrets-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ export const SecretsSection = memo(function SecretsSection({
await mutate();
setPendingVars([]);
setPendingDeletes([]);
toast.success("Environment variables saved");
onUpdate();
} catch {
toast.error("Failed to save changes");
Expand Down
1 change: 0 additions & 1 deletion web/components/service/details/serverless-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export const ServerlessSection = memo(function ServerlessSection({
wakeTimeoutSeconds: parsed.wakeTimeoutSeconds,
});
onUpdate();
toast.success("Serverless settings saved. Deploy to apply.");
} catch (error) {
toast.error(
error instanceof Error
Expand Down
2 changes: 0 additions & 2 deletions web/components/service/details/source-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export const SourceSection = memo(function SourceSection({
branch,
rootDir,
);
toast.success("Repository settings updated");
setIsEditing(false);
onUpdate?.();
} catch (error) {
Expand All @@ -99,7 +98,6 @@ export const SourceSection = memo(function SourceSection({
await updateServiceConfig(service.id, {
source: { type: "image", image: image.trim() },
});
toast.success("Docker image updated");
setIsEditing(false);
onUpdate?.();
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions web/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ export const services = pgTable("services", {
healthCheckRetries: integer("health_check_retries").default(3),
healthCheckStartPeriod: integer("health_check_start_period").default(30),
startCommand: text("start_command"),
resourceCpuLimit: real("resource_cpu_limit").default(2),
resourceMemoryLimitMb: integer("resource_memory_limit_mb").default(1024),
resourceCpuLimit: real("resource_cpu_limit"),
resourceMemoryLimitMb: integer("resource_memory_limit_mb"),
serverlessEnabled: boolean("serverless_enabled").notNull().default(false),
serverlessSleepAfterSeconds: integer("serverless_sleep_after_seconds")
.notNull()
Expand Down
6 changes: 4 additions & 2 deletions web/lib/cli-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
type TechulusManifest,
techulusManifestSchema,
} from "@/lib/cli-manifest";
import { DEFAULT_RESOURCE_LIMITS } from "@/lib/constants";
import { deployServiceInternal } from "@/lib/deploy-service";
import { slugify } from "@/lib/utils";

Expand All @@ -36,7 +35,7 @@ export type ManifestChange = {
function getManifestResourceLimits(manifest: TechulusManifest) {
const resources = manifest.service.resources;
if (resources === undefined) {
return DEFAULT_RESOURCE_LIMITS;
return null;
}

return {
Expand Down Expand Up @@ -558,6 +557,9 @@ async function syncResources(
changes: ManifestChange[],
) {
const desiredResources = getManifestResourceLimits(manifest);
if (desiredResources === null) {
return;
}
const desiredCpu = desiredResources.cpuCores;
const desiredMemory = desiredResources.memoryMb;

Expand Down
5 changes: 0 additions & 5 deletions web/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
export const WIREGUARD_SUBNET_PREFIX = "10.100";
export const CONTAINER_SUBNET_PREFIX = "10.200";

export const DEFAULT_RESOURCE_LIMITS = {
cpuCores: 2,
memoryMb: 1024,
} as const;
Loading