remove remote docker for now

This commit is contained in:
Andras Bacsai
2022-02-27 11:14:46 +01:00
parent ef006578b2
commit 54376fd105
5 changed files with 19 additions and 9 deletions

View File

@@ -147,12 +147,8 @@ model DestinationDocker {
id String @id @default(cuid()) id String @id @default(cuid())
network String @unique network String @unique
name String name String
engine String? engine String
remoteEngine Boolean @default(false) remoteEngine Boolean @default(false)
ipAddress String?
sshPrivateKey String?
user String? @default("root")
port Int? @default(22)
isCoolifyProxyUsed Boolean? @default(false) isCoolifyProxyUsed Boolean? @default(false)
teams Team[] teams Team[]
application Application[] application Application[]

View File

@@ -106,6 +106,11 @@ export function getEngine(engine) {
return engine === '/var/run/docker.sock' ? 'unix:///var/run/docker.sock' : engine; return engine === '/var/run/docker.sock' ? 'unix:///var/run/docker.sock' : engine;
} }
// export async function saveSshKey(destination) {
// return await asyncExecShell(
// `echo '${destination.sshPrivateKey}' > /tmp/id_rsa_${destination.id} && chmod 600 /tmp/id_rsa_${destination.id}`
// );
// }
export async function removeContainer(id, engine) { export async function removeContainer(id, engine) {
const host = getEngine(engine); const host = getEngine(engine);
try { try {

View File

@@ -13,6 +13,7 @@ import {
startHttpProxy startHttpProxy
} from '$lib/haproxy'; } from '$lib/haproxy';
import * as db from '$lib/database'; import * as db from '$lib/database';
// import { generateRemoteEngine } from '$lib/components/common';
export default async function () { export default async function () {
try { try {
@@ -20,6 +21,9 @@ export default async function () {
const destinationDockers = await prisma.destinationDocker.findMany({}); const destinationDockers = await prisma.destinationDocker.findMany({});
for (const destination of destinationDockers) { for (const destination of destinationDockers) {
if (destination.isCoolifyProxyUsed) { if (destination.isCoolifyProxyUsed) {
// if (destination.remoteEngine) {
// const engine = generateRemoteEngine(destination);
// }
const docker = dockerInstance({ destinationDocker: destination }); const docker = dockerInstance({ destinationDocker: destination });
const containers = await docker.engine.listContainers(); const containers = await docker.engine.listContainers();
const configurations = containers.filter( const configurations = containers.filter(

View File

@@ -1,4 +1,4 @@
import { getUserDetails } from '$lib/common'; import { asyncExecShell, getUserDetails } from '$lib/common';
import { generateRemoteEngine } from '$lib/components/common'; import { generateRemoteEngine } from '$lib/components/common';
import * as db from '$lib/database'; import * as db from '$lib/database';
import { ErrorHandler } from '$lib/database'; import { ErrorHandler } from '$lib/database';
@@ -19,8 +19,13 @@ export const get: RequestHandler = async (event) => {
state: false state: false
}; };
if (destination.remoteEngine) { if (destination.remoteEngine) {
const engine = await generateRemoteEngine(destination); // const { stdout } = await asyncExecShell(
payload.state = await checkContainer(engine, 'coolify-haproxy'); // `ssh -p ${destination.port} ${destination.user}@${destination.ipAddress} "docker ps -a"`
// );
// console.log(stdout)
// const engine = await generateRemoteEngine(destination);
// // await saveSshKey(destination);
// payload.state = await checkContainer(engine, 'coolify-haproxy');
} else { } else {
payload.state = payload.state =
destination?.engine && (await checkContainer(destination.engine, 'coolify-haproxy')); destination?.engine && (await checkContainer(destination.engine, 'coolify-haproxy'));

View File

@@ -42,7 +42,7 @@
<div class="text-xl font-bold text-white">Predefined destinations</div> <div class="text-xl font-bold text-white">Predefined destinations</div>
<div class="flex justify-center space-x-2"> <div class="flex justify-center space-x-2">
<button class="w-32" on:click={() => setPredefined('localDocker')}>Local Docker</button> <button class="w-32" on:click={() => setPredefined('localDocker')}>Local Docker</button>
<button class="w-32" on:click={() => setPredefined('remoteDocker')}>Remote Docker</button> <!-- <button class="w-32" on:click={() => setPredefined('remoteDocker')}>Remote Docker</button> -->
<button class="w-32" on:click={() => setPredefined('kubernetes')}>Kubernetes</button> <button class="w-32" on:click={() => setPredefined('kubernetes')}>Kubernetes</button>
</div> </div>
</div> </div>