forked from coollabsio/coolify
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
491 changed files
with
16,770 additions
and
20,405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
.DS_Store | ||
node_modules | ||
/build | ||
/.svelte-kit | ||
/package | ||
/yarn.lock | ||
/.pnpm-store | ||
/ssl | ||
|
||
build | ||
.svelte-kit | ||
package | ||
.env | ||
.env.prod | ||
.env.stag | ||
/db/*.db | ||
/db/*.db-journal | ||
/data/haproxy/haproxy.cfg | ||
/data/haproxy/haproxy.cfg.lkg | ||
.env.* | ||
!.env.example | ||
dist | ||
client | ||
apps/api/db/*.db |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
.DS_Store | ||
node_modules | ||
/build | ||
/.svelte-kit | ||
/package | ||
/yarn.lock | ||
/.pnpm-store | ||
/ssl | ||
|
||
build | ||
.svelte-kit | ||
package | ||
.env | ||
.env.prod | ||
.env.stag | ||
/db/*.db | ||
/db/*.db-journal | ||
/data/haproxy/haproxy.cfg | ||
/data/haproxy/haproxy.cfg.lkg | ||
.env.* | ||
!.env.example | ||
dist | ||
client | ||
apps/api/db/*.db |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,43 @@ | ||
FROM node:16.14.2-alpine as install | ||
FROM node:18-alpine as build | ||
WORKDIR /app | ||
|
||
RUN apk add --no-cache curl | ||
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@6 | ||
RUN pnpm add -g pnpm | ||
RUN curl -sL https://unpkg.com/@pnpm/self-installer | node | ||
|
||
COPY package*.json . | ||
COPY . . | ||
RUN pnpm install | ||
RUN pnpm build | ||
|
||
FROM node:16.14.2-alpine | ||
ARG TARGETPLATFORM | ||
|
||
# Production build | ||
FROM node:18-alpine | ||
WORKDIR /app | ||
ENV NODE_ENV production | ||
ARG TARGETPLATFORM | ||
|
||
ENV PRISMA_QUERY_ENGINE_BINARY=/app/prisma-engines/query-engine \ | ||
PRISMA_MIGRATION_ENGINE_BINARY=/app/prisma-engines/migration-engine \ | ||
PRISMA_INTROSPECTION_ENGINE_BINARY=/app/prisma-engines/introspection-engine \ | ||
PRISMA_FMT_BINARY=/app/prisma-engines/prisma-fmt \ | ||
PRISMA_CLI_QUERY_ENGINE_TYPE=binary \ | ||
PRISMA_CLIENT_ENGINE_TYPE=binary | ||
|
||
COPY --from=coollabsio/prisma-engine:latest /prisma-engines/query-engine /prisma-engines/migration-engine /prisma-engines/introspection-engine /prisma-engines/prisma-fmt /app/prisma-engines/ | ||
|
||
COPY --from=install /app/node_modules ./node_modules | ||
COPY . . | ||
COPY --from=coollabsio/prisma-engine:3.15 /prisma-engines/query-engine /prisma-engines/migration-engine /prisma-engines/introspection-engine /prisma-engines/prisma-fmt /app/prisma-engines/ | ||
|
||
RUN apk add --no-cache git git-lfs openssh-client curl jq cmake sqlite openssl | ||
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@6 | ||
RUN pnpm add -g pnpm | ||
RUN curl -sL https://unpkg.com/@pnpm/self-installer | node | ||
|
||
RUN mkdir -p ~/.docker/cli-plugins/ | ||
RUN curl -SL https://cdn.coollabs.io/bin/$TARGETPLATFORM/docker-20.10.9 -o /usr/bin/docker | ||
RUN curl -SL https://cdn.coollabs.io/bin/$TARGETPLATFORM/docker-compose-linux-2.3.4 -o ~/.docker/cli-plugins/docker-compose | ||
RUN chmod +x ~/.docker/cli-plugins/docker-compose /usr/bin/docker | ||
|
||
RUN pnpm prisma generate | ||
RUN pnpm build | ||
|
||
COPY --from=build /app/apps/api/build/ . | ||
COPY --from=build /app/apps/ui/build/ ./public | ||
COPY --from=build /app/apps/api/prisma/ ./prisma | ||
COPY --from=build /app/apps/api/package.json . | ||
COPY --from=build /app/docker-compose.yaml . | ||
|
||
RUN pnpm install -p | ||
|
||
EXPOSE 3000 | ||
CMD ["pnpm", "start"] | ||
CMD pnpm start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
seed.js | ||
.DS_Store | ||
node_modules | ||
build | ||
.env | ||
.env.* | ||
!.env.example | ||
dist | ||
dev.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint", "prettier"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.DS_Store | ||
node_modules | ||
build | ||
.svelte-kit | ||
package | ||
.env | ||
.env.* | ||
!.env.example | ||
dist | ||
dev.db | ||
client |
File renamed without changes.
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"watch": ["src"], | ||
"ignore": ["src/**/*.test.ts"], | ||
"ext": "ts,mjs,json,graphql", | ||
"exec": "rimraf build && esbuild `find src \\( -name '*.ts' \\) | grep -v client/` --platform=node --outdir=build --format=cjs && node build", | ||
"legacyWatch": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"name": "coolify-api", | ||
"description": "Coolify's Fastify API", | ||
"license": "AGPL-3.0", | ||
"scripts": { | ||
"db:push": "prisma db push && prisma generate", | ||
"db:seed": "prisma db seed", | ||
"db:studio": "prisma studio", | ||
"dev": "nodemon", | ||
"build": "rimraf build && esbuild `find src \\( -name '*.ts' \\)| grep -v client/` --platform=node --outdir=build --format=cjs", | ||
"format": "prettier --write 'src/**/*.{js,ts,json,md}'", | ||
"lint": "prettier --check 'src/**/*.{js,ts,json,md}' && eslint --ignore-path .eslintignore .", | ||
"start": "NODE_ENV=production npx -y prisma migrate deploy && npx prisma generate && npx prisma db seed && node index.js" | ||
}, | ||
"dependencies": { | ||
"@breejs/ts-worker": "2.0.0", | ||
"@fastify/autoload": "5.0.0", | ||
"@fastify/cookie": "7.0.0", | ||
"@fastify/cors": "8.0.0", | ||
"@fastify/env": "4.0.0", | ||
"@fastify/jwt": "6.2.0", | ||
"@fastify/static": "6.4.0", | ||
"@iarna/toml": "2.2.5", | ||
"@prisma/client": "3.15.2", | ||
"axios": "0.27.2", | ||
"bcryptjs": "2.4.3", | ||
"bree": "9.1.1", | ||
"cabin": "9.1.2", | ||
"compare-versions": "4.1.3", | ||
"cuid": "2.1.8", | ||
"dayjs": "1.11.3", | ||
"dockerode": "3.3.2", | ||
"dotenv-extended": "2.9.0", | ||
"fastify": "4.2.0", | ||
"fastify-plugin": "3.0.1", | ||
"generate-password": "1.7.0", | ||
"get-port": "6.1.2", | ||
"got": "12.1.0", | ||
"is-ip": "4.0.0", | ||
"js-yaml": "4.1.0", | ||
"jsonwebtoken": "8.5.1", | ||
"node-forge": "1.3.1", | ||
"node-os-utils": "1.3.7", | ||
"p-queue": "7.2.0", | ||
"strip-ansi": "7.0.1", | ||
"unique-names-generator": "4.7.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "18.0.3", | ||
"@types/node-os-utils": "1.3.0", | ||
"@typescript-eslint/eslint-plugin": "5.30.5", | ||
"@typescript-eslint/parser": "5.30.5", | ||
"esbuild": "0.14.48", | ||
"eslint": "8.19.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"nodemon": "2.0.19", | ||
"prettier": "2.7.1", | ||
"prisma": "3.15.2", | ||
"rimraf": "3.0.2", | ||
"tsconfig-paths": "4.0.0", | ||
"typescript": "4.7.4" | ||
}, | ||
"prisma": { | ||
"seed": "node prisma/seed.js" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
const dotEnvExtended = require('dotenv-extended'); | ||
dotEnvExtended.load(); | ||
const crypto = require('crypto'); | ||
const generator = require('generate-password'); | ||
const cuid = require('cuid'); | ||
const { PrismaClient } = require('@prisma/client'); | ||
const prisma = new PrismaClient(); | ||
|
||
function generatePassword(length = 24) { | ||
return generator.generate({ | ||
length, | ||
numbers: true, | ||
strict: true | ||
}); | ||
} | ||
const algorithm = 'aes-256-ctr'; | ||
|
||
async function main() { | ||
// Enable registration for the first user | ||
// Set initial HAProxy password | ||
const settingsFound = await prisma.setting.findFirst({}); | ||
if (!settingsFound) { | ||
await prisma.setting.create({ | ||
data: { | ||
isRegistrationEnabled: true, | ||
isTraefikUsed: true, | ||
} | ||
}); | ||
} else { | ||
await prisma.setting.update({ | ||
where: { | ||
id: settingsFound.id | ||
}, | ||
data: { | ||
isTraefikUsed: true, | ||
proxyHash: null | ||
} | ||
}); | ||
} | ||
const localDocker = await prisma.destinationDocker.findFirst({ | ||
where: { engine: '/var/run/docker.sock' } | ||
}); | ||
if (!localDocker) { | ||
await prisma.destinationDocker.create({ | ||
data: { | ||
engine: '/var/run/docker.sock', | ||
name: 'Local Docker', | ||
isCoolifyProxyUsed: true, | ||
network: 'coolify' | ||
} | ||
}); | ||
} | ||
|
||
// Set auto-update based on env variable | ||
const isAutoUpdateEnabled = process.env['COOLIFY_AUTO_UPDATE'] === 'true'; | ||
const settings = await prisma.setting.findFirst({}); | ||
if (settings) { | ||
await prisma.setting.update({ | ||
where: { | ||
id: settings.id | ||
}, | ||
data: { | ||
isAutoUpdateEnabled | ||
} | ||
}); | ||
} | ||
} | ||
main() | ||
.catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}) | ||
.finally(async () => { | ||
await prisma.$disconnect(); | ||
}); |
Oops, something went wrong.