This commit is contained in:
Andras Bacsai 2022-10-06 12:01:24 +02:00
parent d3c3cded37
commit f47cdb68d9

View File

@ -147,9 +147,7 @@ const host = '0.0.0.0';
// checkProxies and checkFluentBit // checkProxies and checkFluentBit
setInterval(async () => { setInterval(async () => {
console.log('checkProxies')
await checkProxies(); await checkProxies();
console.log('checkFluentBit')
await checkFluentBit(); await checkFluentBit();
}, 10000) }, 10000)
@ -166,9 +164,6 @@ const host = '0.0.0.0';
console.error(error); console.error(error);
process.exit(1); process.exit(1);
} }
})(); })();
@ -191,6 +186,7 @@ async function getIPAddress() {
} catch (error) { } } catch (error) { }
} }
async function initServer() { async function initServer() {
await asyncExecShell(`env | grep '^COOLIFY' > /app/.env`);
try { try {
console.log(`Initializing server...`); console.log(`Initializing server...`);
await asyncExecShell(`docker network create --attachable coolify`); await asyncExecShell(`docker network create --attachable coolify`);
@ -250,7 +246,6 @@ async function autoUpdater() {
const { isAutoUpdateEnabled } = await prisma.setting.findFirst(); const { isAutoUpdateEnabled } = await prisma.setting.findFirst();
if (isAutoUpdateEnabled) { if (isAutoUpdateEnabled) {
await asyncExecShell(`docker pull coollabsio/coolify:${latestVersion}`); await asyncExecShell(`docker pull coollabsio/coolify:${latestVersion}`);
await asyncExecShell(`env | grep COOLIFY > .env`);
await asyncExecShell( await asyncExecShell(
`sed -i '/COOLIFY_AUTO_UPDATE=/cCOOLIFY_AUTO_UPDATE=${isAutoUpdateEnabled}' .env` `sed -i '/COOLIFY_AUTO_UPDATE=/cCOOLIFY_AUTO_UPDATE=${isAutoUpdateEnabled}' .env`
); );
@ -267,17 +262,20 @@ async function autoUpdater() {
} }
async function checkFluentBit() { async function checkFluentBit() {
if (!isDev) { try {
if (!isDev || process.env.COOLIFY_CONTAINER_DEV === 'true') {
const engine = '/var/run/docker.sock'; const engine = '/var/run/docker.sock';
const { id } = await prisma.destinationDocker.findFirst({ const { id } = await prisma.destinationDocker.findFirst({
where: { engine, network: 'coolify' } where: { engine, network: 'coolify' }
}); });
const { found } = await checkContainer({ dockerId: id, container: 'coolify-fluentbit' }); const { found } = await checkContainer({ dockerId: id, container: 'coolify-fluentbit' });
if (!found) { if (!found) {
await asyncExecShell(`env | grep COOLIFY > .env`);
await asyncExecShell(`docker compose up -d fluent-bit`); await asyncExecShell(`docker compose up -d fluent-bit`);
} }
} }
} catch (error) {
console.log(error)
}
} }
async function checkProxies() { async function checkProxies() {
try { try {