Skip to content
Merged
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: 1 addition & 2 deletions agent/internal/container/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ func Deploy(config *DeployConfig) (*DeployResult, error) {

image := config.Image

exec.Command("podman", "rm", "-f", config.Name).Run()

logFunc("stdout", fmt.Sprintf("Pulling image: %s", image))

pullCmd := exec.Command("podman", "pull", "--tls-verify=false", image)
Expand All @@ -92,6 +90,7 @@ func Deploy(config *DeployConfig) (*DeployResult, error) {
}

args := buildPodmanRunArgs(config, image)
exec.Command("podman", "rm", "-f", config.Name).Run()

logFunc("stdout", fmt.Sprintf("Starting container: %s", config.Name))

Expand Down
3 changes: 0 additions & 3 deletions web/actions/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1161,9 +1161,6 @@ export async function updateServiceConfig(
if (config.ports) {
if (config.ports.remove && config.ports.remove.length > 0) {
for (const portId of config.ports.remove) {
await db
.delete(deploymentPorts)
.where(eq(deploymentPorts.servicePortId, portId));
await db.delete(servicePorts).where(eq(servicePorts.id, portId));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use client";

import { ChangelogHistory } from "@/components/service/details/changelog-history";
import { useService } from "@/components/service/service-layout-client";

export default function ChangelogPage() {
const { service, projectSlug, envName } = useService();

return (
<ChangelogHistory
serviceId={service.id}
projectSlug={projectSlug}
envName={envName}
/>
);
}
26 changes: 6 additions & 20 deletions web/app/(dashboard)/layout-client.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
"use client";

import { LogOut, Settings, User } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useEffect } from "react";
import { LogOut, Settings, User } from "lucide-react";
import {
BreadcrumbDataProvider,
useBreadcrumbs,
} from "@/components/core/breadcrumb-data";
import { DashboardPageSkeleton } from "@/components/dashboard/dashboard-page-skeleton";
import { OfflineServersBanner } from "@/components/server/offline-servers-banner";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
Expand All @@ -24,13 +23,7 @@ import {
import { Toaster } from "@/components/ui/sonner";
import { signOut, useSession } from "@/lib/auth-client";

function DashboardHeader({
email,
name,
}: {
email: string;
name: string;
}) {
function DashboardHeader({ email, name }: { email: string; name: string }) {
const router = useRouter();
const breadcrumbs = useBreadcrumbs();
const getBreadcrumbKey = (
Expand All @@ -43,8 +36,8 @@ function DashboardHeader({
const showEllipsis = breadcrumbs.length > 2;

return (
<header className="border-b">
<div className="container max-w-full mx-auto px-4 h-14 flex items-center justify-between">
<header className="h-14 border-b">
<div className="container max-w-full mx-auto px-4 h-full flex items-center justify-between">
<div className="flex items-center gap-3">
<Link href="/dashboard" className="flex items-center">
<Image
Expand Down Expand Up @@ -119,11 +112,7 @@ function DashboardHeader({
>
<User className="size-4" />
</DropdownMenuTrigger>
<DropdownMenuContent
align="end"
sideOffset={8}
className="w-40"
>
<DropdownMenuContent align="end" sideOffset={8} className="w-40">
<DropdownMenuGroup>
<DropdownMenuLabel>
<span className="block truncate text-sm font-semibold">
Expand Down Expand Up @@ -183,10 +172,7 @@ export function DashboardLayoutClient({
return (
<BreadcrumbDataProvider>
<div className="min-h-screen">
<DashboardHeader
email={session.user.email}
name={session.user.name}
/>
<DashboardHeader email={session.user.email} name={session.user.name} />
<OfflineServersBanner />
<main>{children}</main>
<Toaster />
Expand Down
45 changes: 39 additions & 6 deletions web/app/api/projects/[id]/services/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const dynamic = "force-dynamic";

import { and, desc, eq, isNull } from "drizzle-orm";
import { and, desc, eq, inArray, isNull } from "drizzle-orm";
import { headers } from "next/headers";
import { db } from "@/db";
import {
Expand All @@ -12,12 +12,14 @@ import {
servers,
servicePorts,
serviceReplicas,
serviceRevisions,
services,
serviceVolumes,
volumeBackups,
} from "@/db/schema";
import { auth } from "@/lib/auth";
import { getTimestamp } from "@/lib/date";
import { revisionSpecToDeployedConfig } from "@/lib/service-config";

export async function GET(
request: Request,
Expand Down Expand Up @@ -114,20 +116,50 @@ export async function GET(
: Promise.resolve(null),
]);

const activeDeployment = serviceDeployments.find(
(deployment) =>
deployment.trafficState === "active" &&
deployment.runtimeDesiredState !== "removed",
);
const activeRevision = activeDeployment
? await db
.select({ specification: serviceRevisions.specification })
.from(serviceRevisions)
.where(eq(serviceRevisions.id, activeDeployment.serviceRevisionId))
.then((rows) => rows[0])
: null;
const revisionServers = activeRevision
? await db
.select({ id: servers.id, name: servers.name })
.from(servers)
.where(
inArray(
servers.id,
activeRevision.specification.placements.map(
(placement) => placement.serverId,
),
),
)
: [];
const activeConfig = activeRevision
? revisionSpecToDeployedConfig(
activeRevision.specification,
Object.fromEntries(
revisionServers.map((server) => [server.id, server.name]),
),
)
: null;

const deploymentsWithDetails = await Promise.all(
serviceDeployments.map(async (deployment) => {
const [depPorts, server] = await Promise.all([
db
.select({
id: deploymentPorts.id,
hostPort: deploymentPorts.hostPort,
containerPort: servicePorts.port,
containerPort: deploymentPorts.containerPort,
})
.from(deploymentPorts)
.innerJoin(
servicePorts,
eq(deploymentPorts.servicePortId, servicePorts.id),
)
.where(eq(deploymentPorts.deploymentId, deployment.id)),
db
.select({ name: servers.name, wireguardIp: servers.wireguardIp })
Expand Down Expand Up @@ -205,6 +237,7 @@ export async function GET(
volumes,
lockedServer,
latestBuild,
activeConfig,
deletionBackupFallback,
};
}),
Expand Down
Loading
Loading