Skip to content

Commit

Permalink
v3.0.0 (coollabsio#476)
Browse files Browse the repository at this point in the history
* New Version: 3.0.0
  • Loading branch information
andrasbacsai authored Jul 6, 2022
1 parent 9137e8b commit 87ba456
Show file tree
Hide file tree
Showing 491 changed files with 16,770 additions and 20,405 deletions.
21 changes: 8 additions & 13 deletions .dockerignore
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
8 changes: 0 additions & 8 deletions .env.template

This file was deleted.

21 changes: 8 additions & 13 deletions .gitignore
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
1 change: 0 additions & 1 deletion .husky/_/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

5 changes: 0 additions & 5 deletions .lintstagedrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

First of all, thank you for considering contributing to my project! It means a lot 💜.

Contribution guide is for v2, not applicable for v3

## 🙋 Want to help?

If you begin in GitHub contribution, you can find the [first contribution](https://github.com/firstcontributions/first-contributions) and follow this guide.
Expand Down
35 changes: 18 additions & 17 deletions Dockerfile
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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An open-source & self-hostable Heroku / Netlify alternative.

https://demo.coolify.io/

(If it is unresponsive, that means someone overloaded the server. 🙃)
(If it is unresponsive, that means someone overloaded the server. 😄)

## Feedback

Expand All @@ -30,6 +30,8 @@ For more details goto the [docs](https://docs.coollabs.io/coolify/installation).

## Features

ARM support is in beta!

### Git Sources

You can use the following Git Sources to be auto-deployed to your Coolifyt instance! (Self-hosted versions are also supported.)
Expand Down Expand Up @@ -97,7 +99,7 @@ You can host cool open-source services as well:

## Migration from v1

A fresh installation is necessary. v2 is not compatible with v1.
A fresh installation is necessary. v2 and v3 are not compatible with v1.

## Support

Expand Down
9 changes: 9 additions & 0 deletions apps/api/.eslintignore
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
11 changes: 11 additions & 0 deletions apps/api/.eslintrc
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"
]
}
11 changes: 11 additions & 0 deletions apps/api/.gitignore
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 added apps/api/db/.gitkeep
Empty file.
7 changes: 7 additions & 0 deletions apps/api/nodemon.json
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
}
67 changes: 67 additions & 0 deletions apps/api/package.json
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.
75 changes: 75 additions & 0 deletions apps/api/prisma/seed.js
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();
});
Loading

0 comments on commit 87ba456

Please sign in to comment.