diff --git a/Dockerfile b/Dockerfile index 00c29b5f0..239399c98 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,6 +33,8 @@ RUN curl -SL https://cdn.coollabs.io/bin/$TARGETPLATFORM/docker-20.10.9 -o /usr/ RUN curl -SL https://cdn.coollabs.io/bin/$TARGETPLATFORM/docker-compose-linux-2.7.0 -o ~/.docker/cli-plugins/docker-compose RUN chmod +x ~/.docker/cli-plugins/docker-compose /usr/bin/docker +RUN (curl -sSL "https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz" | tar -C /usr/local/bin/ --no-same-owner -xzv pack) + COPY --from=build /app/apps/api/build/ . COPY --from=build /app/apps/ui/build/ ./public COPY --from=build /app/apps/api/prisma/ ./prisma diff --git a/apps/api/.env.example b/apps/api/.env.example new file mode 100644 index 000000000..3d630cd57 --- /dev/null +++ b/apps/api/.env.example @@ -0,0 +1,9 @@ +COOLIFY_APP_ID= +COOLIFY_SECRET_KEY="12341234123412341234123412341234 - 32 long" +COOLIFY_DATABASE_URL= +COOLIFY_SENTRY_DSN= + +COOLIFY_IS_ON=docker +COOLIFY_WHITE_LABELED=false +COOLIFY_WHITE_LABELED_ICON= +COOLIFY_AUTO_UPDATE= \ No newline at end of file diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index 60f83a50f..979099db1 100644 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -52,16 +52,16 @@ const schema = { default: 'docker' }, COOLIFY_WHITE_LABELED: { - type: 'boolean', - default: false + type: 'string', + default: 'false' }, COOLIFY_WHITE_LABELED_ICON: { type: 'string', default: null }, COOLIFY_AUTO_UPDATE: { - type: 'boolean', - default: false + type: 'string', + default: 'false' }, } diff --git a/apps/api/src/jobs/deployApplication.ts b/apps/api/src/jobs/deployApplication.ts index e31ccf149..c780595f9 100644 --- a/apps/api/src/jobs/deployApplication.ts +++ b/apps/api/src/jobs/deployApplication.ts @@ -192,8 +192,8 @@ import * as buildpacks from '../lib/buildPacks'; } catch (error) { // } - // if (!imageFound || deployNeeded) { - if (true) { + if (!imageFound || deployNeeded) { + // if (true) { await copyBaseConfigurationFiles(buildPack, workdir, buildId, applicationId, baseImage); if (buildpacks[buildPack]) await buildpacks[buildPack]({ @@ -303,6 +303,7 @@ import * as buildpacks from '../lib/buildPacks'; labels, depends_on: [], restart: 'always', + expose: [port], ...(exposePort ? { ports: [`${exposePort}:${port}`] } : {}), // logging: { // driver: 'fluentd', diff --git a/apps/api/src/lib/buildPacks/heroku.ts b/apps/api/src/lib/buildPacks/heroku.ts new file mode 100644 index 000000000..1b382547c --- /dev/null +++ b/apps/api/src/lib/buildPacks/heroku.ts @@ -0,0 +1,29 @@ +import { executeDockerCmd, prisma } from "../common" +import { saveBuildLog } from "./common"; + +export default async function (data: any): Promise { + try { + const { buildId, applicationId, tag, dockerId, debug, workdir } = data + await saveBuildLog({ line: `Building image started.`, buildId, applicationId }); + const { stdout } = await executeDockerCmd({ + dockerId, + command: `pack build -p ${workdir} ${applicationId}:${tag} --builder heroku/buildpacks:20` + }) + + if (debug) { + const array = stdout.split('\n') + for (const line of array) { + if (line !== '\n') { + await saveBuildLog({ + line: `${line.replace('\n', '')}`, + buildId, + applicationId + }); + } + } + } + await saveBuildLog({ line: `Building image successful.`, buildId, applicationId }); + } catch (error) { + throw error; + } +} diff --git a/apps/api/src/lib/buildPacks/index.ts b/apps/api/src/lib/buildPacks/index.ts index 163aa3a7d..b8eb4d609 100644 --- a/apps/api/src/lib/buildPacks/index.ts +++ b/apps/api/src/lib/buildPacks/index.ts @@ -15,6 +15,7 @@ import eleventy from './static'; import python from './python'; import deno from './deno'; import laravel from './laravel'; +import heroku from './heroku'; export { node, @@ -33,5 +34,6 @@ export { eleventy, python, deno, - laravel + laravel, + heroku }; diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts index 7de37be56..87cb6ad98 100644 --- a/apps/api/src/lib/common.ts +++ b/apps/api/src/lib/common.ts @@ -17,7 +17,7 @@ import { checkContainer, removeContainer } from './docker'; import { day } from './dayjs'; import * as serviceFields from './serviceFields' -export const version = '3.2.0'; +export const version = '3.2.1'; export const isDev = process.env.NODE_ENV === 'development'; const algorithm = 'aes-256-ctr'; @@ -1614,7 +1614,7 @@ export async function cleanupDockerStorage(dockerId, lowDiskSpace, force) { return } try { - await executeDockerCmd({ dockerId, command: `docker container prune -f` }) + await executeDockerCmd({ dockerId, command: `docker container prune -f --filter "label=coolify.managed=true"` }) } catch (error) { //console.log(error); } diff --git a/apps/ui/README.md b/apps/ui/README.md deleted file mode 100644 index 374efec4c..000000000 --- a/apps/ui/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# create-svelte - -Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). - -## Creating a project - -If you're seeing this, you've probably already done this step. Congrats! - -```bash -# create a new project in the current directory -npm init svelte - -# create a new project in my-app -npm init svelte my-app -``` - -## Developing - -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: - -```bash -npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open -``` - -## Building - -To create a production version of your app: - -```bash -npm run build -``` - -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. diff --git a/apps/ui/src/lib/api.ts b/apps/ui/src/lib/api.ts index b494f6d8c..697a29338 100644 --- a/apps/ui/src/lib/api.ts +++ b/apps/ui/src/lib/api.ts @@ -24,7 +24,7 @@ export function getWebhookUrl(type: string) { } } if (CODESANDBOX_HOST) { - const newURL = CODESANDBOX_HOST.replace(/\$PORT/,'3001') + const newURL = `https://${CODESANDBOX_HOST.replace(/\$PORT/,'3001')}` if (type === 'github') { return `${newURL}/webhooks/github/events` } diff --git a/apps/ui/src/lib/components/Toasts.svelte b/apps/ui/src/lib/components/Toasts.svelte index 2fdec7190..856b0c261 100644 --- a/apps/ui/src/lib/components/Toasts.svelte +++ b/apps/ui/src/lib/components/Toasts.svelte @@ -9,7 +9,7 @@
diff --git a/apps/ui/src/lib/templates.ts b/apps/ui/src/lib/templates.ts index b2e27ad1c..e2c023032 100644 --- a/apps/ui/src/lib/templates.ts +++ b/apps/ui/src/lib/templates.ts @@ -293,6 +293,13 @@ export const buildPacks = [ hoverColor: 'hover:bg-green-700', color: 'bg-green-700' } + // }, + // { + // name: 'heroku', + // fancyName: 'Heroku Buildpack', + // hoverColor: 'hover:bg-indigo-700', + // color: 'bg-indigo-700' + // } ]; export const scanningTemplates = { '@sveltejs/kit': { diff --git a/apps/ui/src/routes/applications/[id]/logs/_BuildLog.svelte b/apps/ui/src/routes/applications/[id]/logs/_BuildLog.svelte index cb0056b6b..70ab93b2d 100644 --- a/apps/ui/src/routes/applications/[id]/logs/_BuildLog.svelte +++ b/apps/ui/src/routes/applications/[id]/logs/_BuildLog.svelte @@ -106,10 +106,10 @@ {#if currentStatus === 'queued'}
{$t('application.build.queued_waiting_exec')}
{:else} -
+