An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix: Improvement on image pulls
Andras Bacsaid6225cbde30f
diff --git a/src/lib/queues/cleanup.ts b/src/lib/queues/cleanup.tsindex 954d3fa678..dded603f99 100644--- a/src/lib/queues/cleanup.ts+++ b/src/lib/queues/cleanup.ts@@ -4,35 +4,39 @@ import { prisma } from '$lib/database';import { defaultProxyImageHttp, defaultProxyImageTcp } from '$lib/haproxy';export default async function () {- if (!dev) {- const destinationDockers = await prisma.destinationDocker.findMany();- for (const destinationDocker of destinationDockers) {- const host = getEngine(destinationDocker.engine);- // Tagging images with labels- try {- const images = [- `coollabsio/${defaultProxyImageTcp}`,- `coollabsio/${defaultProxyImageHttp}`,- 'certbot/certbot:latest',- 'node:16.14.0-alpine',- 'alpine:latest',- 'nginx:stable-alpine',- 'node:lts',- 'php:apache',- 'rust:latest'- ];- for (const image of images) {+ const destinationDockers = await prisma.destinationDocker.findMany();+ for (const destinationDocker of destinationDockers) {+ const host = getEngine(destinationDocker.engine);+ // Tagging images with labels+ try {+ const images = [+ `coollabsio/${defaultProxyImageTcp}`,+ `coollabsio/${defaultProxyImageHttp}`,+ 'certbot/certbot:latest',+ 'node:16.14.0-alpine',+ 'alpine:latest',+ 'nginx:stable-alpine',+ 'node:lts',+ 'php:apache',+ 'rust:latest'+ ];+ for (const image of images) {+ try {+ await asyncExecShell(`DOCKER_HOST=${host} docker image inspect ${image}`);+ } catch (error) {await asyncExecShell(`DOCKER_HOST=${host} docker pull ${image} && echo "FROM ${image}" | docker build --label coolify.image="true" -t "${image}" -`);}- } catch (error) {}- try {- await asyncExecShell(`DOCKER_HOST=${host} docker container prune -f`);- } catch (error) {- console.log(error);}- // Cleanup images that are not managed by coolify+ } catch (error) {}+ try {+ await asyncExecShell(`DOCKER_HOST=${host} docker container prune -f`);+ } catch (error) {+ console.log(error);+ }+ if (!dev) {+ //Cleanup images that are not managed by coolifytry {await asyncExecShell(`DOCKER_HOST=${host} docker image prune --filter 'label!=coolify.image=true' -a -f`@@ -40,12 +44,12 @@ export default async function () {} catch (error) {console.log(error);}- // Cleanup dangling images- try {- await asyncExecShell(`DOCKER_HOST=${host} docker image prune -f`);- } catch (error) {- console.log(error);- }+ }+ // Cleanup dangling images+ try {+ await asyncExecShell(`DOCKER_HOST=${host} docker image prune -f`);+ } catch (error) {+ console.log(error);}}}diff --git a/src/lib/queues/index.ts b/src/lib/queues/index.tsindex 3d0dda4f16..45c9c8a52b 100644--- a/src/lib/queues/index.ts+++ b/src/lib/queues/index.ts@@ -87,7 +87,7 @@ const cron = async () => {await queue.proxy.add('proxy', {}, { repeat: { every: 10000 } });// await queue.ssl.add('ssl', {}, { repeat: { every: 10000 } });- if (!dev) await queue.cleanup.add('cleanup', {}, { repeat: { every: 600000 } });+ await queue.cleanup.add('cleanup', {}, { repeat: { every: 600000 } });await queue.sslRenew.add('sslRenew', {}, { repeat: { every: 1800000 } });const events = {