MCPcopy Index your code
hub / github.com/Dokploy/dokploy / deployPostgres

Function deployPostgres

packages/server/src/services/postgres.ts:143–183  ·  view source on GitHub ↗
(
	postgresId: string,
	onData?: (data: any) => void,
)

Source from the content-addressed store, hash-verified

141};
142
143export const deployPostgres = async (
144 postgresId: string,
145 onData?: (data: any) => void,
146) => {
147 const postgres = await findPostgresById(postgresId);
148 try {
149 await updatePostgresById(postgresId, {
150 applicationStatus: "running",
151 });
152
153 onData?.("Starting postgres deployment...");
154
155 if (postgres.serverId) {
156 await execAsyncRemote(
157 postgres.serverId,
158 `docker pull ${postgres.dockerImage}`,
159 onData,
160 );
161 } else {
162 await pullImage(postgres.dockerImage, onData);
163 }
164
165 await buildPostgres(postgres);
166
167 await updatePostgresById(postgresId, {
168 applicationStatus: "done",
169 });
170
171 onData?.("Deployment completed successfully!");
172 } catch (error) {
173 onData?.(`Error: ${error}`);
174 await updatePostgresById(postgresId, {
175 applicationStatus: "error",
176 });
177 throw new TRPCError({
178 code: "INTERNAL_SERVER_ERROR",
179 message: `Error on deploy postgres${error}`,
180 });
181 }
182 return postgres;
183};

Callers 2

rebuildDatabaseFunction · 0.90
postgres.tsFile · 0.90

Calls 6

execAsyncRemoteFunction · 0.90
pullImageFunction · 0.90
buildPostgresFunction · 0.90
findPostgresByIdFunction · 0.85
updatePostgresByIdFunction · 0.85
onDataFunction · 0.50

Tested by

no test coverage detected