mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-18 12:33:06 +00:00
Compare commits
270 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
272b2bb65d | ||
|
|
5d5a478cd1 | ||
|
|
ddd09412cd | ||
|
|
d6cfc2624f | ||
|
|
e92d0914c2 | ||
|
|
0a44867240 | ||
|
|
bb210085b0 | ||
|
|
bfa5fb6f16 | ||
|
|
168eec3fe0 | ||
|
|
4a2696a58e | ||
|
|
6d2b453361 | ||
|
|
61c3f57f4a | ||
|
|
95d29363aa | ||
|
|
d431de8ea5 | ||
|
|
518fdf676a | ||
|
|
b4d658cea1 | ||
|
|
3f7cd317d6 | ||
|
|
de4c195641 | ||
|
|
45be1cb49a | ||
|
|
7dd19c322d | ||
|
|
fb299cdf4c | ||
|
|
2b1c46e1ab | ||
|
|
5d43ea551a | ||
|
|
e861c3fc0f | ||
|
|
5590acd182 | ||
|
|
6b42f4dc5b | ||
|
|
9771bea60a | ||
|
|
06a344c0d6 | ||
|
|
a205a7d514 | ||
|
|
d3da679aae | ||
|
|
34ad5bc86b | ||
|
|
0c4203a351 | ||
|
|
89e7210e5e | ||
|
|
8de13dab17 | ||
|
|
80165978d3 | ||
|
|
6b1bea2195 | ||
|
|
9211a79b21 | ||
|
|
277b8b927e | ||
|
|
67f3bec9f1 | ||
|
|
2135efcb3f | ||
|
|
7dbde842d7 | ||
|
|
9eeadd5882 | ||
|
|
a9ef490988 | ||
|
|
2da24cc4bd | ||
|
|
b0ef5722fb | ||
|
|
91d135bff8 | ||
|
|
a19803e08a | ||
|
|
4049af6220 | ||
|
|
839e8179fe | ||
|
|
92de957ae7 | ||
|
|
1c28c679c0 | ||
|
|
9eeef96c07 | ||
|
|
99bc374664 | ||
|
|
b999e7dab1 | ||
|
|
64e4efeb36 | ||
|
|
76d134fcda | ||
|
|
bafb792e49 | ||
|
|
424195880b | ||
|
|
b1acfba791 | ||
|
|
8c6724d284 | ||
|
|
cbc5bed16f | ||
|
|
cd50242d4d | ||
|
|
670eac44be | ||
|
|
de77cbb9d8 | ||
|
|
3d488da5ab | ||
|
|
c3bb81f84d | ||
|
|
68a117a61d | ||
|
|
b07ad4e3fa | ||
|
|
71ce2eb0a7 | ||
|
|
453e7264b2 | ||
|
|
b3ebaa1fca | ||
|
|
c53acbcd95 | ||
|
|
4b37e84466 | ||
|
|
4356207611 | ||
|
|
2f32a8c884 | ||
|
|
507e5bfebf | ||
|
|
a906468063 | ||
|
|
e5b505b003 | ||
|
|
641dc98e9c | ||
|
|
d5a1d02b09 | ||
|
|
ba049341f5 | ||
|
|
fa3dd914c9 | ||
|
|
1b9507d85a | ||
|
|
aef6cd1028 | ||
|
|
a5e44f7820 | ||
|
|
baf40eb6d4 | ||
|
|
44052b57c5 | ||
|
|
d8b60a919b | ||
|
|
f07ec0f9c3 | ||
|
|
a643729b4c | ||
|
|
26122bf985 | ||
|
|
adb60ad8d7 | ||
|
|
c02ea4289e | ||
|
|
8645d954dd | ||
|
|
097d7b547a | ||
|
|
003a8e4554 | ||
|
|
681fcb5a0e | ||
|
|
5b813d3d0f | ||
|
|
cef87d9671 | ||
|
|
cf140ff4cf | ||
|
|
9168cd1dc6 | ||
|
|
12273f424e | ||
|
|
f672d01777 | ||
|
|
899f894e51 | ||
|
|
d833f33eb2 | ||
|
|
580545bb57 | ||
|
|
e77c18eb72 | ||
|
|
502764ed56 | ||
|
|
576aa97694 | ||
|
|
101694c998 | ||
|
|
5f3aae066a | ||
|
|
2e7c96b2eb | ||
|
|
e47395bab7 | ||
|
|
dd2a876a67 | ||
|
|
fc9bbac372 | ||
|
|
185ff9da27 | ||
|
|
55bbef788f | ||
|
|
46205f7395 | ||
|
|
fa65c10a0b | ||
|
|
e53f3a6b2b | ||
|
|
9bc0aa131e | ||
|
|
d4f0808c31 | ||
|
|
eef99caad1 | ||
|
|
0a369b632d | ||
|
|
488ce1961a | ||
|
|
5bc44ac70d | ||
|
|
83a776ff9f | ||
|
|
1d30c1fc44 | ||
|
|
3c18ef81ce | ||
|
|
9e3ba295ea | ||
|
|
bb2864a83f | ||
|
|
c0e513127d | ||
|
|
4b57b8fe3d | ||
|
|
54772ab8ab | ||
|
|
a02bcc3d02 | ||
|
|
df01139c41 | ||
|
|
ac1991291d | ||
|
|
44e82005c4 | ||
|
|
7ba550945e | ||
|
|
b5b7338e92 | ||
|
|
1950429e1d | ||
|
|
b8b1670b2d | ||
|
|
890ea2e2d4 | ||
|
|
4df32a9bc0 | ||
|
|
7795c524f0 | ||
|
|
9a0a145374 | ||
|
|
427d73c3ed | ||
|
|
537209d3fb | ||
|
|
0a8fd0516d | ||
|
|
d624f95cb9 | ||
|
|
bedbe46830 | ||
|
|
7846bf1bc3 | ||
|
|
c28bc786ae | ||
|
|
60a53bb812 | ||
|
|
017ba61dc9 | ||
|
|
b5d82dc87b | ||
|
|
866070b9ea | ||
|
|
49ecb15773 | ||
|
|
047df77195 | ||
|
|
0904d1ff9c | ||
|
|
7bf6041d8c | ||
|
|
90597389c9 | ||
|
|
039350d762 | ||
|
|
ce31146a9c | ||
|
|
344dd7db28 | ||
|
|
b735ca2da7 | ||
|
|
cbdd098528 | ||
|
|
d5f9d57be9 | ||
|
|
d5f2d22663 | ||
|
|
9914686ed7 | ||
|
|
ee9acfe556 | ||
|
|
9f9d4297ca | ||
|
|
002637ec5f | ||
|
|
c1238c6594 | ||
|
|
c43b848708 | ||
|
|
e22950cecb | ||
|
|
5a7edcb762 | ||
|
|
9b47de71fc | ||
|
|
8f9462245a | ||
|
|
f0ed51cd22 | ||
|
|
99a7eff6ab | ||
|
|
edfed57df3 | ||
|
|
a70e35cb79 | ||
|
|
3da1b31363 | ||
|
|
59bc2dd8a7 | ||
|
|
7b6e7680a6 | ||
|
|
1c65df282e | ||
|
|
77ae070c98 | ||
|
|
20708f1456 | ||
|
|
9a1a67a4ef | ||
|
|
3a8e5df897 | ||
|
|
88a62be30c | ||
|
|
c478c1b7ad | ||
|
|
18c2b2e38e | ||
|
|
b105e6fbf8 | ||
|
|
da11bae67c | ||
|
|
d344a9bb4f | ||
|
|
222adb212b | ||
|
|
cb01bbe4ac | ||
|
|
c63237684a | ||
|
|
792d51d93f | ||
|
|
62bfb5dacc | ||
|
|
d7fa80703d | ||
|
|
52b712d90b | ||
|
|
331e13b7cb | ||
|
|
64bb4a2525 | ||
|
|
31d7e7e806 | ||
|
|
e740788d6c | ||
|
|
928d53e532 | ||
|
|
87ba4560ad | ||
|
|
9137e8bc32 | ||
|
|
35bd2b23d5 | ||
|
|
10a514d9ac | ||
|
|
71096acdff | ||
|
|
07da696397 | ||
|
|
41baf150c2 | ||
|
|
f0a52b2ef4 | ||
|
|
54e83fdff1 | ||
|
|
46327ff2fc | ||
|
|
8b26acc841 | ||
|
|
b90cb5a731 | ||
|
|
cd9b642c5e | ||
|
|
41a928d41b | ||
|
|
1388bee62c | ||
|
|
8ebc778d40 | ||
|
|
3a59091b41 | ||
|
|
e764c4651c | ||
|
|
10f04d2177 | ||
|
|
119f994b50 | ||
|
|
e39541c318 | ||
|
|
cf88885c94 | ||
|
|
1192346ce3 | ||
|
|
0e3bd85847 | ||
|
|
edeb6c6965 | ||
|
|
138fd5cb6d | ||
|
|
155410bd44 | ||
|
|
20bd829c2e | ||
|
|
7b7e222946 | ||
|
|
98d901d06c | ||
|
|
4e862cda6f | ||
|
|
4e940807ae | ||
|
|
b081743f54 | ||
|
|
34bb9f301f | ||
|
|
ed8a6daeea | ||
|
|
9e81ab43ac | ||
|
|
32d94cbe97 | ||
|
|
46a83aa457 | ||
|
|
08d7593ca9 | ||
|
|
a50f7a7cc2 | ||
|
|
2c33447f9f | ||
|
|
d67a3f51ec | ||
|
|
2719974262 | ||
|
|
eb5aebd58d | ||
|
|
98dbf3d8a5 | ||
|
|
d9489a2cb4 | ||
|
|
95832d34f7 | ||
|
|
d3e9aea63d | ||
|
|
d6972e2ed1 | ||
|
|
50844e98be | ||
|
|
5c6fcfebf9 | ||
|
|
84cfe6fb42 | ||
|
|
abf0aeb2a8 | ||
|
|
a7aca0ce8b | ||
|
|
67bb5d973b | ||
|
|
662948d622 | ||
|
|
f5bedfdf7f | ||
|
|
da86f0076b | ||
|
|
9d8551a9be | ||
|
|
c376123877 | ||
|
|
cd3663038f |
@@ -14,7 +14,14 @@
|
|||||||
// Set *default* container specific settings.json values on container create.
|
// Set *default* container specific settings.json values on container create.
|
||||||
"settings": {},
|
"settings": {},
|
||||||
// Add the IDs of extensions you want installed when the container is created.
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
"extensions": ["dbaeumer.vscode-eslint", "svelte.svelte-vscode"],
|
"extensions": [
|
||||||
|
"ms-azuretools.vscode-docker",
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
"svelte.svelte-vscode",
|
||||||
|
"ardenivanov.svelte-intellisense",
|
||||||
|
"Prisma.prisma",
|
||||||
|
"bradlc.vscode-tailwindcss"
|
||||||
|
],
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
"forwardPorts": [3000],
|
"forwardPorts": [3000],
|
||||||
// Use 'postCreateCommand' to run commands after the container is created.
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
/build
|
build
|
||||||
/.svelte-kit
|
.svelte-kit
|
||||||
/package
|
package
|
||||||
/yarn.lock
|
|
||||||
/.pnpm-store
|
|
||||||
/ssl
|
|
||||||
|
|
||||||
.env
|
.env
|
||||||
.env.prod
|
.env.*
|
||||||
.env.stag
|
!.env.example
|
||||||
/db/*.db
|
dist
|
||||||
/db/*.db-journal
|
client
|
||||||
/data/haproxy/haproxy.cfg
|
apps/api/db/*.db
|
||||||
/data/haproxy/haproxy.cfg.lkg
|
local-serve
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
COOLIFY_APP_ID=
|
|
||||||
COOLIFY_SECRET_KEY=12341234123412341234123412341234
|
|
||||||
COOLIFY_DATABASE_URL=file:../db/dev.db
|
|
||||||
COOLIFY_SENTRY_DSN=
|
|
||||||
COOLIFY_IS_ON=docker
|
|
||||||
COOLIFY_WHITE_LABELED=false
|
|
||||||
COOLIFY_WHITE_LABELED_ICON=
|
|
||||||
COOLIFY_AUTO_UPDATE=false
|
|
||||||
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@@ -1 +1,2 @@
|
|||||||
open_collective: coollabsio
|
open_collective: coollabsio
|
||||||
|
github: coollabsio
|
||||||
4
.github/ISSUE_TEMPLATE/config.yml
vendored
4
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -3,6 +3,6 @@ contact_links:
|
|||||||
- name: 🤔 Questions and Help
|
- name: 🤔 Questions and Help
|
||||||
url: https://discord.com/invite/6rDM4fkymF
|
url: https://discord.com/invite/6rDM4fkymF
|
||||||
about: Reach out to us on discord or our github discussions page.
|
about: Reach out to us on discord or our github discussions page.
|
||||||
- name: 🙋♂️ service request
|
- name: 🙋♂️ Service request
|
||||||
url: https://feedback.coolify.io/
|
url: https://feedback.coolify.io/
|
||||||
about: want to request a new service? for e.g wordpress, hasura, appwrite etc...
|
about: Want to request a new service or build pack? For example Wordpress, Hasura, Appwrite, Angular etc...
|
||||||
|
|||||||
@@ -1,34 +1,28 @@
|
|||||||
name: release-coolify
|
name: production-release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: published
|
types: [published]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
make-it-coolifyed:
|
making-something-cool:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
- name: Set up QEMU
|
||||||
name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
-
|
- name: Set up Docker Buildx
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
-
|
- name: Login to DockerHub
|
||||||
name: Login to DockerHub
|
uses: docker/login-action@v1
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
-
|
- name: Get current package version
|
||||||
name: Get current package version
|
uses: martinbeentjes/npm-get-version-action@v1.2.3
|
||||||
uses: martinbeentjes/npm-get-version-action@v1.2.3
|
id: package-version
|
||||||
id: package-version
|
- name: Build and push
|
||||||
-
|
|
||||||
name: Build and push
|
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@@ -37,3 +31,7 @@ jobs:
|
|||||||
tags: coollabsio/coolify:latest,coollabsio/coolify:${{steps.package-version.outputs.current-version}}
|
tags: coollabsio/coolify:latest,coollabsio/coolify:${{steps.package-version.outputs.current-version}}
|
||||||
cache-from: type=registry,ref=coollabsio/coolify:buildcache
|
cache-from: type=registry,ref=coollabsio/coolify:buildcache
|
||||||
cache-to: type=registry,ref=coollabsio/coolify:buildcache,mode=max
|
cache-to: type=registry,ref=coollabsio/coolify:buildcache,mode=max
|
||||||
|
- uses: sarisia/actions-status-discord@v1
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
webhook: ${{ secrets.DISCORD_WEBHOOK_DEV_CHANNEL }}
|
||||||
35
.github/workflows/staging-release.yml
vendored
Normal file
35
.github/workflows/staging-release.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: staging-release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- next
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
staging-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: coollabsio/coolify:next
|
||||||
|
cache-from: type=registry,ref=coollabsio/coolify:buildcache-next
|
||||||
|
cache-to: type=registry,ref=coollabsio/coolify:buildcache-next,mode=max
|
||||||
|
- uses: sarisia/actions-status-discord@v1
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
webhook: ${{ secrets.DISCORD_WEBHOOK_DEV_CHANNEL }}
|
||||||
23
.gitignore
vendored
23
.gitignore
vendored
@@ -1,16 +1,13 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
/build
|
build
|
||||||
/.svelte-kit
|
.svelte-kit
|
||||||
/package
|
package
|
||||||
/yarn.lock
|
|
||||||
/.pnpm-store
|
|
||||||
/ssl
|
|
||||||
|
|
||||||
.env
|
.env
|
||||||
.env.prod
|
.env.*
|
||||||
.env.stag
|
!.env.example
|
||||||
/db/*.db
|
dist
|
||||||
/db/*.db-journal
|
client
|
||||||
/data/haproxy/haproxy.cfg
|
apps/api/db/*.db
|
||||||
/data/haproxy/haproxy.cfg.lkg
|
local-serve
|
||||||
|
apps/api/db/migration.db-journal
|
||||||
13
.gitpod.yml
Normal file
13
.gitpod.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# This configuration file was automatically generated by Gitpod.
|
||||||
|
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
|
||||||
|
# and commit this file to your remote git repository to share the goodness with others.
|
||||||
|
image: gitpod/workspace-node:2022-06-20-19-54-55
|
||||||
|
tasks:
|
||||||
|
- init: pnpm install && pnpm db:push && pnpm db:seed
|
||||||
|
command: pnpm dev
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- port: 3001
|
||||||
|
visibility: public
|
||||||
|
- port: 3000
|
||||||
|
visibility: public
|
||||||
1
.husky/_/.gitignore
vendored
1
.husky/_/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
*
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
|
||||||
|
|
||||||
pnpm lint-staged
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"**/*.{js,jsx,ts,tsx,cjs,svelte,json,css,scss,md,yaml}": [
|
|
||||||
"prettier --ignore-path .gitignore --write --plugin-search-dir=."
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
First of all, thank you for considering contributing to my project! It means a lot 💜.
|
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?
|
## 🙋 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.
|
If you begin in GitHub contribution, you can find the [first contribution](https://github.com/firstcontributions/first-contributions) and follow this guide.
|
||||||
|
|||||||
41
Dockerfile
41
Dockerfile
@@ -1,17 +1,18 @@
|
|||||||
FROM node:16.14.2-alpine as install
|
FROM node:18-alpine3.16 as build
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apk add --no-cache curl
|
RUN apk add --no-cache curl
|
||||||
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@6
|
RUN curl -sL https://unpkg.com/@pnpm/self-installer | node
|
||||||
RUN pnpm add -g pnpm
|
|
||||||
|
|
||||||
COPY package*.json .
|
COPY . .
|
||||||
RUN pnpm install
|
RUN pnpm install
|
||||||
|
RUN pnpm build
|
||||||
|
|
||||||
FROM node:16.14.2-alpine
|
# Production build
|
||||||
ARG TARGETPLATFORM
|
FROM node:18-alpine3.16
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
ENV NODE_ENV production
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
ENV PRISMA_QUERY_ENGINE_BINARY=/app/prisma-engines/query-engine \
|
ENV PRISMA_QUERY_ENGINE_BINARY=/app/prisma-engines/query-engine \
|
||||||
PRISMA_MIGRATION_ENGINE_BINARY=/app/prisma-engines/migration-engine \
|
PRISMA_MIGRATION_ENGINE_BINARY=/app/prisma-engines/migration-engine \
|
||||||
@@ -19,24 +20,28 @@ ENV PRISMA_QUERY_ENGINE_BINARY=/app/prisma-engines/query-engine \
|
|||||||
PRISMA_FMT_BINARY=/app/prisma-engines/prisma-fmt \
|
PRISMA_FMT_BINARY=/app/prisma-engines/prisma-fmt \
|
||||||
PRISMA_CLI_QUERY_ENGINE_TYPE=binary \
|
PRISMA_CLI_QUERY_ENGINE_TYPE=binary \
|
||||||
PRISMA_CLIENT_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 --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/
|
||||||
COPY . .
|
|
||||||
|
RUN apk add --no-cache git git-lfs openssh-client curl jq cmake sqlite openssl psmisc
|
||||||
|
RUN curl -sL https://unpkg.com/@pnpm/self-installer | node
|
||||||
|
|
||||||
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 mkdir -p ~/.docker/cli-plugins/
|
RUN mkdir -p ~/.docker/cli-plugins/
|
||||||
|
# https://download.docker.com/linux/static/stable/
|
||||||
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-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
|
# https://github.com/docker/compose/releases
|
||||||
|
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 chmod +x ~/.docker/cli-plugins/docker-compose /usr/bin/docker
|
||||||
|
|
||||||
RUN pnpm prisma generate
|
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)
|
||||||
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
|
EXPOSE 3000
|
||||||
CMD ["pnpm", "start"]
|
CMD pnpm start
|
||||||
862
LICENSE
862
LICENSE
@@ -1,661 +1,201 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
Apache License
|
||||||
Version 3, 19 November 2007
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
1. Definitions.
|
||||||
Preamble
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
software and other kinds of works, specifically designed to ensure
|
|
||||||
cooperation with the community in the case of network server software.
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
other entities that control, are controlled by, or are under common
|
||||||
share and change all versions of a program--to make sure it remains free
|
control with that entity. For the purposes of this definition,
|
||||||
software for all its users.
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
When we speak of free software, we are referring to freedom, not
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
want it, that you can change the software or use pieces of it in new
|
exercising permissions granted by this License.
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
Developers that use our General Public Licenses protect your rights
|
including but not limited to software source code, documentation
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
source, and configuration files.
|
||||||
you this License which gives you legal permission to copy, distribute
|
|
||||||
and/or modify the software.
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
A secondary benefit of defending all users' freedom is that
|
not limited to compiled object code, generated documentation,
|
||||||
improvements made in alternate versions of the program, if they
|
and conversions to other media types.
|
||||||
receive widespread use, become available for other developers to
|
|
||||||
incorporate. Many developers of free software are heartened and
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
Object form, made available under the License, as indicated by a
|
||||||
software used on network servers, this result may fail to come about.
|
copyright notice that is included in or attached to the work
|
||||||
The GNU General Public License permits making a modified version and
|
(an example is provided in the Appendix below).
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
The GNU Affero General Public License is designed specifically to
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
ensure that, in such cases, the modified source code becomes available
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
to the community. It requires the operator of a network server to
|
of this License, Derivative Works shall not include works that remain
|
||||||
provide the source code of the modified version running there to the
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
users of that server. Therefore, public use of a modified version, on
|
the Work and Derivative Works thereof.
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
An older license, called the Affero General Public License and
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
this license.
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
The precise terms and conditions for copying, distribution and
|
communication on electronic mailing lists, source code control systems,
|
||||||
modification follow.
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
TERMS AND CONDITIONS
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
0. Definitions.
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
"recipients" may be individuals or organizations.
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
earlier work or a work "based on" the earlier work.
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
A "covered work" means either the unmodified Program or a work based
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
on the Program.
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
To "propagate" a work means to do anything with it that, without
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
permission, would make you directly or secondarily liable for
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
infringement under applicable copyright law, except executing it on a
|
institute patent litigation against any entity (including a
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
distribution (with or without modification), making available to the
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
public, and in some countries other activities as well.
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
To "convey" a work means any kind of propagation that enables other
|
as of the date such litigation is filed.
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
modifications, and in Source or Object form, provided that You
|
||||||
to the extent that it includes a convenient and prominently visible
|
meet the following conditions:
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
(a) You must give any other recipients of the Work or
|
||||||
extent that warranties are provided), that licensees may convey the
|
Derivative Works a copy of this License; and
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
(b) You must cause any modified files to carry prominent notices
|
||||||
menu, a prominent item in the list meets this criterion.
|
stating that You changed the files; and
|
||||||
|
|
||||||
1. Source Code.
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
The "source code" for a work means the preferred form of the work
|
attribution notices from the Source form of the Work,
|
||||||
for making modifications to it. "Object code" means any non-source
|
excluding those notices that do not pertain to any part of
|
||||||
form of a work.
|
the Derivative Works; and
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
standard defined by a recognized standards body, or, in the case of
|
distribution, then any Derivative Works that You distribute must
|
||||||
interfaces specified for a particular programming language, one that
|
include a readable copy of the attribution notices contained
|
||||||
is widely used among developers working in that language.
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
The "System Libraries" of an executable work include anything, other
|
of the following places: within a NOTICE text file distributed
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
as part of the Derivative Works; within the Source form or
|
||||||
packaging a Major Component, but which is not part of that Major
|
documentation, if provided along with the Derivative Works; or,
|
||||||
Component, and (b) serves only to enable use of the work with that
|
within a display generated by the Derivative Works, if and
|
||||||
Major Component, or to implement a Standard Interface for which an
|
wherever such third-party notices normally appear. The contents
|
||||||
implementation is available to the public in source code form. A
|
of the NOTICE file are for informational purposes only and
|
||||||
"Major Component", in this context, means a major essential component
|
do not modify the License. You may add Your own attribution
|
||||||
(kernel, window system, and so on) of the specific operating system
|
notices within Derivative Works that You distribute, alongside
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
produce the work, or an object code interpreter used to run it.
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
You may add Your own copyright statement to Your modifications and
|
||||||
work) run the object code and to modify the work, including scripts to
|
may provide additional or different license terms and conditions
|
||||||
control those activities. However, it does not include the work's
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
System Libraries, or general-purpose tools or generally available free
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
programs which are used unmodified in performing those activities but
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
which are not part of the work. For example, Corresponding Source
|
the conditions stated in this License.
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
linked subprograms that the work is specifically designed to require,
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
such as by intimate data communication or control flow between those
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
subprograms and other parts of the work.
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
The Corresponding Source need not include anything that users
|
the terms of any separate license agreement you may have executed
|
||||||
can regenerate automatically from other parts of the Corresponding
|
with Licensor regarding such Contributions.
|
||||||
Source.
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
The Corresponding Source for a work in source code form is that
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
same work.
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
2. Basic Permissions.
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
All rights granted under this License are granted for the term of
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
permission to run the unmodified Program. The output from running a
|
implied, including, without limitation, any warranties or conditions
|
||||||
covered work is covered by this License only if the output, given its
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
content, constitutes a covered work. This License acknowledges your
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
in force. You may convey covered works to others for the sole purpose
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
of having them make modifications exclusively for you, or provide you
|
unless required by applicable law (such as deliberate and grossly
|
||||||
with facilities for running those works, provided that you comply with
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
the terms of this License in conveying all material for which you do
|
liable to You for damages, including any direct, indirect, special,
|
||||||
not control copyright. Those thus making or running the covered works
|
incidental, or consequential damages of any character arising as a
|
||||||
for you must do so exclusively on your behalf, under your direction
|
result of this License or out of the use or inability to use the
|
||||||
and control, on terms that prohibit them from making any copies of
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
your copyrighted material outside their relationship with you.
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
Conveying under any other circumstances is permitted solely under
|
has been advised of the possibility of such damages.
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
No covered work shall be deemed part of an effective technological
|
License. However, in accepting such obligations, You may act only
|
||||||
measure under any applicable law fulfilling obligations under article
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
similar laws prohibiting or restricting circumvention of such
|
defend, and hold each Contributor harmless for any liability
|
||||||
measures.
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
END OF TERMS AND CONDITIONS
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
To apply the Apache License to your work, attach the following
|
||||||
technological measures.
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
4. Conveying Verbatim Copies.
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
You may convey verbatim copies of the Program's source code as you
|
file or class name and description of purpose be included on the
|
||||||
receive it, in any medium, provided that you conspicuously and
|
same "printed page" as the copyright notice for easier
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
identification within third-party archives.
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
Copyright [2022] [Andras Bacsai]
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
You may charge any price or no price for each copy that you convey,
|
You may obtain a copy of the License at
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
You may convey a work based on the Program, or the modifications to
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
produce it from the Program, in the form of source code under the
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the work with which it is combined will remain governed by version
|
|
||||||
3 of the GNU General Public License.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU Affero General Public License from time to time. Such new versions
|
|
||||||
will be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU Affero General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU Affero General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU Affero General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published
|
|
||||||
by the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
|
||||||
network, you should also make sure that it provides a way for users to
|
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
|
||||||
of the code. There are many ways you could offer source, and different
|
|
||||||
solutions will be better for different programs; see section 13 for the
|
|
||||||
specific requirements.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
105
README.md
105
README.md
@@ -1,17 +1,45 @@
|
|||||||
# Coolify
|
# Coolify
|
||||||
|
|
||||||
An open-source & self-hostable Heroku / Netlify alternative.
|
An open-source & self-hostable Heroku / Netlify alternative
|
||||||
|
(ARM support is in beta).
|
||||||
|
|
||||||
|
## Financial Contributors
|
||||||
|
|
||||||
|
Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/coollabsio/contribute)]
|
||||||
|
|
||||||
|
### Individuals
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/coollabsio"><img src="https://opencollective.com/coollabsio/individuals.svg?width=890"></a>
|
||||||
|
|
||||||
|
### Organizations
|
||||||
|
|
||||||
|
Support this project with your organization. Your logo will show up here with a link to your website.
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/coollabsio/organization/0/website"><img src="https://opencollective.com/coollabsio/organization/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/coollabsio/organization/1/website"><img src="https://opencollective.com/coollabsio/organization/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/coollabsio/organization/2/website"><img src="https://opencollective.com/coollabsio/organization/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/coollabsio/organization/3/website"><img src="https://opencollective.com/coollabsio/organization/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/coollabsio/organization/4/website"><img src="https://opencollective.com/coollabsio/organization/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/coollabsio/organization/5/website"><img src="https://opencollective.com/coollabsio/organization/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/coollabsio/organization/6/website"><img src="https://opencollective.com/coollabsio/organization/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/coollabsio/organization/7/website"><img src="https://opencollective.com/coollabsio/organization/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/coollabsio/organization/8/website"><img src="https://opencollective.com/coollabsio/organization/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/coollabsio/organization/9/website"><img src="https://opencollective.com/coollabsio/organization/9/avatar.svg"></a>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Live Demo
|
## Live Demo
|
||||||
|
|
||||||
https://demo.coolify.io/
|
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
|
## Feedback
|
||||||
|
|
||||||
If you have a new service / build pack you would like to add, raise an idea [here](https://feedback.coolify.io/) to get feedback from the community!
|
If you have a new service / build pack you would like to add, raise an idea [here](https://feedback.coolify.io/) to get feedback from the community!
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## How to install
|
## How to install
|
||||||
|
|
||||||
Installation is automated with the following command:
|
Installation is automated with the following command:
|
||||||
@@ -28,58 +56,65 @@ wget -q https://get.coollabs.io/coolify/install.sh -O install.sh; sudo bash ./in
|
|||||||
|
|
||||||
For more details goto the [docs](https://docs.coollabs.io/coolify/installation).
|
For more details goto the [docs](https://docs.coollabs.io/coolify/installation).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
### Git Sources
|
### Git Sources
|
||||||
|
|
||||||
You can use the following Git Sources to be auto-deployed to your Coolifyt instance! (Self-hosted versions are also supported.)
|
You can use the following Git Sources to be auto-deployed to your Coolify instance! (Self-hosted versions are also supported.)
|
||||||
|
|
||||||
- Github
|
<a href="https://github.com"><img style="width:40px;height:40px" src="https://icon.horse/icon/github.com"></a>
|
||||||
- GitLab
|
<a href="https://gitlab.com"><img style="width:40px;height:40px" src="https://icon.horse/icon/gitlab.com"></a>
|
||||||
- Bitbucket (WIP)
|
|
||||||
|
|
||||||
### Destinations
|
### Destinations
|
||||||
|
|
||||||
You can deploy your applications to the following destinations:
|
You can deploy your applications to the following destinations:
|
||||||
|
|
||||||
- Local Docker Engine
|
- Local Docker Engine
|
||||||
- Remote Docker Engine (WIP)
|
- Remote Docker Engine
|
||||||
- Kubernetes (WIP)
|
|
||||||
|
|
||||||
### Applications
|
### Applications
|
||||||
|
|
||||||
These are the predefined build packs, but with the Docker build pack, you can host anything that is hostable with a single Dockerfile.
|
Predefined build packs to cover the basic needs to deploy applications.
|
||||||
|
|
||||||
- Static sites
|
If you have an advanced use case, you can use the Docker build pack that allows you to deploy your application based on your custom Dockerfile.
|
||||||
- NodeJS
|
|
||||||
- VueJS
|
<a href="https://html5.org/">
|
||||||
- NuxtJS
|
<svg style="width:40px;height:40px" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" ><g clip-path="url(#HTML5_Clip0_4)" ><path d="M30.216 0L27.6454 28.7967L16.0907 32L4.56783 28.8012L2 0H30.216Z" fill="#E44D26" /><path d="M16.108 29.5515L25.4447 26.963L27.6415 2.35497H16.108V29.5515Z" fill="#F16529" /><path d="M11.1109 9.4197H16.108V5.88731H7.25053L7.33509 6.83499L8.20327 16.5692H16.108V13.0369H11.4338L11.1109 9.4197Z" fill="#EBEBEB" /><path d="M11.907 18.3354H8.36111L8.856 23.8818L16.0917 25.8904L16.108 25.8859V22.2108L16.0925 22.2149L12.1585 21.1527L11.907 18.3354Z" fill="#EBEBEB" /><path d="M16.0958 16.5692H20.4455L20.0354 21.1504L16.0958 22.2138V25.8887L23.3373 23.8817L23.3904 23.285L24.2205 13.9855L24.3067 13.0369H16.0958V16.5692Z" fill="white" /><path d="M16.0958 9.41105V9.41969H24.6281L24.6989 8.62572L24.8599 6.83499L24.9444 5.88731H16.0958V9.41105Z" fill="white" /></g><defs><clipPath id="HTML5_Clip0_4"><rect width="32" height="32" fill="white" /></clipPath></defs></svg></a>
|
||||||
- NextJS
|
<a href="https://nodejs.org"><img style="width:40px;height:40px" src="https://icon.horse/icon/nodejs.org"></a>
|
||||||
- React/Preact
|
<a href="https://vuejs.org"><img style="width:40px;height:40px" src="https://icon.horse/icon/vuejs.org"></a>
|
||||||
- Gatsby
|
<a href="https://nuxtjs.org"><img style="width:40px;height:40px" src="https://icon.horse/icon/nuxtjs.org"></a>
|
||||||
- Svelte
|
<a href="https://nextjs.org"><img style="width:40px;height:40px" src="https://icon.horse/icon/nextjs.org"></a>
|
||||||
- PHP
|
<a href="https://reactjs.org"><img style="width:40px;height:40px" src="https://icon.horse/icon/reactjs.org"></a>
|
||||||
- Laravel
|
<a href="https://preactjs.org"><img style="width:40px;height:40px" src="https://icon.horse/icon/preactjs.org"></a>
|
||||||
- Rust
|
<a href="https://gatsbyjs.org"><img style="width:40px;height:40px" src="https://icon.horse/icon/gatsbyjs.org"></a>
|
||||||
- Docker
|
<a href="https://svelte.dev"><img style="width:40px;height:40px" src="https://icon.horse/icon/svelte.dev"></a>
|
||||||
- Python
|
<a href="https://php.net"><img style="width:40px;height:40px" src="https://icon.horse/icon/php.net"></a>
|
||||||
- Deno
|
<a href="https://laravel.com"><img style="width:40px;height:40px" src="https://icon.horse/icon/laravel.com"></a>
|
||||||
|
<a href="https://python.org"><img style="width:40px;height:40px" src="https://icon.horse/icon/python.org"></a>
|
||||||
|
<a href="https://deno.com"><img style="width:40px;height:40px" src="https://icon.horse/icon/deno.com"></a>
|
||||||
|
<a href="https://docker.com"><img style="width:40px;height:40px" src="https://icon.horse/icon/docker.com"></a>
|
||||||
|
|
||||||
|
If you have a new build pack you would like to add, raise an idea [here](https://feedback.coolify.io/) to get feedback from the community!
|
||||||
|
|
||||||
### Databases
|
### Databases
|
||||||
|
|
||||||
One-click database is ready to be used internally or shared over the internet:
|
One-click database is ready to be used internally or shared over the internet:
|
||||||
|
|
||||||
- MongoDB
|
<a href="https://mongodb.org"><img style="width:40px;height:40px" src="https://icon.horse/icon/mongodb.org"></a>
|
||||||
- MariaDB
|
<a href="https://mariadb.org"><img style="width:40px;height:40px" src="https://icon.horse/icon/mariadb.org"></a>
|
||||||
- MySQL
|
<a href="https://mysql.com"><svg style="width:40px;height:40px" xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 25.6 25.6" ><path d="M179.076 94.886c-3.568-.1-6.336.268-8.656 1.25-.668.27-1.74.27-1.828 1.116.357.355.4.936.713 1.428.535.893 1.473 2.096 2.32 2.72l2.855 2.053c1.74 1.07 3.703 1.695 5.398 2.766.982.625 1.963 1.428 2.945 2.098.5.357.803.938 1.428 1.16v-.135c-.312-.4-.402-.98-.713-1.428l-1.34-1.293c-1.293-1.74-2.9-3.258-4.64-4.506-1.428-.982-4.55-2.32-5.13-3.97l-.088-.1c.98-.1 2.14-.447 3.078-.715 1.518-.4 2.9-.312 4.46-.713l2.143-.625v-.4c-.803-.803-1.383-1.874-2.23-2.632-2.275-1.963-4.775-3.882-7.363-5.488-1.383-.892-3.168-1.473-4.64-2.23-.537-.268-1.428-.402-1.74-.848-.805-.98-1.25-2.275-1.83-3.436l-3.658-7.763c-.803-1.74-1.295-3.48-2.275-5.086-4.596-7.585-9.594-12.18-17.268-16.687-1.65-.937-3.613-1.34-5.7-1.83l-3.346-.18c-.715-.312-1.428-1.16-2.053-1.562-2.543-1.606-9.102-5.086-10.977-.5-1.205 2.9 1.785 5.755 2.8 7.228.76 1.026 1.74 2.186 2.277 3.346.3.758.4 1.562.713 2.365.713 1.963 1.383 4.15 2.32 5.98.5.937 1.025 1.92 1.65 2.767.357.5.982.714 1.115 1.517-.625.893-.668 2.23-1.025 3.347-1.607 5.042-.982 11.288 1.293 15 .715 1.115 2.4 3.57 4.686 2.632 2.008-.803 1.56-3.346 2.14-5.577.135-.535.045-.892.312-1.25v.1l1.83 3.703c1.383 2.186 3.793 4.462 5.8 5.98 1.07.803 1.918 2.187 3.256 2.677v-.135h-.088c-.268-.4-.67-.58-1.027-.892-.803-.803-1.695-1.785-2.32-2.677-1.873-2.498-3.523-5.265-4.996-8.12-.715-1.383-1.34-2.9-1.918-4.283-.27-.536-.27-1.34-.715-1.606-.67.98-1.65 1.83-2.143 3.034-.848 1.918-.936 4.283-1.248 6.737-.18.045-.1 0-.18.1-1.426-.356-1.918-1.83-2.453-3.078-1.338-3.168-1.562-8.254-.402-11.913.312-.937 1.652-3.882 1.117-4.774-.27-.848-1.16-1.338-1.652-2.008-.58-.848-1.203-1.918-1.605-2.855-1.07-2.5-1.605-5.265-2.766-7.764-.537-1.16-1.473-2.365-2.232-3.435-.848-1.205-1.783-2.053-2.453-3.48-.223-.5-.535-1.294-.178-1.83.088-.357.268-.5.623-.58.58-.5 2.232.134 2.812.4 1.65.67 3.033 1.294 4.416 2.23.625.446 1.295 1.294 2.098 1.518h.938c1.428.312 3.033.1 4.37.5 2.365.76 4.506 1.874 6.426 3.08 5.844 3.703 10.664 8.968 13.92 15.26.535 1.026.758 1.963 1.25 3.034.938 2.187 2.098 4.417 3.033 6.56.938 2.097 1.83 4.24 3.168 5.98.67.937 3.346 1.427 4.55 1.918.893.4 2.275.76 3.08 1.25 1.516.937 3.033 2.008 4.46 3.034.713.534 2.945 1.65 3.078 2.54zm-45.5-38.772a7.09 7.09 0 0 0-1.828.223v.1h.088c.357.714.982 1.205 1.428 1.83l1.027 2.142.088-.1c.625-.446.938-1.16.938-2.23-.268-.312-.312-.625-.535-.937-.268-.446-.848-.67-1.206-1.026z" transform="matrix(.390229 0 0 .38781 -46.300037 -16.856717)" fill-rule="evenodd" fill="#00678c" /></svg></a>
|
||||||
- PostgreSQL
|
<a href="https://postgresql.org"><img style="width:40px;height:40px" src="https://icon.horse/icon/postgresql.org"></a>
|
||||||
- CouchDB
|
<a href="https://couchdb.apache.org"><img style="width:40px;height:40px" src="https://icon.horse/icon/couchdb.apache.org"></a>
|
||||||
- Redis
|
<a href="https://redis.io"><svg style="width:40px;height:40px" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ><defs ><path id="a" d="m45.536 38.764c-2.013 1.05-12.44 5.337-14.66 6.494s-3.453 1.146-5.207.308-12.85-5.32-14.85-6.276c-1-.478-1.524-.88-1.524-1.26v-3.813s14.447-3.145 16.78-3.982 3.14-.867 5.126-.14 13.853 2.868 15.814 3.587v3.76c0 .377-.452.8-1.477 1.324z" /><path id="b" d="m45.536 28.733c-2.013 1.05-12.44 5.337-14.66 6.494s-3.453 1.146-5.207.308-12.85-5.32-14.85-6.276-2.04-1.613-.077-2.382l15.332-5.935c2.332-.837 3.14-.867 5.126-.14s12.35 4.853 14.312 5.57 2.037 1.31.024 2.36z" /></defs ><g transform="matrix(.848327 0 0 .848327 -7.883573 -9.449691)" ><use fill="#a41e11" xlink:href="#a" /><path d="m45.536 34.95c-2.013 1.05-12.44 5.337-14.66 6.494s-3.453 1.146-5.207.308-12.85-5.32-14.85-6.276-2.04-1.613-.077-2.382l15.332-5.936c2.332-.836 3.14-.867 5.126-.14s12.35 4.852 14.31 5.582 2.037 1.31.024 2.36z" fill="#d82c20" /><use fill="#a41e11" xlink:href="#a" y="-6.218" /><use fill="#d82c20" xlink:href="#b" /><path d="m45.536 26.098c-2.013 1.05-12.44 5.337-14.66 6.495s-3.453 1.146-5.207.308-12.85-5.32-14.85-6.276c-1-.478-1.524-.88-1.524-1.26v-3.815s14.447-3.145 16.78-3.982 3.14-.867 5.126-.14 13.853 2.868 15.814 3.587v3.76c0 .377-.452.8-1.477 1.324z" fill="#a41e11" /><use fill="#d82c20" xlink:href="#b" y="-6.449" /><g fill="#fff" ><path d="m29.096 20.712-1.182-1.965-3.774-.34 2.816-1.016-.845-1.56 2.636 1.03 2.486-.814-.672 1.612 2.534.95-3.268.34zm-6.296 3.912 8.74-1.342-2.64 3.872z" /><ellipse cx="20.444" cy="21.402" rx="4.672" ry="1.811" /></g ><path d="m42.132 21.138-5.17 2.042-.004-4.087z" fill="#7a0c00" /><path d="m36.963 23.18-.56.22-5.166-2.042 5.723-2.264z" fill="#ad2115" /></g ></svg ></a>
|
||||||
|
|
||||||
### One-click services
|
If you have a new database you would like to add, raise an idea [here](https://feedback.coolify.io/) to get feedback from the community!
|
||||||
|
|
||||||
You can host cool open-source services as well:
|
|
||||||
|
|
||||||
|
### Services
|
||||||
|
|
||||||
|
You quickly need to host a self-hostable, open-source service? You can do it with a few clicks!
|
||||||
- [WordPress](https://docs.coollabs.io/coolify/services/wordpress)
|
- [WordPress](https://docs.coollabs.io/coolify/services/wordpress)
|
||||||
- [Ghost](https://ghost.org)
|
- [Ghost](https://ghost.org)
|
||||||
- [Plausible Analytics](https://docs.coollabs.io/coolify/services/plausible-analytics)
|
- [Plausible Analytics](https://docs.coollabs.io/coolify/services/plausible-analytics)
|
||||||
@@ -95,9 +130,12 @@ You can host cool open-source services as well:
|
|||||||
- [Fider](https://fider.io)
|
- [Fider](https://fider.io)
|
||||||
- [Hasura](https://hasura.io)
|
- [Hasura](https://hasura.io)
|
||||||
|
|
||||||
|
|
||||||
|
If you have a new service you would like to add, raise an idea [here](https://feedback.coolify.io/) to get feedback from the community!
|
||||||
|
|
||||||
## Migration from v1
|
## 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
|
## Support
|
||||||
|
|
||||||
@@ -106,9 +144,6 @@ A fresh installation is necessary. v2 is not compatible with v1.
|
|||||||
- Email: [andras@coollabs.io](mailto:andras@coollabs.io)
|
- Email: [andras@coollabs.io](mailto:andras@coollabs.io)
|
||||||
- Discord: [Invitation](https://discord.gg/xhBCC7eGKw)
|
- Discord: [Invitation](https://discord.gg/xhBCC7eGKw)
|
||||||
|
|
||||||
## Contribute
|
|
||||||
|
|
||||||
See [our contribution guide](./CONTRIBUTING.md).
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
9
apps/api/.env.example
Normal file
9
apps/api/.env.example
Normal file
@@ -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=
|
||||||
9
apps/api/.eslintignore
Normal file
9
apps/api/.eslintignore
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
seed.js
|
||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
build
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
dist
|
||||||
|
dev.db
|
||||||
11
apps/api/.eslintrc
Normal file
11
apps/api/.eslintrc
Normal file
@@ -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
apps/api/.gitignore
vendored
Normal file
11
apps/api/.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
build
|
||||||
|
.svelte-kit
|
||||||
|
package
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
dist
|
||||||
|
dev.db
|
||||||
|
client
|
||||||
0
apps/api/db/.gitkeep
Normal file
0
apps/api/db/.gitkeep
Normal file
7
apps/api/nodemon.json
Normal file
7
apps/api/nodemon.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"watch": ["src"],
|
||||||
|
"ignore": ["src/**/*.test.ts"],
|
||||||
|
"ext": "ts,mjs,json,graphql",
|
||||||
|
"exec": "rimraf build && esbuild `find src \\( -name '*.ts' \\)` --minify=true --platform=node --outdir=build --format=cjs && node build",
|
||||||
|
"legacyWatch": true
|
||||||
|
}
|
||||||
71
apps/api/package.json
Normal file
71
apps/api/package.json
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
"name": "api",
|
||||||
|
"description": "Coolify's Fastify API",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"scripts": {
|
||||||
|
"db:push": "prisma db push && prisma generate",
|
||||||
|
"db:seed": "prisma db seed",
|
||||||
|
"db:studio": "prisma studio",
|
||||||
|
"db:migrate": "COOLIFY_DATABASE_URL=file:../db/migration.db prisma migrate dev --skip-seed --name",
|
||||||
|
"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.2.0",
|
||||||
|
"@fastify/cookie": "7.3.1",
|
||||||
|
"@fastify/cors": "8.1.0",
|
||||||
|
"@fastify/env": "4.1.0",
|
||||||
|
"@fastify/jwt": "6.3.2",
|
||||||
|
"@fastify/static": "6.5.0",
|
||||||
|
"@iarna/toml": "2.2.5",
|
||||||
|
"@prisma/client": "3.15.2",
|
||||||
|
"axios": "0.27.2",
|
||||||
|
"bcryptjs": "2.4.3",
|
||||||
|
"bree": "9.1.2",
|
||||||
|
"cabin": "9.1.2",
|
||||||
|
"compare-versions": "4.1.3",
|
||||||
|
"cuid": "2.1.8",
|
||||||
|
"dayjs": "1.11.4",
|
||||||
|
"dockerode": "3.3.3",
|
||||||
|
"dotenv-extended": "2.9.0",
|
||||||
|
"fastify": "4.4.0",
|
||||||
|
"fastify-plugin": "4.1.0",
|
||||||
|
"generate-password": "1.7.0",
|
||||||
|
"get-port": "6.1.2",
|
||||||
|
"got": "12.3.1",
|
||||||
|
"is-ip": "5.0.0",
|
||||||
|
"is-port-reachable": "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.3.0",
|
||||||
|
"public-ip": "6.0.1",
|
||||||
|
"ssh-config": "4.1.6",
|
||||||
|
"strip-ansi": "7.0.1",
|
||||||
|
"unique-names-generator": "4.7.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "18.6.5",
|
||||||
|
"@types/node-os-utils": "1.3.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "5.33.0",
|
||||||
|
"@typescript-eslint/parser": "5.33.0",
|
||||||
|
"esbuild": "0.15.0",
|
||||||
|
"eslint": "8.21.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.1.0",
|
||||||
|
"typescript": "4.7.4"
|
||||||
|
},
|
||||||
|
"prisma": {
|
||||||
|
"seed": "node prisma/seed.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Application" ADD COLUMN "deploymentType" TEXT;
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
-- RedefineTables
|
||||||
|
PRAGMA foreign_keys=OFF;
|
||||||
|
CREATE TABLE "new_GitSource" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"name" TEXT NOT NULL,
|
||||||
|
"type" TEXT,
|
||||||
|
"apiUrl" TEXT,
|
||||||
|
"htmlUrl" TEXT,
|
||||||
|
"customPort" INTEGER NOT NULL DEFAULT 22,
|
||||||
|
"organization" TEXT,
|
||||||
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" DATETIME NOT NULL,
|
||||||
|
"githubAppId" TEXT,
|
||||||
|
"gitlabAppId" TEXT,
|
||||||
|
CONSTRAINT "GitSource_githubAppId_fkey" FOREIGN KEY ("githubAppId") REFERENCES "GithubApp" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT "GitSource_gitlabAppId_fkey" FOREIGN KEY ("gitlabAppId") REFERENCES "GitlabApp" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
INSERT INTO "new_GitSource" ("apiUrl", "createdAt", "githubAppId", "gitlabAppId", "htmlUrl", "id", "name", "organization", "type", "updatedAt") SELECT "apiUrl", "createdAt", "githubAppId", "gitlabAppId", "htmlUrl", "id", "name", "organization", "type", "updatedAt" FROM "GitSource";
|
||||||
|
DROP TABLE "GitSource";
|
||||||
|
ALTER TABLE "new_GitSource" RENAME TO "GitSource";
|
||||||
|
CREATE UNIQUE INDEX "GitSource_githubAppId_key" ON "GitSource"("githubAppId");
|
||||||
|
CREATE UNIQUE INDEX "GitSource_gitlabAppId_key" ON "GitSource"("gitlabAppId");
|
||||||
|
PRAGMA foreign_key_check;
|
||||||
|
PRAGMA foreign_keys=ON;
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "Moodle" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"serviceId" TEXT NOT NULL,
|
||||||
|
"defaultUsername" TEXT NOT NULL,
|
||||||
|
"defaultPassword" TEXT NOT NULL,
|
||||||
|
"defaultEmail" TEXT NOT NULL,
|
||||||
|
"mariadbUser" TEXT NOT NULL,
|
||||||
|
"mariadbPassword" TEXT NOT NULL,
|
||||||
|
"mariadbRootUser" TEXT NOT NULL,
|
||||||
|
"mariadbRootUserPassword" TEXT NOT NULL,
|
||||||
|
"mariadbDatabase" TEXT NOT NULL,
|
||||||
|
"mariadbPublicPort" INTEGER,
|
||||||
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" DATETIME NOT NULL,
|
||||||
|
CONSTRAINT "Moodle_serviceId_fkey" FOREIGN KEY ("serviceId") REFERENCES "Service" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "Moodle_serviceId_key" ON "Moodle"("serviceId");
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
-- RedefineTables
|
||||||
|
PRAGMA foreign_keys=OFF;
|
||||||
|
CREATE TABLE "new_DestinationDocker" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"network" TEXT NOT NULL,
|
||||||
|
"name" TEXT NOT NULL,
|
||||||
|
"engine" TEXT,
|
||||||
|
"remoteEngine" BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
"remoteIpAddress" TEXT,
|
||||||
|
"remoteUser" TEXT,
|
||||||
|
"remotePort" INTEGER,
|
||||||
|
"isCoolifyProxyUsed" BOOLEAN DEFAULT false,
|
||||||
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" DATETIME NOT NULL
|
||||||
|
);
|
||||||
|
INSERT INTO "new_DestinationDocker" ("createdAt", "engine", "id", "isCoolifyProxyUsed", "name", "network", "remoteEngine", "updatedAt") SELECT "createdAt", "engine", "id", "isCoolifyProxyUsed", "name", "network", "remoteEngine", "updatedAt" FROM "DestinationDocker";
|
||||||
|
DROP TABLE "DestinationDocker";
|
||||||
|
ALTER TABLE "new_DestinationDocker" RENAME TO "DestinationDocker";
|
||||||
|
CREATE UNIQUE INDEX "DestinationDocker_network_key" ON "DestinationDocker"("network");
|
||||||
|
PRAGMA foreign_key_check;
|
||||||
|
PRAGMA foreign_keys=ON;
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "SshKey" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"name" TEXT NOT NULL,
|
||||||
|
"privateKey" TEXT NOT NULL,
|
||||||
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" DATETIME NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
-- RedefineTables
|
||||||
|
PRAGMA foreign_keys=OFF;
|
||||||
|
CREATE TABLE "new_DestinationDocker" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"network" TEXT NOT NULL,
|
||||||
|
"name" TEXT NOT NULL,
|
||||||
|
"engine" TEXT,
|
||||||
|
"remoteEngine" BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
"remoteIpAddress" TEXT,
|
||||||
|
"remoteUser" TEXT,
|
||||||
|
"remotePort" INTEGER,
|
||||||
|
"remoteVerified" BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
"isCoolifyProxyUsed" BOOLEAN DEFAULT false,
|
||||||
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" DATETIME NOT NULL,
|
||||||
|
"sshKeyId" TEXT,
|
||||||
|
CONSTRAINT "DestinationDocker_sshKeyId_fkey" FOREIGN KEY ("sshKeyId") REFERENCES "SshKey" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
INSERT INTO "new_DestinationDocker" ("createdAt", "engine", "id", "isCoolifyProxyUsed", "name", "network", "remoteEngine", "remoteIpAddress", "remotePort", "remoteUser", "updatedAt") SELECT "createdAt", "engine", "id", "isCoolifyProxyUsed", "name", "network", "remoteEngine", "remoteIpAddress", "remotePort", "remoteUser", "updatedAt" FROM "DestinationDocker";
|
||||||
|
DROP TABLE "DestinationDocker";
|
||||||
|
ALTER TABLE "new_DestinationDocker" RENAME TO "DestinationDocker";
|
||||||
|
CREATE UNIQUE INDEX "DestinationDocker_network_key" ON "DestinationDocker"("network");
|
||||||
|
PRAGMA foreign_key_check;
|
||||||
|
PRAGMA foreign_keys=ON;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Setting" ADD COLUMN "ipv4" TEXT;
|
||||||
|
ALTER TABLE "Setting" ADD COLUMN "ipv6" TEXT;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Setting" ADD COLUMN "arch" TEXT;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
-- RedefineTables
|
||||||
|
PRAGMA foreign_keys=OFF;
|
||||||
|
CREATE TABLE "new_SshKey" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"name" TEXT NOT NULL,
|
||||||
|
"privateKey" TEXT NOT NULL,
|
||||||
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" DATETIME NOT NULL,
|
||||||
|
"teamId" TEXT,
|
||||||
|
CONSTRAINT "SshKey_teamId_fkey" FOREIGN KEY ("teamId") REFERENCES "Team" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
INSERT INTO "new_SshKey" ("createdAt", "id", "name", "privateKey", "updatedAt") SELECT "createdAt", "id", "name", "privateKey", "updatedAt" FROM "SshKey";
|
||||||
|
DROP TABLE "SshKey";
|
||||||
|
ALTER TABLE "new_SshKey" RENAME TO "SshKey";
|
||||||
|
PRAGMA foreign_key_check;
|
||||||
|
PRAGMA foreign_keys=ON;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- DropIndex
|
||||||
|
DROP INDEX "Application_fqdn_key";
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "DestinationDocker" ADD COLUMN "sshLocalPort" INTEGER;
|
||||||
@@ -23,6 +23,9 @@ model Setting {
|
|||||||
isTraefikUsed Boolean @default(true)
|
isTraefikUsed Boolean @default(true)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
ipv4 String?
|
||||||
|
ipv6 String?
|
||||||
|
arch String?
|
||||||
}
|
}
|
||||||
|
|
||||||
model User {
|
model User {
|
||||||
@@ -30,39 +33,40 @@ model User {
|
|||||||
email String @unique
|
email String @unique
|
||||||
type String
|
type String
|
||||||
password String?
|
password String?
|
||||||
teams Team[]
|
|
||||||
permission Permission[]
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
permission Permission[]
|
||||||
|
teams Team[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model Permission {
|
model Permission {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
user User @relation(fields: [userId], references: [id])
|
|
||||||
userId String
|
userId String
|
||||||
team Team @relation(fields: [teamId], references: [id])
|
|
||||||
teamId String
|
teamId String
|
||||||
permission String
|
permission String
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
team Team @relation(fields: [teamId], references: [id])
|
||||||
|
user User @relation(fields: [userId], references: [id])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Team {
|
model Team {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
users User[]
|
|
||||||
name String?
|
name String?
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
databaseId String?
|
||||||
|
serviceId String?
|
||||||
|
permissions Permission[]
|
||||||
|
sshKey SshKey[]
|
||||||
applications Application[]
|
applications Application[]
|
||||||
|
database Database[]
|
||||||
|
destinationDocker DestinationDocker[]
|
||||||
gitSources GitSource[]
|
gitSources GitSource[]
|
||||||
gitHubApps GithubApp[]
|
gitHubApps GithubApp[]
|
||||||
gitLabApps GitlabApp[]
|
gitLabApps GitlabApp[]
|
||||||
destinationDocker DestinationDocker[]
|
service Service[]
|
||||||
permissions Permission[]
|
users User[]
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
database Database[] @relation(references: [id])
|
|
||||||
databaseId String?
|
|
||||||
service Service[] @relation(references: [id])
|
|
||||||
serviceId String?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model TeamInvitation {
|
model TeamInvitation {
|
||||||
@@ -78,7 +82,7 @@ model TeamInvitation {
|
|||||||
model Application {
|
model Application {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
name String
|
name String
|
||||||
fqdn String? @unique
|
fqdn String?
|
||||||
repository String?
|
repository String?
|
||||||
configHash String?
|
configHash String?
|
||||||
branch String?
|
branch String?
|
||||||
@@ -91,6 +95,7 @@ model Application {
|
|||||||
startCommand String?
|
startCommand String?
|
||||||
baseDirectory String?
|
baseDirectory String?
|
||||||
publishDirectory String?
|
publishDirectory String?
|
||||||
|
deploymentType String?
|
||||||
phpModules String?
|
phpModules String?
|
||||||
pythonWSGI String?
|
pythonWSGI String?
|
||||||
pythonModule String?
|
pythonModule String?
|
||||||
@@ -100,21 +105,20 @@ model Application {
|
|||||||
denoOptions String?
|
denoOptions String?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
settings ApplicationSettings?
|
|
||||||
teams Team[]
|
|
||||||
destinationDockerId String?
|
destinationDockerId String?
|
||||||
destinationDocker DestinationDocker? @relation(fields: [destinationDockerId], references: [id])
|
|
||||||
gitSourceId String?
|
gitSourceId String?
|
||||||
gitSource GitSource? @relation(fields: [gitSourceId], references: [id])
|
|
||||||
secrets Secret[]
|
|
||||||
persistentStorage ApplicationPersistentStorage[]
|
|
||||||
baseImage String?
|
baseImage String?
|
||||||
baseBuildImage String?
|
baseBuildImage String?
|
||||||
|
gitSource GitSource? @relation(fields: [gitSourceId], references: [id])
|
||||||
|
destinationDocker DestinationDocker? @relation(fields: [destinationDockerId], references: [id])
|
||||||
|
persistentStorage ApplicationPersistentStorage[]
|
||||||
|
settings ApplicationSettings?
|
||||||
|
secrets Secret[]
|
||||||
|
teams Team[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model ApplicationSettings {
|
model ApplicationSettings {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
application Application @relation(fields: [applicationId], references: [id])
|
|
||||||
applicationId String @unique
|
applicationId String @unique
|
||||||
dualCerts Boolean @default(false)
|
dualCerts Boolean @default(false)
|
||||||
debug Boolean @default(false)
|
debug Boolean @default(false)
|
||||||
@@ -122,26 +126,27 @@ model ApplicationSettings {
|
|||||||
autodeploy Boolean @default(true)
|
autodeploy Boolean @default(true)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
application Application @relation(fields: [applicationId], references: [id])
|
||||||
}
|
}
|
||||||
|
|
||||||
model ApplicationPersistentStorage {
|
model ApplicationPersistentStorage {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
application Application @relation(fields: [applicationId], references: [id])
|
|
||||||
applicationId String
|
applicationId String
|
||||||
path String
|
path String
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
application Application @relation(fields: [applicationId], references: [id])
|
||||||
|
|
||||||
@@unique([applicationId, path])
|
@@unique([applicationId, path])
|
||||||
}
|
}
|
||||||
|
|
||||||
model ServicePersistentStorage {
|
model ServicePersistentStorage {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
service Service @relation(fields: [serviceId], references: [id])
|
|
||||||
serviceId String
|
serviceId String
|
||||||
path String
|
path String
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
service Service @relation(fields: [serviceId], references: [id])
|
||||||
|
|
||||||
@@unique([serviceId, path])
|
@@unique([serviceId, path])
|
||||||
}
|
}
|
||||||
@@ -154,8 +159,8 @@ model Secret {
|
|||||||
isBuildSecret Boolean @default(false)
|
isBuildSecret Boolean @default(false)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
application Application @relation(fields: [applicationId], references: [id])
|
|
||||||
applicationId String
|
applicationId String
|
||||||
|
application Application @relation(fields: [applicationId], references: [id])
|
||||||
|
|
||||||
@@unique([name, applicationId, isPRMRSecret])
|
@@unique([name, applicationId, isPRMRSecret])
|
||||||
}
|
}
|
||||||
@@ -166,8 +171,8 @@ model ServiceSecret {
|
|||||||
value String
|
value String
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
service Service @relation(fields: [serviceId], references: [id])
|
|
||||||
serviceId String
|
serviceId String
|
||||||
|
service Service @relation(fields: [serviceId], references: [id])
|
||||||
|
|
||||||
@@unique([name, serviceId])
|
@@unique([name, serviceId])
|
||||||
}
|
}
|
||||||
@@ -199,38 +204,56 @@ model DestinationDocker {
|
|||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
network String @unique
|
network String @unique
|
||||||
name String
|
name String
|
||||||
engine String
|
engine String?
|
||||||
remoteEngine Boolean @default(false)
|
remoteEngine Boolean @default(false)
|
||||||
|
remoteIpAddress String?
|
||||||
|
remoteUser String?
|
||||||
|
remotePort Int?
|
||||||
|
remoteVerified Boolean @default(false)
|
||||||
isCoolifyProxyUsed Boolean? @default(false)
|
isCoolifyProxyUsed Boolean? @default(false)
|
||||||
teams Team[]
|
|
||||||
application Application[]
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
sshKeyId String?
|
||||||
|
sshKey SshKey? @relation(fields: [sshKeyId], references: [id])
|
||||||
|
sshLocalPort Int?
|
||||||
|
application Application[]
|
||||||
database Database[]
|
database Database[]
|
||||||
service Service[]
|
service Service[]
|
||||||
|
teams Team[]
|
||||||
|
}
|
||||||
|
|
||||||
|
model SshKey {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
name String
|
||||||
|
privateKey String
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
teamId String?
|
||||||
|
team Team? @relation(fields: [teamId], references: [id])
|
||||||
|
destinationDocker DestinationDocker[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model GitSource {
|
model GitSource {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
name String
|
name String
|
||||||
teams Team[]
|
|
||||||
type String?
|
type String?
|
||||||
apiUrl String?
|
apiUrl String?
|
||||||
htmlUrl String?
|
htmlUrl String?
|
||||||
|
customPort Int @default(22)
|
||||||
organization String?
|
organization String?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
githubAppId String? @unique
|
githubAppId String? @unique
|
||||||
githubApp GithubApp? @relation(fields: [githubAppId], references: [id])
|
|
||||||
application Application[]
|
|
||||||
gitlabAppId String? @unique
|
gitlabAppId String? @unique
|
||||||
gitlabApp GitlabApp? @relation(fields: [gitlabAppId], references: [id])
|
gitlabApp GitlabApp? @relation(fields: [gitlabAppId], references: [id])
|
||||||
|
githubApp GithubApp? @relation(fields: [githubAppId], references: [id])
|
||||||
|
application Application[]
|
||||||
|
teams Team[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model GithubApp {
|
model GithubApp {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
name String? @unique
|
name String? @unique
|
||||||
teams Team[]
|
|
||||||
appId Int?
|
appId Int?
|
||||||
installationId Int?
|
installationId Int?
|
||||||
clientId String?
|
clientId String?
|
||||||
@@ -240,13 +263,13 @@ model GithubApp {
|
|||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
gitSource GitSource?
|
gitSource GitSource?
|
||||||
|
teams Team[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model GitlabApp {
|
model GitlabApp {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
oauthId Int @unique
|
oauthId Int @unique
|
||||||
groupName String? @unique
|
groupName String? @unique
|
||||||
teams Team[]
|
|
||||||
deployKeyId Int?
|
deployKeyId Int?
|
||||||
privateSshKey String?
|
privateSshKey String?
|
||||||
publicSshKey String?
|
publicSshKey String?
|
||||||
@@ -256,6 +279,7 @@ model GitlabApp {
|
|||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
gitSource GitSource?
|
gitSource GitSource?
|
||||||
|
teams Team[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model Database {
|
model Database {
|
||||||
@@ -269,22 +293,22 @@ model Database {
|
|||||||
dbUserPassword String?
|
dbUserPassword String?
|
||||||
rootUser String?
|
rootUser String?
|
||||||
rootUserPassword String?
|
rootUserPassword String?
|
||||||
settings DatabaseSettings?
|
|
||||||
destinationDocker DestinationDocker? @relation(fields: [destinationDockerId], references: [id])
|
|
||||||
destinationDockerId String?
|
destinationDockerId String?
|
||||||
teams Team[]
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
destinationDocker DestinationDocker? @relation(fields: [destinationDockerId], references: [id])
|
||||||
|
settings DatabaseSettings?
|
||||||
|
teams Team[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model DatabaseSettings {
|
model DatabaseSettings {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
database Database @relation(fields: [databaseId], references: [id])
|
|
||||||
databaseId String @unique
|
databaseId String @unique
|
||||||
isPublic Boolean @default(false)
|
isPublic Boolean @default(false)
|
||||||
appendOnly Boolean @default(true)
|
appendOnly Boolean @default(true)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
database Database @relation(fields: [databaseId], references: [id])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Service {
|
model Service {
|
||||||
@@ -295,22 +319,23 @@ model Service {
|
|||||||
dualCerts Boolean @default(false)
|
dualCerts Boolean @default(false)
|
||||||
type String?
|
type String?
|
||||||
version String?
|
version String?
|
||||||
teams Team[]
|
|
||||||
destinationDockerId String?
|
destinationDockerId String?
|
||||||
destinationDocker DestinationDocker? @relation(fields: [destinationDockerId], references: [id])
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
plausibleAnalytics PlausibleAnalytics?
|
destinationDocker DestinationDocker? @relation(fields: [destinationDockerId], references: [id])
|
||||||
|
fider Fider?
|
||||||
|
ghost Ghost?
|
||||||
|
hasura Hasura?
|
||||||
|
meiliSearch MeiliSearch?
|
||||||
minio Minio?
|
minio Minio?
|
||||||
|
moodle Moodle?
|
||||||
|
plausibleAnalytics PlausibleAnalytics?
|
||||||
|
persistentStorage ServicePersistentStorage[]
|
||||||
|
serviceSecret ServiceSecret[]
|
||||||
|
umami Umami?
|
||||||
vscodeserver Vscodeserver?
|
vscodeserver Vscodeserver?
|
||||||
wordpress Wordpress?
|
wordpress Wordpress?
|
||||||
ghost Ghost?
|
teams Team[]
|
||||||
serviceSecret ServiceSecret[]
|
|
||||||
meiliSearch MeiliSearch?
|
|
||||||
persistentStorage ServicePersistentStorage[]
|
|
||||||
umami Umami?
|
|
||||||
hasura Hasura?
|
|
||||||
fider Fider?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model PlausibleAnalytics {
|
model PlausibleAnalytics {
|
||||||
@@ -325,9 +350,9 @@ model PlausibleAnalytics {
|
|||||||
secretKeyBase String?
|
secretKeyBase String?
|
||||||
scriptName String @default("plausible.js")
|
scriptName String @default("plausible.js")
|
||||||
serviceId String @unique
|
serviceId String @unique
|
||||||
service Service @relation(fields: [serviceId], references: [id])
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
service Service @relation(fields: [serviceId], references: [id])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Minio {
|
model Minio {
|
||||||
@@ -337,18 +362,18 @@ model Minio {
|
|||||||
publicPort Int?
|
publicPort Int?
|
||||||
apiFqdn String?
|
apiFqdn String?
|
||||||
serviceId String @unique
|
serviceId String @unique
|
||||||
service Service @relation(fields: [serviceId], references: [id])
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
service Service @relation(fields: [serviceId], references: [id])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Vscodeserver {
|
model Vscodeserver {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
password String
|
password String
|
||||||
serviceId String @unique
|
serviceId String @unique
|
||||||
service Service @relation(fields: [serviceId], references: [id])
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
service Service @relation(fields: [serviceId], references: [id])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Wordpress {
|
model Wordpress {
|
||||||
@@ -371,9 +396,9 @@ model Wordpress {
|
|||||||
ftpHostKey String?
|
ftpHostKey String?
|
||||||
ftpHostKeyPrivate String?
|
ftpHostKeyPrivate String?
|
||||||
serviceId String @unique
|
serviceId String @unique
|
||||||
service Service @relation(fields: [serviceId], references: [id])
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
service Service @relation(fields: [serviceId], references: [id])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Ghost {
|
model Ghost {
|
||||||
@@ -387,18 +412,18 @@ model Ghost {
|
|||||||
mariadbDatabase String?
|
mariadbDatabase String?
|
||||||
mariadbPublicPort Int?
|
mariadbPublicPort Int?
|
||||||
serviceId String @unique
|
serviceId String @unique
|
||||||
service Service @relation(fields: [serviceId], references: [id])
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
service Service @relation(fields: [serviceId], references: [id])
|
||||||
}
|
}
|
||||||
|
|
||||||
model MeiliSearch {
|
model MeiliSearch {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
masterKey String
|
masterKey String
|
||||||
serviceId String @unique
|
serviceId String @unique
|
||||||
service Service @relation(fields: [serviceId], references: [id])
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
service Service @relation(fields: [serviceId], references: [id])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Umami {
|
model Umami {
|
||||||
@@ -410,9 +435,9 @@ model Umami {
|
|||||||
postgresqlPublicPort Int?
|
postgresqlPublicPort Int?
|
||||||
umamiAdminPassword String
|
umamiAdminPassword String
|
||||||
hashSalt String
|
hashSalt String
|
||||||
service Service @relation(fields: [serviceId], references: [id])
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
service Service @relation(fields: [serviceId], references: [id])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Hasura {
|
model Hasura {
|
||||||
@@ -423,9 +448,9 @@ model Hasura {
|
|||||||
postgresqlDatabase String
|
postgresqlDatabase String
|
||||||
postgresqlPublicPort Int?
|
postgresqlPublicPort Int?
|
||||||
graphQLAdminPassword String
|
graphQLAdminPassword String
|
||||||
service Service @relation(fields: [serviceId], references: [id])
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
service Service @relation(fields: [serviceId], references: [id])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Fider {
|
model Fider {
|
||||||
@@ -445,7 +470,24 @@ model Fider {
|
|||||||
emailSmtpUser String?
|
emailSmtpUser String?
|
||||||
emailSmtpPassword String?
|
emailSmtpPassword String?
|
||||||
emailSmtpEnableStartTls Boolean @default(false)
|
emailSmtpEnableStartTls Boolean @default(false)
|
||||||
service Service @relation(fields: [serviceId], references: [id])
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
service Service @relation(fields: [serviceId], references: [id])
|
||||||
|
}
|
||||||
|
|
||||||
|
model Moodle {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
serviceId String @unique
|
||||||
|
defaultUsername String
|
||||||
|
defaultPassword String
|
||||||
|
defaultEmail String
|
||||||
|
mariadbUser String
|
||||||
|
mariadbPassword String
|
||||||
|
mariadbRootUser String
|
||||||
|
mariadbRootUserPassword String
|
||||||
|
mariadbDatabase String
|
||||||
|
mariadbPublicPort Int?
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
service Service @relation(fields: [serviceId], references: [id])
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
const dotEnvExtended = require('dotenv-extended');
|
const dotEnvExtended = require('dotenv-extended');
|
||||||
dotEnvExtended.load();
|
dotEnvExtended.load();
|
||||||
const { PrismaClient } = require('@prisma/client');
|
|
||||||
const prisma = new PrismaClient();
|
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const generator = require('generate-password');
|
const generator = require('generate-password');
|
||||||
const cuid = require('cuid');
|
const cuid = require('cuid');
|
||||||
|
const { PrismaClient } = require('@prisma/client');
|
||||||
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
function generatePassword(length = 24) {
|
function generatePassword(length = 24) {
|
||||||
return generator.generate({
|
return generator.generate({
|
||||||
@@ -24,7 +24,8 @@ async function main() {
|
|||||||
data: {
|
data: {
|
||||||
isRegistrationEnabled: true,
|
isRegistrationEnabled: true,
|
||||||
proxyPassword: encrypt(generatePassword()),
|
proxyPassword: encrypt(generatePassword()),
|
||||||
proxyUser: cuid()
|
proxyUser: cuid(),
|
||||||
|
arch: process.arch
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -33,6 +34,7 @@ async function main() {
|
|||||||
id: settingsFound.id
|
id: settingsFound.id
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
|
isTraefikUsed: true,
|
||||||
proxyHash: null
|
proxyHash: null
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -84,20 +86,4 @@ const encrypt = (text) => {
|
|||||||
content: encrypted.toString('hex')
|
content: encrypted.toString('hex')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const decrypt = (hashString) => {
|
|
||||||
if (hashString) {
|
|
||||||
const hash = JSON.parse(hashString);
|
|
||||||
const decipher = crypto.createDecipheriv(
|
|
||||||
algorithm,
|
|
||||||
process.env['COOLIFY_SECRET_KEY'],
|
|
||||||
Buffer.from(hash.iv, 'hex')
|
|
||||||
);
|
|
||||||
const decrpyted = Buffer.concat([
|
|
||||||
decipher.update(Buffer.from(hash.content, 'hex')),
|
|
||||||
decipher.final()
|
|
||||||
]);
|
|
||||||
return decrpyted.toString();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
167
apps/api/src/index.ts
Normal file
167
apps/api/src/index.ts
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
import Fastify from 'fastify';
|
||||||
|
import cors from '@fastify/cors';
|
||||||
|
import serve from '@fastify/static';
|
||||||
|
import env from '@fastify/env';
|
||||||
|
import cookie from '@fastify/cookie';
|
||||||
|
import path, { join } from 'path';
|
||||||
|
import autoLoad from '@fastify/autoload';
|
||||||
|
import { asyncExecShell, isDev, listSettings, prisma } from './lib/common';
|
||||||
|
import { scheduler } from './lib/scheduler';
|
||||||
|
|
||||||
|
declare module 'fastify' {
|
||||||
|
interface FastifyInstance {
|
||||||
|
config: {
|
||||||
|
COOLIFY_APP_ID: string,
|
||||||
|
COOLIFY_SECRET_KEY: string,
|
||||||
|
COOLIFY_DATABASE_URL: string,
|
||||||
|
COOLIFY_SENTRY_DSN: string,
|
||||||
|
COOLIFY_IS_ON: string,
|
||||||
|
COOLIFY_WHITE_LABELED: string,
|
||||||
|
COOLIFY_WHITE_LABELED_ICON: string | null,
|
||||||
|
COOLIFY_AUTO_UPDATE: string,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const port = isDev ? 3001 : 3000;
|
||||||
|
const host = '0.0.0.0';
|
||||||
|
const fastify = Fastify({
|
||||||
|
logger: false,
|
||||||
|
trustProxy: true
|
||||||
|
});
|
||||||
|
const schema = {
|
||||||
|
type: 'object',
|
||||||
|
required: ['COOLIFY_SECRET_KEY', 'COOLIFY_DATABASE_URL', 'COOLIFY_IS_ON'],
|
||||||
|
properties: {
|
||||||
|
COOLIFY_APP_ID: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
COOLIFY_SECRET_KEY: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
COOLIFY_DATABASE_URL: {
|
||||||
|
type: 'string',
|
||||||
|
default: 'file:../db/dev.db'
|
||||||
|
},
|
||||||
|
COOLIFY_SENTRY_DSN: {
|
||||||
|
type: 'string',
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
COOLIFY_IS_ON: {
|
||||||
|
type: 'string',
|
||||||
|
default: 'docker'
|
||||||
|
},
|
||||||
|
COOLIFY_WHITE_LABELED: {
|
||||||
|
type: 'string',
|
||||||
|
default: 'false'
|
||||||
|
},
|
||||||
|
COOLIFY_WHITE_LABELED_ICON: {
|
||||||
|
type: 'string',
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
COOLIFY_AUTO_UPDATE: {
|
||||||
|
type: 'string',
|
||||||
|
default: 'false'
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
schema,
|
||||||
|
dotenv: true
|
||||||
|
};
|
||||||
|
fastify.register(env, options);
|
||||||
|
if (!isDev) {
|
||||||
|
fastify.register(serve, {
|
||||||
|
root: path.join(__dirname, './public'),
|
||||||
|
preCompressed: true
|
||||||
|
});
|
||||||
|
fastify.setNotFoundHandler(async function (request, reply) {
|
||||||
|
if (request.raw.url && request.raw.url.startsWith('/api')) {
|
||||||
|
return reply.status(404).send({
|
||||||
|
success: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return reply.status(200).sendFile('index.html');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
fastify.register(autoLoad, {
|
||||||
|
dir: join(__dirname, 'plugins')
|
||||||
|
});
|
||||||
|
fastify.register(autoLoad, {
|
||||||
|
dir: join(__dirname, 'routes')
|
||||||
|
});
|
||||||
|
|
||||||
|
fastify.register(cookie)
|
||||||
|
fastify.register(cors);
|
||||||
|
fastify.listen({ port, host }, async (err: any, address: any) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
console.log(`Coolify's API is listening on ${host}:${port}`);
|
||||||
|
await initServer();
|
||||||
|
await scheduler.start('deployApplication');
|
||||||
|
await scheduler.start('cleanupStorage');
|
||||||
|
await scheduler.start('cleanupPrismaEngines');
|
||||||
|
await scheduler.start('checkProxies');
|
||||||
|
|
||||||
|
// Check if no build is running
|
||||||
|
|
||||||
|
// Check for update
|
||||||
|
setInterval(async () => {
|
||||||
|
const { isAutoUpdateEnabled } = await prisma.setting.findFirst();
|
||||||
|
if (isAutoUpdateEnabled) {
|
||||||
|
if (scheduler.workers.has('deployApplication')) {
|
||||||
|
scheduler.workers.get('deployApplication').postMessage("status:autoUpdater");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, isDev ? 5000 : 60000 * 15)
|
||||||
|
|
||||||
|
// Cleanup storage
|
||||||
|
setInterval(async () => {
|
||||||
|
if (scheduler.workers.has('deployApplication')) {
|
||||||
|
scheduler.workers.get('deployApplication').postMessage("status:cleanupStorage");
|
||||||
|
}
|
||||||
|
}, isDev ? 5000 : 60000 * 10)
|
||||||
|
|
||||||
|
scheduler.on('worker deleted', async (name) => {
|
||||||
|
if (name === 'autoUpdater' || name === 'cleanupStorage') {
|
||||||
|
if (!scheduler.workers.has('deployApplication')) await scheduler.start('deployApplication');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await getArch();
|
||||||
|
await getIPAddress();
|
||||||
|
});
|
||||||
|
async function getIPAddress() {
|
||||||
|
const { publicIpv4, publicIpv6 } = await import('public-ip')
|
||||||
|
try {
|
||||||
|
const settings = await listSettings();
|
||||||
|
if (!settings.ipv4) {
|
||||||
|
const ipv4 = await publicIpv4({ timeout: 2000 })
|
||||||
|
await prisma.setting.update({ where: { id: settings.id }, data: { ipv4 } })
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!settings.ipv6) {
|
||||||
|
const ipv6 = await publicIpv6({ timeout: 2000 })
|
||||||
|
await prisma.setting.update({ where: { id: settings.id }, data: { ipv6 } })
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) { }
|
||||||
|
}
|
||||||
|
async function initServer() {
|
||||||
|
try {
|
||||||
|
await asyncExecShell(`docker network create --attachable coolify`);
|
||||||
|
} catch (error) { }
|
||||||
|
}
|
||||||
|
async function getArch() {
|
||||||
|
try {
|
||||||
|
const settings = await prisma.setting.findFirst({})
|
||||||
|
if (settings && !settings.arch) {
|
||||||
|
await prisma.setting.update({ where: { id: settings.id }, data: { arch: process.arch } })
|
||||||
|
}
|
||||||
|
} catch (error) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
43
apps/api/src/jobs/autoUpdater.ts
Normal file
43
apps/api/src/jobs/autoUpdater.ts
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
import compareVersions from 'compare-versions';
|
||||||
|
import { parentPort } from 'node:worker_threads';
|
||||||
|
import { asyncExecShell, asyncSleep, isDev, prisma, version } from '../lib/common';
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
if (parentPort) {
|
||||||
|
try {
|
||||||
|
const currentVersion = version;
|
||||||
|
const { data: versions } = await axios
|
||||||
|
.get(
|
||||||
|
`https://get.coollabs.io/versions.json`
|
||||||
|
, {
|
||||||
|
params: {
|
||||||
|
appId: process.env['COOLIFY_APP_ID'] || undefined,
|
||||||
|
version: currentVersion
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const latestVersion = versions['coolify'].main.version;
|
||||||
|
const isUpdateAvailable = compareVersions(latestVersion, currentVersion);
|
||||||
|
if (isUpdateAvailable === 1) {
|
||||||
|
const activeCount = 0
|
||||||
|
if (activeCount === 0) {
|
||||||
|
if (!isDev) {
|
||||||
|
console.log(`Updating Coolify to ${latestVersion}.`);
|
||||||
|
await asyncExecShell(`docker pull coollabsio/coolify:${latestVersion}`);
|
||||||
|
await asyncExecShell(`env | grep COOLIFY > .env`);
|
||||||
|
await asyncExecShell(
|
||||||
|
`docker run --rm -tid --env-file .env -v /var/run/docker.sock:/var/run/docker.sock -v coolify-db coollabsio/coolify:${latestVersion} /bin/sh -c "env | grep COOLIFY > .env && echo 'TAG=${latestVersion}' >> .env && docker stop -t 0 coolify && docker rm coolify && docker compose up -d --force-recreate"`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
console.log('Updating (not really in dev mode).');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
} finally {
|
||||||
|
await prisma.$disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else process.exit(0);
|
||||||
|
})();
|
||||||
95
apps/api/src/jobs/checkProxies.ts
Normal file
95
apps/api/src/jobs/checkProxies.ts
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
import { parentPort } from 'node:worker_threads';
|
||||||
|
import { prisma, startTraefikTCPProxy, generateDatabaseConfiguration, startTraefikProxy, executeDockerCmd } from '../lib/common';
|
||||||
|
import { checkContainer } from '../lib/docker';
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
if (parentPort) {
|
||||||
|
try {
|
||||||
|
// Coolify Proxy local
|
||||||
|
const engine = '/var/run/docker.sock';
|
||||||
|
const localDocker = await prisma.destinationDocker.findFirst({
|
||||||
|
where: { engine, network: 'coolify' }
|
||||||
|
});
|
||||||
|
if (localDocker && localDocker.isCoolifyProxyUsed) {
|
||||||
|
// Remove HAProxy
|
||||||
|
const found = await checkContainer({ dockerId: localDocker.id, container: 'coolify-haproxy' });
|
||||||
|
if (found) {
|
||||||
|
await executeDockerCmd({
|
||||||
|
dockerId: localDocker.id,
|
||||||
|
command: `docker stop -t 0 coolify-haproxy && docker rm coolify-haproxy`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
await startTraefikProxy(localDocker.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TCP Proxies
|
||||||
|
const databasesWithPublicPort = await prisma.database.findMany({
|
||||||
|
where: { publicPort: { not: null } },
|
||||||
|
include: { settings: true, destinationDocker: true }
|
||||||
|
});
|
||||||
|
for (const database of databasesWithPublicPort) {
|
||||||
|
const { destinationDockerId, destinationDocker, publicPort, id } = database;
|
||||||
|
if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
||||||
|
const { privatePort } = generateDatabaseConfiguration(database);
|
||||||
|
// Remove HAProxy
|
||||||
|
const found = await checkContainer({
|
||||||
|
dockerId: localDocker.id, container: `haproxy-for-${publicPort}`
|
||||||
|
});
|
||||||
|
if (found) {
|
||||||
|
await executeDockerCmd({
|
||||||
|
dockerId: localDocker.id,
|
||||||
|
command: `docker stop -t 0 haproxy-for-${publicPort} && docker rm haproxy-for-${publicPort}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
await startTraefikTCPProxy(destinationDocker, id, publicPort, privatePort);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const wordpressWithFtp = await prisma.wordpress.findMany({
|
||||||
|
where: { ftpPublicPort: { not: null } },
|
||||||
|
include: { service: { include: { destinationDocker: true } } }
|
||||||
|
});
|
||||||
|
for (const ftp of wordpressWithFtp) {
|
||||||
|
const { service, ftpPublicPort } = ftp;
|
||||||
|
const { destinationDockerId, destinationDocker, id } = service;
|
||||||
|
if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
||||||
|
// Remove HAProxy
|
||||||
|
const found = await checkContainer({ dockerId: localDocker.id, container: `haproxy-for-${ftpPublicPort}` });
|
||||||
|
if (found) {
|
||||||
|
await executeDockerCmd({
|
||||||
|
dockerId: localDocker.id,
|
||||||
|
command: `docker stop -t 0 haproxy -for-${ftpPublicPort} && docker rm haproxy-for-${ftpPublicPort}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
await startTraefikTCPProxy(destinationDocker, id, ftpPublicPort, 22, 'wordpressftp');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTP Proxies
|
||||||
|
const minioInstances = await prisma.minio.findMany({
|
||||||
|
where: { publicPort: { not: null } },
|
||||||
|
include: { service: { include: { destinationDocker: true } } }
|
||||||
|
});
|
||||||
|
for (const minio of minioInstances) {
|
||||||
|
const { service, publicPort } = minio;
|
||||||
|
const { destinationDockerId, destinationDocker, id } = service;
|
||||||
|
if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
||||||
|
// Remove HAProxy
|
||||||
|
const found = await checkContainer({ dockerId: localDocker.id, container: `${id}-${publicPort}` });
|
||||||
|
if (found) {
|
||||||
|
await executeDockerCmd({
|
||||||
|
dockerId: localDocker.id,
|
||||||
|
command: `docker stop -t 0 ${id}-${publicPort} && docker rm ${id}-${publicPort} `
|
||||||
|
})
|
||||||
|
}
|
||||||
|
await startTraefikTCPProxy(destinationDocker, id, publicPort, 9000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
await prisma.$disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else process.exit(0);
|
||||||
|
})();
|
||||||
19
apps/api/src/jobs/cleanupPrismaEngines.ts
Normal file
19
apps/api/src/jobs/cleanupPrismaEngines.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { parentPort } from 'node:worker_threads';
|
||||||
|
import { asyncExecShell, isDev, prisma } from '../lib/common';
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
if (parentPort) {
|
||||||
|
if (!isDev) {
|
||||||
|
try {
|
||||||
|
const { stdout } = await asyncExecShell(`ps -ef | grep /app/prisma-engines/query-engine | grep -v grep | wc -l | xargs`)
|
||||||
|
if (stdout.trim() != null && stdout.trim() != '' && Number(stdout.trim()) > 1) {
|
||||||
|
await asyncExecShell(`killall -q -e /app/prisma-engines/query-engine -o 10m`)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
} finally {
|
||||||
|
await prisma.$disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else process.exit(0);
|
||||||
|
})();
|
||||||
60
apps/api/src/jobs/cleanupStorage.ts
Normal file
60
apps/api/src/jobs/cleanupStorage.ts
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
import { parentPort } from 'node:worker_threads';
|
||||||
|
import { asyncExecShell, cleanupDockerStorage, executeDockerCmd, isDev, prisma, version } from '../lib/common';
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
if (parentPort) {
|
||||||
|
const destinationDockers = await prisma.destinationDocker.findMany();
|
||||||
|
let enginesDone = new Set()
|
||||||
|
for (const destination of destinationDockers) {
|
||||||
|
if (enginesDone.has(destination.engine) || enginesDone.has(destination.remoteIpAddress)) return
|
||||||
|
if (destination.engine) enginesDone.add(destination.engine)
|
||||||
|
if (destination.remoteIpAddress) enginesDone.add(destination.remoteIpAddress)
|
||||||
|
|
||||||
|
let lowDiskSpace = false;
|
||||||
|
try {
|
||||||
|
let stdout = null
|
||||||
|
if (!isDev) {
|
||||||
|
const output = await executeDockerCmd({ dockerId: destination.id, command: `CONTAINER=$(docker ps -lq | head -1) && docker exec $CONTAINER sh -c 'df -kPT /'` })
|
||||||
|
stdout = output.stdout;
|
||||||
|
} else {
|
||||||
|
const output = await asyncExecShell(
|
||||||
|
`df -kPT /`
|
||||||
|
);
|
||||||
|
stdout = output.stdout;
|
||||||
|
}
|
||||||
|
let lines = stdout.trim().split('\n');
|
||||||
|
let header = lines[0];
|
||||||
|
let regex =
|
||||||
|
/^Filesystem\s+|Type\s+|1024-blocks|\s+Used|\s+Available|\s+Capacity|\s+Mounted on\s*$/g;
|
||||||
|
const boundaries = [];
|
||||||
|
let match;
|
||||||
|
|
||||||
|
while ((match = regex.exec(header))) {
|
||||||
|
boundaries.push(match[0].length);
|
||||||
|
}
|
||||||
|
|
||||||
|
boundaries[boundaries.length - 1] = -1;
|
||||||
|
const data = lines.slice(1).map((line) => {
|
||||||
|
const cl = boundaries.map((boundary) => {
|
||||||
|
const column = boundary > 0 ? line.slice(0, boundary) : line;
|
||||||
|
line = line.slice(boundary);
|
||||||
|
return column.trim();
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
capacity: Number.parseInt(cl[5], 10) / 100
|
||||||
|
};
|
||||||
|
});
|
||||||
|
if (data.length > 0) {
|
||||||
|
const { capacity } = data[0];
|
||||||
|
if (capacity > 0.8) {
|
||||||
|
lowDiskSpace = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
await cleanupDockerStorage(destination.id, lowDiskSpace, false)
|
||||||
|
}
|
||||||
|
await prisma.$disconnect();
|
||||||
|
} else process.exit(0);
|
||||||
|
})();
|
||||||
358
apps/api/src/jobs/deployApplication.ts
Normal file
358
apps/api/src/jobs/deployApplication.ts
Normal file
@@ -0,0 +1,358 @@
|
|||||||
|
import { parentPort } from 'node:worker_threads';
|
||||||
|
import crypto from 'crypto';
|
||||||
|
import fs from 'fs/promises';
|
||||||
|
import yaml from 'js-yaml';
|
||||||
|
|
||||||
|
import { copyBaseConfigurationFiles, makeLabelForStandaloneApplication, saveBuildLog, setDefaultConfiguration } from '../lib/buildPacks/common';
|
||||||
|
import { createDirectories, decrypt, executeDockerCmd, getDomain, prisma } from '../lib/common';
|
||||||
|
import * as importers from '../lib/importers';
|
||||||
|
import * as buildpacks from '../lib/buildPacks';
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
if (parentPort) {
|
||||||
|
const concurrency = 1
|
||||||
|
const PQueue = await import('p-queue');
|
||||||
|
const queue = new PQueue.default({ concurrency });
|
||||||
|
parentPort.on('message', async (message) => {
|
||||||
|
if (parentPort) {
|
||||||
|
if (message === 'error') throw new Error('oops');
|
||||||
|
if (message === 'cancel') {
|
||||||
|
parentPort.postMessage('cancelled');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (message === 'status:autoUpdater') {
|
||||||
|
parentPort.postMessage({ size: queue.size, pending: queue.pending, caller: 'autoUpdater' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (message === 'status:cleanupStorage') {
|
||||||
|
parentPort.postMessage({ size: queue.size, pending: queue.pending, caller: 'cleanupStorage' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await queue.add(async () => {
|
||||||
|
const {
|
||||||
|
id: applicationId,
|
||||||
|
repository,
|
||||||
|
name,
|
||||||
|
destinationDocker,
|
||||||
|
destinationDockerId,
|
||||||
|
gitSource,
|
||||||
|
build_id: buildId,
|
||||||
|
configHash,
|
||||||
|
fqdn,
|
||||||
|
projectId,
|
||||||
|
secrets,
|
||||||
|
phpModules,
|
||||||
|
type,
|
||||||
|
pullmergeRequestId = null,
|
||||||
|
sourceBranch = null,
|
||||||
|
settings,
|
||||||
|
persistentStorage,
|
||||||
|
pythonWSGI,
|
||||||
|
pythonModule,
|
||||||
|
pythonVariable,
|
||||||
|
denoOptions,
|
||||||
|
exposePort,
|
||||||
|
baseImage,
|
||||||
|
baseBuildImage,
|
||||||
|
deploymentType,
|
||||||
|
} = message
|
||||||
|
let {
|
||||||
|
branch,
|
||||||
|
buildPack,
|
||||||
|
port,
|
||||||
|
installCommand,
|
||||||
|
buildCommand,
|
||||||
|
startCommand,
|
||||||
|
baseDirectory,
|
||||||
|
publishDirectory,
|
||||||
|
dockerFileLocation,
|
||||||
|
denoMainFile
|
||||||
|
} = message
|
||||||
|
try {
|
||||||
|
const { debug } = settings;
|
||||||
|
if (concurrency === 1) {
|
||||||
|
await prisma.build.updateMany({
|
||||||
|
where: {
|
||||||
|
status: { in: ['queued', 'running'] },
|
||||||
|
id: { not: buildId },
|
||||||
|
applicationId,
|
||||||
|
createdAt: { lt: new Date(new Date().getTime() - 10 * 1000) }
|
||||||
|
},
|
||||||
|
data: { status: 'failed' }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
let imageId = applicationId;
|
||||||
|
let domain = getDomain(fqdn);
|
||||||
|
const volumes =
|
||||||
|
persistentStorage?.map((storage) => {
|
||||||
|
return `${applicationId}${storage.path.replace(/\//gi, '-')}:${buildPack !== 'docker' ? '/app' : ''
|
||||||
|
}${storage.path}`;
|
||||||
|
}) || [];
|
||||||
|
// Previews, we need to get the source branch and set subdomain
|
||||||
|
if (pullmergeRequestId) {
|
||||||
|
branch = sourceBranch;
|
||||||
|
domain = `${pullmergeRequestId}.${domain}`;
|
||||||
|
imageId = `${applicationId}-${pullmergeRequestId}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let deployNeeded = true;
|
||||||
|
let destinationType;
|
||||||
|
|
||||||
|
if (destinationDockerId) {
|
||||||
|
destinationType = 'docker';
|
||||||
|
}
|
||||||
|
if (destinationType === 'docker') {
|
||||||
|
await prisma.build.update({ where: { id: buildId }, data: { status: 'running' } });
|
||||||
|
const { workdir, repodir } = await createDirectories({ repository, buildId });
|
||||||
|
const configuration = await setDefaultConfiguration(message);
|
||||||
|
|
||||||
|
buildPack = configuration.buildPack;
|
||||||
|
port = configuration.port;
|
||||||
|
installCommand = configuration.installCommand;
|
||||||
|
startCommand = configuration.startCommand;
|
||||||
|
buildCommand = configuration.buildCommand;
|
||||||
|
publishDirectory = configuration.publishDirectory;
|
||||||
|
baseDirectory = configuration.baseDirectory;
|
||||||
|
dockerFileLocation = configuration.dockerFileLocation;
|
||||||
|
denoMainFile = configuration.denoMainFile;
|
||||||
|
const commit = await importers[gitSource.type]({
|
||||||
|
applicationId,
|
||||||
|
debug,
|
||||||
|
workdir,
|
||||||
|
repodir,
|
||||||
|
githubAppId: gitSource.githubApp?.id,
|
||||||
|
gitlabAppId: gitSource.gitlabApp?.id,
|
||||||
|
customPort: gitSource.customPort,
|
||||||
|
repository,
|
||||||
|
branch,
|
||||||
|
buildId,
|
||||||
|
apiUrl: gitSource.apiUrl,
|
||||||
|
htmlUrl: gitSource.htmlUrl,
|
||||||
|
projectId,
|
||||||
|
deployKeyId: gitSource.gitlabApp?.deployKeyId || null,
|
||||||
|
privateSshKey: decrypt(gitSource.gitlabApp?.privateSshKey) || null
|
||||||
|
});
|
||||||
|
if (!commit) {
|
||||||
|
throw new Error('No commit found?');
|
||||||
|
}
|
||||||
|
let tag = commit.slice(0, 7);
|
||||||
|
if (pullmergeRequestId) {
|
||||||
|
tag = `${commit.slice(0, 7)}-${pullmergeRequestId}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await prisma.build.update({ where: { id: buildId }, data: { commit } });
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
if (!pullmergeRequestId) {
|
||||||
|
const currentHash = crypto
|
||||||
|
//@ts-ignore
|
||||||
|
.createHash('sha256')
|
||||||
|
.update(
|
||||||
|
JSON.stringify({
|
||||||
|
buildPack,
|
||||||
|
port,
|
||||||
|
exposePort,
|
||||||
|
installCommand,
|
||||||
|
buildCommand,
|
||||||
|
startCommand,
|
||||||
|
secrets,
|
||||||
|
branch,
|
||||||
|
repository,
|
||||||
|
fqdn
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.digest('hex');
|
||||||
|
|
||||||
|
if (configHash !== currentHash) {
|
||||||
|
await prisma.application.update({
|
||||||
|
where: { id: applicationId },
|
||||||
|
data: { configHash: currentHash }
|
||||||
|
});
|
||||||
|
deployNeeded = true;
|
||||||
|
if (configHash) {
|
||||||
|
await saveBuildLog({ line: 'Configuration changed.', buildId, applicationId });
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deployNeeded = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deployNeeded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
let imageFound = false;
|
||||||
|
try {
|
||||||
|
await executeDockerCmd({
|
||||||
|
dockerId: destinationDocker.id,
|
||||||
|
command: `docker image inspect ${applicationId}:${tag}`
|
||||||
|
})
|
||||||
|
imageFound = true;
|
||||||
|
} catch (error) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
await copyBaseConfigurationFiles(buildPack, workdir, buildId, applicationId, baseImage);
|
||||||
|
if (!imageFound || deployNeeded) {
|
||||||
|
// if (true) {
|
||||||
|
if (buildpacks[buildPack])
|
||||||
|
await buildpacks[buildPack]({
|
||||||
|
dockerId: destinationDocker.id,
|
||||||
|
buildId,
|
||||||
|
applicationId,
|
||||||
|
domain,
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
pullmergeRequestId,
|
||||||
|
buildPack,
|
||||||
|
repository,
|
||||||
|
branch,
|
||||||
|
projectId,
|
||||||
|
publishDirectory,
|
||||||
|
debug,
|
||||||
|
commit,
|
||||||
|
tag,
|
||||||
|
workdir,
|
||||||
|
port: exposePort ? `${exposePort}:${port}` : port,
|
||||||
|
installCommand,
|
||||||
|
buildCommand,
|
||||||
|
startCommand,
|
||||||
|
baseDirectory,
|
||||||
|
secrets,
|
||||||
|
phpModules,
|
||||||
|
pythonWSGI,
|
||||||
|
pythonModule,
|
||||||
|
pythonVariable,
|
||||||
|
dockerFileLocation,
|
||||||
|
denoMainFile,
|
||||||
|
denoOptions,
|
||||||
|
baseImage,
|
||||||
|
baseBuildImage,
|
||||||
|
deploymentType
|
||||||
|
});
|
||||||
|
else {
|
||||||
|
await saveBuildLog({ line: `Build pack ${buildPack} not found`, buildId, applicationId });
|
||||||
|
throw new Error(`Build pack ${buildPack} not found.`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await saveBuildLog({ line: 'Build image already available - no rebuild required.', buildId, applicationId });
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await executeDockerCmd({ dockerId: destinationDocker.id, command: `docker stop -t 0 ${imageId}` })
|
||||||
|
await executeDockerCmd({ dockerId: destinationDocker.id, command: `docker rm ${imageId}` })
|
||||||
|
} catch (error) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
const envs = [];
|
||||||
|
if (secrets.length > 0) {
|
||||||
|
secrets.forEach((secret) => {
|
||||||
|
if (pullmergeRequestId) {
|
||||||
|
if (secret.isPRMRSecret) {
|
||||||
|
envs.push(`${secret.name}='${secret.value}'`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!secret.isPRMRSecret) {
|
||||||
|
envs.push(`${secret.name}='${secret.value}'`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await fs.writeFile(`${workdir}/.env`, envs.join('\n'));
|
||||||
|
const labels = makeLabelForStandaloneApplication({
|
||||||
|
applicationId,
|
||||||
|
fqdn,
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
pullmergeRequestId,
|
||||||
|
buildPack,
|
||||||
|
repository,
|
||||||
|
branch,
|
||||||
|
projectId,
|
||||||
|
port: exposePort ? `${exposePort}:${port}` : port,
|
||||||
|
commit,
|
||||||
|
installCommand,
|
||||||
|
buildCommand,
|
||||||
|
startCommand,
|
||||||
|
baseDirectory,
|
||||||
|
publishDirectory
|
||||||
|
});
|
||||||
|
let envFound = false;
|
||||||
|
try {
|
||||||
|
envFound = !!(await fs.stat(`${workdir}/.env`));
|
||||||
|
} catch (error) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await saveBuildLog({ line: 'Deployment started.', buildId, applicationId });
|
||||||
|
const composeVolumes = volumes.map((volume) => {
|
||||||
|
return {
|
||||||
|
[`${volume.split(':')[0]}`]: {
|
||||||
|
name: volume.split(':')[0]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const composeFile = {
|
||||||
|
version: '3.8',
|
||||||
|
services: {
|
||||||
|
[imageId]: {
|
||||||
|
image: `${applicationId}:${tag}`,
|
||||||
|
container_name: imageId,
|
||||||
|
volumes,
|
||||||
|
env_file: envFound ? [`${workdir}/.env`] : [],
|
||||||
|
networks: [destinationDocker.network],
|
||||||
|
labels,
|
||||||
|
depends_on: [],
|
||||||
|
restart: 'always',
|
||||||
|
expose: [port],
|
||||||
|
...(exposePort ? { ports: [`${exposePort}:${port}`] } : {}),
|
||||||
|
// logging: {
|
||||||
|
// driver: 'fluentd',
|
||||||
|
// },
|
||||||
|
deploy: {
|
||||||
|
restart_policy: {
|
||||||
|
condition: 'on-failure',
|
||||||
|
delay: '5s',
|
||||||
|
max_attempts: 3,
|
||||||
|
window: '120s'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
networks: {
|
||||||
|
[destinationDocker.network]: {
|
||||||
|
external: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
volumes: Object.assign({}, ...composeVolumes)
|
||||||
|
};
|
||||||
|
await fs.writeFile(`${workdir}/docker-compose.yml`, yaml.dump(composeFile));
|
||||||
|
await executeDockerCmd({ dockerId: destinationDocker.id, command: `docker compose --project-directory ${workdir} up -d` })
|
||||||
|
await saveBuildLog({ line: 'Deployment successful!', buildId, applicationId });
|
||||||
|
} catch (error) {
|
||||||
|
await saveBuildLog({ line: error, buildId, applicationId });
|
||||||
|
await prisma.build.update({
|
||||||
|
where: { id: message.build_id },
|
||||||
|
data: { status: 'failed' }
|
||||||
|
});
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
await saveBuildLog({ line: 'Proxy will be updated shortly.', buildId, applicationId });
|
||||||
|
await prisma.build.update({ where: { id: message.build_id }, data: { status: 'success' } });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
await prisma.build.update({
|
||||||
|
where: { id: message.build_id },
|
||||||
|
data: { status: 'failed' }
|
||||||
|
});
|
||||||
|
await saveBuildLog({ line: error, buildId, applicationId });
|
||||||
|
} finally {
|
||||||
|
await prisma.$disconnect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await prisma.$disconnect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else process.exit(0);
|
||||||
|
})();
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
import { base64Encode } from '$lib/crypto';
|
import { base64Encode, executeDockerCmd, generateTimestamp, getDomain, isDev, prisma, version } from "../common";
|
||||||
import { getDomain, saveBuildLog, version } from '$lib/common';
|
|
||||||
import * as db from '$lib/database';
|
|
||||||
import { scanningTemplates } from '$lib/components/templates';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import { staticDeployments } from '$lib/components/common';
|
import { day } from "../dayjs";
|
||||||
|
|
||||||
const staticApps = ['static', 'react', 'vuejs', 'svelte', 'gatsby', 'astro', 'eleventy'];
|
const staticApps = ['static', 'react', 'vuejs', 'svelte', 'gatsby', 'astro', 'eleventy'];
|
||||||
const nodeBased = [
|
const nodeBased = [
|
||||||
@@ -20,223 +17,7 @@ const nodeBased = [
|
|||||||
'nextjs'
|
'nextjs'
|
||||||
];
|
];
|
||||||
|
|
||||||
export function makeLabelForStandaloneApplication({
|
export function setDefaultBaseImage(buildPack: string | null, deploymentType: string | null = null) {
|
||||||
applicationId,
|
|
||||||
fqdn,
|
|
||||||
name,
|
|
||||||
type,
|
|
||||||
pullmergeRequestId = null,
|
|
||||||
buildPack,
|
|
||||||
repository,
|
|
||||||
branch,
|
|
||||||
projectId,
|
|
||||||
port,
|
|
||||||
commit,
|
|
||||||
installCommand,
|
|
||||||
buildCommand,
|
|
||||||
startCommand,
|
|
||||||
baseDirectory,
|
|
||||||
publishDirectory
|
|
||||||
}) {
|
|
||||||
if (pullmergeRequestId) {
|
|
||||||
const protocol = fqdn.startsWith('https://') ? 'https' : 'http';
|
|
||||||
const domain = getDomain(fqdn);
|
|
||||||
fqdn = `${protocol}://${pullmergeRequestId}.${domain}`;
|
|
||||||
}
|
|
||||||
return [
|
|
||||||
'coolify.managed=true',
|
|
||||||
`coolify.version=${version}`,
|
|
||||||
`coolify.type=standalone-application`,
|
|
||||||
`coolify.configuration=${base64Encode(
|
|
||||||
JSON.stringify({
|
|
||||||
applicationId,
|
|
||||||
fqdn,
|
|
||||||
name,
|
|
||||||
type,
|
|
||||||
pullmergeRequestId,
|
|
||||||
buildPack,
|
|
||||||
repository,
|
|
||||||
branch,
|
|
||||||
projectId,
|
|
||||||
port,
|
|
||||||
commit,
|
|
||||||
installCommand,
|
|
||||||
buildCommand,
|
|
||||||
startCommand,
|
|
||||||
baseDirectory,
|
|
||||||
publishDirectory
|
|
||||||
})
|
|
||||||
)}`
|
|
||||||
];
|
|
||||||
}
|
|
||||||
export async function makeLabelForStandaloneDatabase({ id, image, volume }) {
|
|
||||||
const database = await db.prisma.database.findFirst({ where: { id } });
|
|
||||||
delete database.destinationDockerId;
|
|
||||||
delete database.createdAt;
|
|
||||||
delete database.updatedAt;
|
|
||||||
return [
|
|
||||||
'coolify.managed=true',
|
|
||||||
`coolify.version=${version}`,
|
|
||||||
`coolify.type=standalone-database`,
|
|
||||||
`coolify.configuration=${base64Encode(
|
|
||||||
JSON.stringify({
|
|
||||||
version,
|
|
||||||
image,
|
|
||||||
volume,
|
|
||||||
...database
|
|
||||||
})
|
|
||||||
)}`
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function makeLabelForServices(type) {
|
|
||||||
return [
|
|
||||||
'coolify.managed=true',
|
|
||||||
`coolify.version=${version}`,
|
|
||||||
`coolify.type=service`,
|
|
||||||
`coolify.service.type=${type}`
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
export const setDefaultConfiguration = async (data) => {
|
|
||||||
let {
|
|
||||||
buildPack,
|
|
||||||
port,
|
|
||||||
installCommand,
|
|
||||||
startCommand,
|
|
||||||
buildCommand,
|
|
||||||
publishDirectory,
|
|
||||||
baseDirectory,
|
|
||||||
dockerFileLocation,
|
|
||||||
denoMainFile
|
|
||||||
} = data;
|
|
||||||
const template = scanningTemplates[buildPack];
|
|
||||||
if (!port) {
|
|
||||||
port = template?.port || 3000;
|
|
||||||
|
|
||||||
if (buildPack === 'static') port = 80;
|
|
||||||
else if (buildPack === 'node') port = 3000;
|
|
||||||
else if (buildPack === 'php') port = 80;
|
|
||||||
else if (buildPack === 'python') port = 8000;
|
|
||||||
}
|
|
||||||
if (!installCommand && buildPack !== 'static' && buildPack !== 'laravel')
|
|
||||||
installCommand = template?.installCommand || 'yarn install';
|
|
||||||
if (!startCommand && buildPack !== 'static' && buildPack !== 'laravel')
|
|
||||||
startCommand = template?.startCommand || 'yarn start';
|
|
||||||
if (!buildCommand && buildPack !== 'static' && buildPack !== 'laravel')
|
|
||||||
buildCommand = template?.buildCommand || null;
|
|
||||||
if (!publishDirectory) publishDirectory = template?.publishDirectory || null;
|
|
||||||
if (baseDirectory) {
|
|
||||||
if (!baseDirectory.startsWith('/')) baseDirectory = `/${baseDirectory}`;
|
|
||||||
if (!baseDirectory.endsWith('/')) baseDirectory = `${baseDirectory}/`;
|
|
||||||
}
|
|
||||||
if (dockerFileLocation) {
|
|
||||||
if (!dockerFileLocation.startsWith('/')) dockerFileLocation = `/${dockerFileLocation}`;
|
|
||||||
if (dockerFileLocation.endsWith('/')) dockerFileLocation = dockerFileLocation.slice(0, -1);
|
|
||||||
} else {
|
|
||||||
dockerFileLocation = '/Dockerfile';
|
|
||||||
}
|
|
||||||
if (!denoMainFile) {
|
|
||||||
denoMainFile = 'main.ts';
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
buildPack,
|
|
||||||
port,
|
|
||||||
installCommand,
|
|
||||||
startCommand,
|
|
||||||
buildCommand,
|
|
||||||
publishDirectory,
|
|
||||||
baseDirectory,
|
|
||||||
dockerFileLocation,
|
|
||||||
denoMainFile
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export async function copyBaseConfigurationFiles(
|
|
||||||
buildPack,
|
|
||||||
workdir,
|
|
||||||
buildId,
|
|
||||||
applicationId,
|
|
||||||
baseImage
|
|
||||||
) {
|
|
||||||
try {
|
|
||||||
if (buildPack === 'php') {
|
|
||||||
await fs.writeFile(`${workdir}/entrypoint.sh`, `chown -R 1000 /app`);
|
|
||||||
await saveBuildLog({
|
|
||||||
line: 'Copied default configuration file for PHP.',
|
|
||||||
buildId,
|
|
||||||
applicationId
|
|
||||||
});
|
|
||||||
} else if (staticDeployments.includes(buildPack) && baseImage.includes('nginx')) {
|
|
||||||
await fs.writeFile(
|
|
||||||
`${workdir}/nginx.conf`,
|
|
||||||
`user nginx;
|
|
||||||
worker_processes auto;
|
|
||||||
|
|
||||||
error_log /docker.stdout;
|
|
||||||
pid /run/nginx.pid;
|
|
||||||
|
|
||||||
events {
|
|
||||||
worker_connections 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
http {
|
|
||||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
||||||
'$status $body_bytes_sent "$http_referer" '
|
|
||||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
||||||
|
|
||||||
access_log /docker.stdout main;
|
|
||||||
|
|
||||||
sendfile on;
|
|
||||||
tcp_nopush on;
|
|
||||||
tcp_nodelay on;
|
|
||||||
keepalive_timeout 65;
|
|
||||||
types_hash_max_size 2048;
|
|
||||||
|
|
||||||
include /etc/nginx/mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root /app;
|
|
||||||
index index.html;
|
|
||||||
try_files $uri $uri/index.html $uri/ /index.html =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
error_page 404 /50x.html;
|
|
||||||
|
|
||||||
# redirect server error pages to the static page /50x.html
|
|
||||||
#
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
location = /50x.html {
|
|
||||||
root /app;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
throw new Error(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function checkPnpm(installCommand = null, buildCommand = null, startCommand = null) {
|
|
||||||
return (
|
|
||||||
installCommand?.includes('pnpm') ||
|
|
||||||
buildCommand?.includes('pnpm') ||
|
|
||||||
startCommand?.includes('pnpm')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setDefaultBaseImage(buildPack) {
|
|
||||||
const nodeVersions = [
|
const nodeVersions = [
|
||||||
{
|
{
|
||||||
value: 'node:lts',
|
value: 'node:lts',
|
||||||
@@ -471,17 +252,24 @@ export function setDefaultBaseImage(buildPack) {
|
|||||||
label: 'python:3.7-slim-bullseye'
|
label: 'python:3.7-slim-bullseye'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
let payload = {
|
let payload: any = {
|
||||||
baseImage: null,
|
baseImage: null,
|
||||||
baseBuildImage: null,
|
baseBuildImage: null,
|
||||||
baseImages: [],
|
baseImages: [],
|
||||||
baseBuildImages: []
|
baseBuildImages: []
|
||||||
};
|
};
|
||||||
if (nodeBased.includes(buildPack)) {
|
if (nodeBased.includes(buildPack)) {
|
||||||
payload.baseImage = 'node:lts';
|
if (deploymentType === 'static') {
|
||||||
payload.baseImages = nodeVersions;
|
payload.baseImage = 'webdevops/nginx:alpine';
|
||||||
payload.baseBuildImage = 'node:lts';
|
payload.baseImages = staticVersions;
|
||||||
payload.baseBuildImages = nodeVersions;
|
payload.baseBuildImage = 'node:lts';
|
||||||
|
payload.baseBuildImages = nodeVersions;
|
||||||
|
} else {
|
||||||
|
payload.baseImage = 'node:lts';
|
||||||
|
payload.baseImages = nodeVersions;
|
||||||
|
payload.baseBuildImage = 'node:lts';
|
||||||
|
payload.baseBuildImages = nodeVersions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (staticApps.includes(buildPack)) {
|
if (staticApps.includes(buildPack)) {
|
||||||
payload.baseImage = 'webdevops/nginx:alpine';
|
payload.baseImage = 'webdevops/nginx:alpine';
|
||||||
@@ -513,3 +301,462 @@ export function setDefaultBaseImage(buildPack) {
|
|||||||
}
|
}
|
||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const setDefaultConfiguration = async (data: any) => {
|
||||||
|
let {
|
||||||
|
buildPack,
|
||||||
|
port,
|
||||||
|
installCommand,
|
||||||
|
startCommand,
|
||||||
|
buildCommand,
|
||||||
|
publishDirectory,
|
||||||
|
baseDirectory,
|
||||||
|
dockerFileLocation,
|
||||||
|
denoMainFile
|
||||||
|
} = data;
|
||||||
|
//@ts-ignore
|
||||||
|
const template = scanningTemplates[buildPack];
|
||||||
|
if (!port) {
|
||||||
|
port = template?.port || 3000;
|
||||||
|
|
||||||
|
if (buildPack === 'static') port = 80;
|
||||||
|
else if (buildPack === 'node') port = 3000;
|
||||||
|
else if (buildPack === 'php') port = 80;
|
||||||
|
else if (buildPack === 'python') port = 8000;
|
||||||
|
}
|
||||||
|
if (!installCommand && buildPack !== 'static' && buildPack !== 'laravel')
|
||||||
|
installCommand = template?.installCommand || 'yarn install';
|
||||||
|
if (!startCommand && buildPack !== 'static' && buildPack !== 'laravel')
|
||||||
|
startCommand = template?.startCommand || 'yarn start';
|
||||||
|
if (!buildCommand && buildPack !== 'static' && buildPack !== 'laravel')
|
||||||
|
buildCommand = template?.buildCommand || null;
|
||||||
|
if (!publishDirectory) publishDirectory = template?.publishDirectory || null;
|
||||||
|
if (baseDirectory) {
|
||||||
|
if (!baseDirectory.startsWith('/')) baseDirectory = `/${baseDirectory}`;
|
||||||
|
if (!baseDirectory.endsWith('/')) baseDirectory = `${baseDirectory}/`;
|
||||||
|
}
|
||||||
|
if (dockerFileLocation) {
|
||||||
|
if (!dockerFileLocation.startsWith('/')) dockerFileLocation = `/${dockerFileLocation}`;
|
||||||
|
if (dockerFileLocation.endsWith('/')) dockerFileLocation = dockerFileLocation.slice(0, -1);
|
||||||
|
} else {
|
||||||
|
dockerFileLocation = '/Dockerfile';
|
||||||
|
}
|
||||||
|
if (!denoMainFile) {
|
||||||
|
denoMainFile = 'main.ts';
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
buildPack,
|
||||||
|
port,
|
||||||
|
installCommand,
|
||||||
|
startCommand,
|
||||||
|
buildCommand,
|
||||||
|
publishDirectory,
|
||||||
|
baseDirectory,
|
||||||
|
dockerFileLocation,
|
||||||
|
denoMainFile
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const scanningTemplates = {
|
||||||
|
'@sveltejs/kit': {
|
||||||
|
buildPack: 'nodejs'
|
||||||
|
},
|
||||||
|
astro: {
|
||||||
|
buildPack: 'astro'
|
||||||
|
},
|
||||||
|
'@11ty/eleventy': {
|
||||||
|
buildPack: 'eleventy'
|
||||||
|
},
|
||||||
|
svelte: {
|
||||||
|
buildPack: 'svelte'
|
||||||
|
},
|
||||||
|
'@nestjs/core': {
|
||||||
|
buildPack: 'nestjs'
|
||||||
|
},
|
||||||
|
next: {
|
||||||
|
buildPack: 'nextjs'
|
||||||
|
},
|
||||||
|
nuxt: {
|
||||||
|
buildPack: 'nuxtjs'
|
||||||
|
},
|
||||||
|
'react-scripts': {
|
||||||
|
buildPack: 'react'
|
||||||
|
},
|
||||||
|
'parcel-bundler': {
|
||||||
|
buildPack: 'static'
|
||||||
|
},
|
||||||
|
'@vue/cli-service': {
|
||||||
|
buildPack: 'vuejs'
|
||||||
|
},
|
||||||
|
vuejs: {
|
||||||
|
buildPack: 'vuejs'
|
||||||
|
},
|
||||||
|
gatsby: {
|
||||||
|
buildPack: 'gatsby'
|
||||||
|
},
|
||||||
|
'preact-cli': {
|
||||||
|
buildPack: 'react'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export const saveBuildLog = async ({
|
||||||
|
line,
|
||||||
|
buildId,
|
||||||
|
applicationId
|
||||||
|
}: {
|
||||||
|
line: string;
|
||||||
|
buildId: string;
|
||||||
|
applicationId: string;
|
||||||
|
}): Promise<any> => {
|
||||||
|
if (line && typeof line === 'string' && line.includes('ghs_')) {
|
||||||
|
const regex = /ghs_.*@/g;
|
||||||
|
line = line.replace(regex, '<SENSITIVE_DATA_DELETED>@');
|
||||||
|
}
|
||||||
|
const addTimestamp = `[${generateTimestamp()}] ${line}`;
|
||||||
|
if (isDev) console.debug(`[${applicationId}] ${addTimestamp}`);
|
||||||
|
return await prisma.buildLog.create({
|
||||||
|
data: {
|
||||||
|
line: addTimestamp, buildId, time: Number(day().valueOf()), applicationId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export async function copyBaseConfigurationFiles(
|
||||||
|
buildPack,
|
||||||
|
workdir,
|
||||||
|
buildId,
|
||||||
|
applicationId,
|
||||||
|
baseImage
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
if (buildPack === 'php') {
|
||||||
|
await fs.writeFile(`${workdir}/entrypoint.sh`, `chown -R 1000 /app`);
|
||||||
|
await saveBuildLog({
|
||||||
|
line: 'Copied default configuration file for PHP.',
|
||||||
|
buildId,
|
||||||
|
applicationId
|
||||||
|
});
|
||||||
|
} else if (baseImage?.includes('nginx')) {
|
||||||
|
await fs.writeFile(
|
||||||
|
`${workdir}/nginx.conf`,
|
||||||
|
`user nginx;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
error_log /docker.stdout;
|
||||||
|
pid /run/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /docker.stdout main;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
tcp_nodelay on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
types_hash_max_size 2048;
|
||||||
|
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /app;
|
||||||
|
index index.html;
|
||||||
|
try_files $uri $uri/index.html $uri/ /index.html =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 404 /50x.html;
|
||||||
|
|
||||||
|
# redirect server error pages to the static page /50x.html
|
||||||
|
#
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /app;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkPnpm(installCommand = null, buildCommand = null, startCommand = null) {
|
||||||
|
return (
|
||||||
|
installCommand?.includes('pnpm') ||
|
||||||
|
buildCommand?.includes('pnpm') ||
|
||||||
|
startCommand?.includes('pnpm')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export async function buildImage({
|
||||||
|
applicationId,
|
||||||
|
tag,
|
||||||
|
workdir,
|
||||||
|
buildId,
|
||||||
|
dockerId,
|
||||||
|
isCache = false,
|
||||||
|
debug = false,
|
||||||
|
dockerFileLocation = '/Dockerfile'
|
||||||
|
}) {
|
||||||
|
if (isCache) {
|
||||||
|
await saveBuildLog({ line: `Building cache image started.`, buildId, applicationId });
|
||||||
|
} else {
|
||||||
|
await saveBuildLog({ line: `Building image started.`, buildId, applicationId });
|
||||||
|
}
|
||||||
|
if (debug) {
|
||||||
|
await saveBuildLog({ line: `\n###############\nIMPORTANT: Due to some issues during implementing Remote Docker Engine, the builds logs are not streamed at the moment - but will be soon! You will see the full build log when the build is finished!\n###############`, buildId, applicationId });
|
||||||
|
}
|
||||||
|
if (!debug && isCache) {
|
||||||
|
await saveBuildLog({
|
||||||
|
line: `Debug turned off. To see more details, allow it in the configuration.`,
|
||||||
|
buildId,
|
||||||
|
applicationId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const dockerFile = isCache ? `${dockerFileLocation}-cache` : `${dockerFileLocation}`
|
||||||
|
const cache = `${applicationId}:${tag}${isCache ? '-cache' : ''}`
|
||||||
|
const { stderr } = await executeDockerCmd({ dockerId, command: `docker build --progress plain -f ${workdir}/${dockerFile} -t ${cache} ${workdir}` })
|
||||||
|
if (debug) {
|
||||||
|
const array = stderr.split('\n')
|
||||||
|
for (const line of array) {
|
||||||
|
if (line !== '\n') {
|
||||||
|
await saveBuildLog({
|
||||||
|
line: `${line.replace('\n', '')}`,
|
||||||
|
buildId,
|
||||||
|
applicationId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// await new Promise((resolve, reject) => {
|
||||||
|
// const command = spawn(`docker`, ['build', '-f', `${workdir}${dockerFile}`, '-t', `${cache}`,`${workdir}`], {
|
||||||
|
// env: {
|
||||||
|
// DOCKER_HOST: 'ssh://root@95.217.178.202',
|
||||||
|
// DOCKER_BUILDKIT: '1'
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// command.stdout.on('data', function (data) {
|
||||||
|
// console.log('stdout: ' + data);
|
||||||
|
// });
|
||||||
|
// command.stderr.on('data', function (data) {
|
||||||
|
// console.log('stderr: ' + data);
|
||||||
|
// });
|
||||||
|
// command.on('error', function (error) {
|
||||||
|
// console.log(error)
|
||||||
|
// reject(error)
|
||||||
|
// })
|
||||||
|
// command.on('exit', function (code) {
|
||||||
|
// console.log('exit code: ' + code);
|
||||||
|
// resolve(code)
|
||||||
|
// });
|
||||||
|
// })
|
||||||
|
|
||||||
|
|
||||||
|
// console.log({ stdout, stderr })
|
||||||
|
// const stream = await docker.engine.buildImage(
|
||||||
|
// { src: ['.'], context: workdir },
|
||||||
|
// {
|
||||||
|
// dockerfile: isCache ? `${dockerFileLocation}-cache` : dockerFileLocation,
|
||||||
|
// t: `${applicationId}:${tag}${isCache ? '-cache' : ''}`
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// await streamEvents({ stream, docker, buildId, applicationId, debug });
|
||||||
|
if (isCache) {
|
||||||
|
await saveBuildLog({ line: `Building cache image successful.`, buildId, applicationId });
|
||||||
|
} else {
|
||||||
|
await saveBuildLog({ line: `Building image successful.`, buildId, applicationId });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function streamEvents({ stream, docker, buildId, applicationId, debug }) {
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
docker.engine.modem.followProgress(stream, onFinished, onProgress);
|
||||||
|
function onFinished(err, res) {
|
||||||
|
if (err) reject(err);
|
||||||
|
resolve(res);
|
||||||
|
}
|
||||||
|
async function onProgress(event) {
|
||||||
|
if (event.error) {
|
||||||
|
reject(event.error);
|
||||||
|
} else if (event.stream) {
|
||||||
|
if (event.stream !== '\n') {
|
||||||
|
if (debug)
|
||||||
|
await saveBuildLog({
|
||||||
|
line: `${event.stream.replace('\n', '')}`,
|
||||||
|
buildId,
|
||||||
|
applicationId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function makeLabelForStandaloneApplication({
|
||||||
|
applicationId,
|
||||||
|
fqdn,
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
pullmergeRequestId = null,
|
||||||
|
buildPack,
|
||||||
|
repository,
|
||||||
|
branch,
|
||||||
|
projectId,
|
||||||
|
port,
|
||||||
|
commit,
|
||||||
|
installCommand,
|
||||||
|
buildCommand,
|
||||||
|
startCommand,
|
||||||
|
baseDirectory,
|
||||||
|
publishDirectory
|
||||||
|
}) {
|
||||||
|
if (pullmergeRequestId) {
|
||||||
|
const protocol = fqdn.startsWith('https://') ? 'https' : 'http';
|
||||||
|
const domain = getDomain(fqdn);
|
||||||
|
fqdn = `${protocol}://${pullmergeRequestId}.${domain}`;
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'coolify.managed=true',
|
||||||
|
`coolify.version=${version}`,
|
||||||
|
`coolify.type=standalone-application`,
|
||||||
|
`coolify.configuration=${base64Encode(
|
||||||
|
JSON.stringify({
|
||||||
|
applicationId,
|
||||||
|
fqdn,
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
pullmergeRequestId,
|
||||||
|
buildPack,
|
||||||
|
repository,
|
||||||
|
branch,
|
||||||
|
projectId,
|
||||||
|
port,
|
||||||
|
commit,
|
||||||
|
installCommand,
|
||||||
|
buildCommand,
|
||||||
|
startCommand,
|
||||||
|
baseDirectory,
|
||||||
|
publishDirectory
|
||||||
|
})
|
||||||
|
)}`
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function buildCacheImageWithNode(data, imageForBuild) {
|
||||||
|
const {
|
||||||
|
workdir,
|
||||||
|
buildId,
|
||||||
|
baseDirectory,
|
||||||
|
installCommand,
|
||||||
|
buildCommand,
|
||||||
|
secrets,
|
||||||
|
pullmergeRequestId
|
||||||
|
} = data;
|
||||||
|
|
||||||
|
|
||||||
|
const isPnpm = checkPnpm(installCommand, buildCommand);
|
||||||
|
const Dockerfile: Array<string> = [];
|
||||||
|
Dockerfile.push(`FROM ${imageForBuild}`);
|
||||||
|
Dockerfile.push('WORKDIR /app');
|
||||||
|
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
||||||
|
if (secrets.length > 0) {
|
||||||
|
secrets.forEach((secret) => {
|
||||||
|
if (secret.isBuildSecret) {
|
||||||
|
if (pullmergeRequestId) {
|
||||||
|
if (secret.isPRMRSecret) {
|
||||||
|
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!secret.isPRMRSecret) {
|
||||||
|
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (isPnpm) {
|
||||||
|
Dockerfile.push('RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@7');
|
||||||
|
}
|
||||||
|
if (installCommand) {
|
||||||
|
Dockerfile.push(`COPY .${baseDirectory || ''}/package.json ./`);
|
||||||
|
Dockerfile.push(`RUN ${installCommand}`);
|
||||||
|
}
|
||||||
|
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
|
||||||
|
Dockerfile.push(`RUN ${buildCommand}`);
|
||||||
|
await fs.writeFile(`${workdir}/Dockerfile-cache`, Dockerfile.join('\n'));
|
||||||
|
await buildImage({ ...data, isCache: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function buildCacheImageForLaravel(data, imageForBuild) {
|
||||||
|
const { workdir, buildId, secrets, pullmergeRequestId } = data;
|
||||||
|
|
||||||
|
const Dockerfile: Array<string> = [];
|
||||||
|
Dockerfile.push(`FROM ${imageForBuild}`);
|
||||||
|
Dockerfile.push('WORKDIR /app');
|
||||||
|
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
||||||
|
if (secrets.length > 0) {
|
||||||
|
secrets.forEach((secret) => {
|
||||||
|
if (secret.isBuildSecret) {
|
||||||
|
if (pullmergeRequestId) {
|
||||||
|
if (secret.isPRMRSecret) {
|
||||||
|
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!secret.isPRMRSecret) {
|
||||||
|
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Dockerfile.push(`COPY *.json *.mix.js /app/`);
|
||||||
|
Dockerfile.push(`COPY resources /app/resources`);
|
||||||
|
Dockerfile.push(`RUN yarn install && yarn production`);
|
||||||
|
await fs.writeFile(`${workdir}/Dockerfile-cache`, Dockerfile.join('\n'));
|
||||||
|
await buildImage({ ...data, isCache: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function buildCacheImageWithCargo(data, imageForBuild) {
|
||||||
|
const {
|
||||||
|
applicationId,
|
||||||
|
workdir,
|
||||||
|
buildId,
|
||||||
|
} = data;
|
||||||
|
|
||||||
|
const Dockerfile: Array<string> = [];
|
||||||
|
Dockerfile.push(`FROM ${imageForBuild} as planner-${applicationId}`);
|
||||||
|
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
||||||
|
Dockerfile.push('WORKDIR /app');
|
||||||
|
Dockerfile.push('RUN cargo install cargo-chef');
|
||||||
|
Dockerfile.push('COPY . .');
|
||||||
|
Dockerfile.push('RUN cargo chef prepare --recipe-path recipe.json');
|
||||||
|
Dockerfile.push(`FROM ${imageForBuild}`);
|
||||||
|
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
||||||
|
Dockerfile.push('WORKDIR /app');
|
||||||
|
Dockerfile.push('RUN cargo install cargo-chef');
|
||||||
|
Dockerfile.push(`COPY --from=planner-${applicationId} /app/recipe.json recipe.json`);
|
||||||
|
Dockerfile.push('RUN cargo chef cook --release --recipe-path recipe.json');
|
||||||
|
await fs.writeFile(`${workdir}/Dockerfile-cache`, Dockerfile.join('\n'));
|
||||||
|
await buildImage({ ...data, isCache: true });
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
import { buildImage } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image): Promise<void> => {
|
const createDockerfile = async (data, image): Promise<void> => {
|
||||||
const {
|
const {
|
||||||
@@ -42,9 +42,8 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
Dockerfile.push(`COPY .${baseDirectory || ''}/deps.ts /app`);
|
Dockerfile.push(`COPY .${baseDirectory || ''}/deps.ts /app`);
|
||||||
Dockerfile.push(`RUN deno cache deps.ts`);
|
Dockerfile.push(`RUN deno cache deps.ts`);
|
||||||
}
|
}
|
||||||
Dockerfile.push(`COPY ${denoMainFile} /app`);
|
|
||||||
Dockerfile.push(`RUN deno cache ${denoMainFile}`);
|
|
||||||
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
|
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
|
||||||
|
Dockerfile.push(`RUN deno cache ${denoMainFile}`);
|
||||||
Dockerfile.push(`ENV NO_COLOR true`);
|
Dockerfile.push(`ENV NO_COLOR true`);
|
||||||
Dockerfile.push(`EXPOSE ${port}`);
|
Dockerfile.push(`EXPOSE ${port}`);
|
||||||
Dockerfile.push(`CMD deno run ${denoOptions ? denoOptions.split(' ') : ''} ${denoMainFile}`);
|
Dockerfile.push(`CMD deno run ${denoOptions ? denoOptions.split(' ') : ''} ${denoMainFile}`);
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
import { buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
import { buildImage } from './common';
|
||||||
|
|
||||||
export default async function ({
|
export default async function (data) {
|
||||||
applicationId,
|
let {
|
||||||
debug,
|
applicationId,
|
||||||
tag,
|
debug,
|
||||||
workdir,
|
tag,
|
||||||
docker,
|
workdir,
|
||||||
buildId,
|
buildId,
|
||||||
baseDirectory,
|
baseDirectory,
|
||||||
secrets,
|
secrets,
|
||||||
pullmergeRequestId,
|
pullmergeRequestId,
|
||||||
dockerFileLocation
|
dockerFileLocation
|
||||||
}) {
|
} = data
|
||||||
try {
|
try {
|
||||||
const file = `${workdir}${dockerFileLocation}`;
|
const file = `${workdir}${dockerFileLocation}`;
|
||||||
let dockerFileOut = `${workdir}`;
|
let dockerFileOut = `${workdir}`;
|
||||||
@@ -45,7 +45,7 @@ export default async function ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
await fs.writeFile(`${dockerFileOut}${dockerFileLocation}`, Dockerfile.join('\n'));
|
await fs.writeFile(`${dockerFileOut}${dockerFileLocation}`, Dockerfile.join('\n'));
|
||||||
await buildImage({ applicationId, tag, workdir, docker, buildId, debug, dockerFileLocation });
|
await buildImage(data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { buildCacheImageWithNode, buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
import { buildCacheImageWithNode, buildImage } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, imageforBuild): Promise<void> => {
|
const createDockerfile = async (data, imageforBuild): Promise<void> => {
|
||||||
const { applicationId, tag, workdir, publishDirectory, baseImage, buildId, port } = data;
|
const { applicationId, tag, workdir, publishDirectory, baseImage, buildId, port } = data;
|
||||||
@@ -9,7 +9,7 @@ const createDockerfile = async (data, imageforBuild): Promise<void> => {
|
|||||||
Dockerfile.push('WORKDIR /app');
|
Dockerfile.push('WORKDIR /app');
|
||||||
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
||||||
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /app/${publishDirectory} ./`);
|
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /app/${publishDirectory} ./`);
|
||||||
if (baseImage.includes('nginx')) {
|
if (baseImage?.includes('nginx')) {
|
||||||
Dockerfile.push(`COPY /nginx.conf /etc/nginx/nginx.conf`);
|
Dockerfile.push(`COPY /nginx.conf /etc/nginx/nginx.conf`);
|
||||||
}
|
}
|
||||||
Dockerfile.push(`EXPOSE ${port}`);
|
Dockerfile.push(`EXPOSE ${port}`);
|
||||||
29
apps/api/src/lib/buildPacks/heroku.ts
Normal file
29
apps/api/src/lib/buildPacks/heroku.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { executeDockerCmd, prisma } from "../common"
|
||||||
|
import { saveBuildLog } from "./common";
|
||||||
|
|
||||||
|
export default async function (data: any): Promise<void> {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ import eleventy from './static';
|
|||||||
import python from './python';
|
import python from './python';
|
||||||
import deno from './deno';
|
import deno from './deno';
|
||||||
import laravel from './laravel';
|
import laravel from './laravel';
|
||||||
|
import heroku from './heroku';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
node,
|
node,
|
||||||
@@ -33,5 +34,6 @@ export {
|
|||||||
eleventy,
|
eleventy,
|
||||||
python,
|
python,
|
||||||
deno,
|
deno,
|
||||||
laravel
|
laravel,
|
||||||
|
heroku
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { buildCacheImageForLaravel, buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
import { buildCacheImageForLaravel, buildImage } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image): Promise<void> => {
|
const createDockerfile = async (data, image): Promise<void> => {
|
||||||
const { workdir, applicationId, tag, buildId, port } = data;
|
const { workdir, applicationId, tag, buildId, port } = data;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { buildCacheImageWithNode, buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
import { buildCacheImageWithNode, buildImage } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image): Promise<void> => {
|
const createDockerfile = async (data, image): Promise<void> => {
|
||||||
const { buildId, applicationId, tag, port, startCommand, workdir, baseDirectory } = data;
|
const { buildId, applicationId, tag, port, startCommand, workdir, baseDirectory } = data;
|
||||||
@@ -10,8 +10,7 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
Dockerfile.push('WORKDIR /app');
|
Dockerfile.push('WORKDIR /app');
|
||||||
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
||||||
if (isPnpm) {
|
if (isPnpm) {
|
||||||
Dockerfile.push('RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm');
|
Dockerfile.push('RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@7');
|
||||||
Dockerfile.push('RUN pnpm add -g pnpm');
|
|
||||||
}
|
}
|
||||||
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /app/${baseDirectory || ''} ./`);
|
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /app/${baseDirectory || ''} ./`);
|
||||||
|
|
||||||
@@ -1,18 +1,22 @@
|
|||||||
import { buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import { checkPnpm } from './common';
|
import { buildCacheImageWithNode, buildImage, checkPnpm } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image): Promise<void> => {
|
const createDockerfile = async (data, image): Promise<void> => {
|
||||||
const {
|
const {
|
||||||
|
applicationId,
|
||||||
buildId,
|
buildId,
|
||||||
|
tag,
|
||||||
workdir,
|
workdir,
|
||||||
|
publishDirectory,
|
||||||
port,
|
port,
|
||||||
installCommand,
|
installCommand,
|
||||||
buildCommand,
|
buildCommand,
|
||||||
startCommand,
|
startCommand,
|
||||||
baseDirectory,
|
baseDirectory,
|
||||||
secrets,
|
secrets,
|
||||||
pullmergeRequestId
|
pullmergeRequestId,
|
||||||
|
deploymentType,
|
||||||
|
baseImage
|
||||||
} = data;
|
} = data;
|
||||||
const Dockerfile: Array<string> = [];
|
const Dockerfile: Array<string> = [];
|
||||||
const isPnpm = checkPnpm(installCommand, buildCommand, startCommand);
|
const isPnpm = checkPnpm(installCommand, buildCommand, startCommand);
|
||||||
@@ -35,25 +39,36 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (isPnpm) {
|
if (isPnpm) {
|
||||||
Dockerfile.push('RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm');
|
Dockerfile.push('RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@7');
|
||||||
Dockerfile.push('RUN pnpm add -g pnpm');
|
|
||||||
}
|
}
|
||||||
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
|
if (deploymentType === 'node') {
|
||||||
Dockerfile.push(`RUN ${installCommand}`);
|
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
|
||||||
|
Dockerfile.push(`RUN ${installCommand}`);
|
||||||
if (buildCommand) {
|
|
||||||
Dockerfile.push(`RUN ${buildCommand}`);
|
Dockerfile.push(`RUN ${buildCommand}`);
|
||||||
|
Dockerfile.push(`EXPOSE ${port}`);
|
||||||
|
Dockerfile.push(`CMD ${startCommand}`);
|
||||||
|
} else if (deploymentType === 'static') {
|
||||||
|
if (baseImage?.includes('nginx')) {
|
||||||
|
Dockerfile.push(`COPY /nginx.conf /etc/nginx/nginx.conf`);
|
||||||
|
}
|
||||||
|
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /app/${publishDirectory} ./`);
|
||||||
|
Dockerfile.push(`EXPOSE 80`);
|
||||||
}
|
}
|
||||||
Dockerfile.push(`EXPOSE ${port}`);
|
|
||||||
Dockerfile.push(`CMD ${startCommand}`);
|
|
||||||
await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile.join('\n'));
|
await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile.join('\n'));
|
||||||
};
|
};
|
||||||
|
|
||||||
export default async function (data) {
|
export default async function (data) {
|
||||||
try {
|
try {
|
||||||
const { baseImage, baseBuildImage } = data;
|
const { baseImage, baseBuildImage, deploymentType, buildCommand } = data;
|
||||||
await createDockerfile(data, baseImage);
|
if (deploymentType === 'node') {
|
||||||
await buildImage(data);
|
await createDockerfile(data, baseImage);
|
||||||
|
await buildImage(data);
|
||||||
|
} else if (deploymentType === 'static') {
|
||||||
|
if (buildCommand) await buildCacheImageWithNode(data, baseBuildImage);
|
||||||
|
await createDockerfile(data, baseImage);
|
||||||
|
await buildImage(data);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import { buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import { checkPnpm } from './common';
|
import { buildImage, checkPnpm } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image): Promise<void> => {
|
const createDockerfile = async (data, image): Promise<void> => {
|
||||||
const {
|
const {
|
||||||
@@ -36,8 +35,7 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (isPnpm) {
|
if (isPnpm) {
|
||||||
Dockerfile.push('RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm');
|
Dockerfile.push('RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@7');
|
||||||
Dockerfile.push('RUN pnpm add -g pnpm');
|
|
||||||
}
|
}
|
||||||
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
|
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
|
||||||
Dockerfile.push(`RUN ${installCommand}`);
|
Dockerfile.push(`RUN ${installCommand}`);
|
||||||
@@ -51,7 +49,7 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
|
|
||||||
export default async function (data) {
|
export default async function (data) {
|
||||||
try {
|
try {
|
||||||
const { baseImage, baseBuildImage } = data;
|
const { baseImage } = data;
|
||||||
await createDockerfile(data, baseImage);
|
await createDockerfile(data, baseImage);
|
||||||
await buildImage(data);
|
await buildImage(data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
import { buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import { checkPnpm } from './common';
|
import { buildCacheImageWithNode, buildImage, checkPnpm } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image): Promise<void> => {
|
const createDockerfile = async (data, image): Promise<void> => {
|
||||||
const {
|
const {
|
||||||
|
applicationId,
|
||||||
|
buildId,
|
||||||
|
tag,
|
||||||
workdir,
|
workdir,
|
||||||
|
publishDirectory,
|
||||||
port,
|
port,
|
||||||
installCommand,
|
installCommand,
|
||||||
buildCommand,
|
buildCommand,
|
||||||
@@ -12,7 +15,8 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
baseDirectory,
|
baseDirectory,
|
||||||
secrets,
|
secrets,
|
||||||
pullmergeRequestId,
|
pullmergeRequestId,
|
||||||
buildId
|
deploymentType,
|
||||||
|
baseImage
|
||||||
} = data;
|
} = data;
|
||||||
const Dockerfile: Array<string> = [];
|
const Dockerfile: Array<string> = [];
|
||||||
const isPnpm = checkPnpm(installCommand, buildCommand, startCommand);
|
const isPnpm = checkPnpm(installCommand, buildCommand, startCommand);
|
||||||
@@ -35,24 +39,36 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (isPnpm) {
|
if (isPnpm) {
|
||||||
Dockerfile.push('RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm');
|
Dockerfile.push('RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@7');
|
||||||
Dockerfile.push('RUN pnpm add -g pnpm');
|
|
||||||
}
|
}
|
||||||
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
|
if (deploymentType === 'node') {
|
||||||
Dockerfile.push(`RUN ${installCommand}`);
|
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
|
||||||
if (buildCommand) {
|
Dockerfile.push(`RUN ${installCommand}`);
|
||||||
Dockerfile.push(`RUN ${buildCommand}`);
|
Dockerfile.push(`RUN ${buildCommand}`);
|
||||||
|
Dockerfile.push(`EXPOSE ${port}`);
|
||||||
|
Dockerfile.push(`CMD ${startCommand}`);
|
||||||
|
} else if (deploymentType === 'static') {
|
||||||
|
if (baseImage?.includes('nginx')) {
|
||||||
|
Dockerfile.push(`COPY /nginx.conf /etc/nginx/nginx.conf`);
|
||||||
|
}
|
||||||
|
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /app/${publishDirectory} ./`);
|
||||||
|
Dockerfile.push(`EXPOSE 80`);
|
||||||
}
|
}
|
||||||
Dockerfile.push(`EXPOSE ${port}`);
|
|
||||||
Dockerfile.push(`CMD ${startCommand}`);
|
|
||||||
await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile.join('\n'));
|
await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile.join('\n'));
|
||||||
};
|
};
|
||||||
|
|
||||||
export default async function (data) {
|
export default async function (data) {
|
||||||
try {
|
try {
|
||||||
const { baseImage, baseBuildImage } = data;
|
const { baseImage, baseBuildImage, deploymentType, buildCommand } = data;
|
||||||
await createDockerfile(data, baseImage);
|
if (deploymentType === 'node') {
|
||||||
await buildImage(data);
|
await createDockerfile(data, baseImage);
|
||||||
|
await buildImage(data);
|
||||||
|
} else if (deploymentType === 'static') {
|
||||||
|
if (buildCommand) await buildCacheImageWithNode(data, baseBuildImage);
|
||||||
|
await createDockerfile(data, baseImage);
|
||||||
|
await buildImage(data);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
import { buildImage } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image, htaccessFound): Promise<void> => {
|
const createDockerfile = async (data, image, htaccessFound): Promise<void> => {
|
||||||
const { workdir, baseDirectory, buildId, port } = data;
|
const { workdir, baseDirectory, buildId, port, secrets, pullmergeRequestId } = data;
|
||||||
const Dockerfile: Array<string> = [];
|
const Dockerfile: Array<string> = [];
|
||||||
let composerFound = false;
|
let composerFound = false;
|
||||||
try {
|
try {
|
||||||
@@ -12,6 +12,21 @@ const createDockerfile = async (data, image, htaccessFound): Promise<void> => {
|
|||||||
|
|
||||||
Dockerfile.push(`FROM ${image}`);
|
Dockerfile.push(`FROM ${image}`);
|
||||||
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
||||||
|
if (secrets.length > 0) {
|
||||||
|
secrets.forEach((secret) => {
|
||||||
|
if (secret.isBuildSecret) {
|
||||||
|
if (pullmergeRequestId) {
|
||||||
|
if (secret.isPRMRSecret) {
|
||||||
|
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!secret.isPRMRSecret) {
|
||||||
|
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
Dockerfile.push('WORKDIR /app');
|
Dockerfile.push('WORKDIR /app');
|
||||||
Dockerfile.push(`COPY .${baseDirectory || ''} /app`);
|
Dockerfile.push(`COPY .${baseDirectory || ''} /app`);
|
||||||
if (htaccessFound) {
|
if (htaccessFound) {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
import { buildImage } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image): Promise<void> => {
|
const createDockerfile = async (data, image): Promise<void> => {
|
||||||
const {
|
const {
|
||||||
@@ -34,6 +34,8 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
}
|
}
|
||||||
if (pythonWSGI?.toLowerCase() === 'gunicorn') {
|
if (pythonWSGI?.toLowerCase() === 'gunicorn') {
|
||||||
Dockerfile.push(`RUN pip install gunicorn`);
|
Dockerfile.push(`RUN pip install gunicorn`);
|
||||||
|
} else if (pythonWSGI?.toLowerCase() === 'uvicorn') {
|
||||||
|
Dockerfile.push(`RUN pip install uvicorn`);
|
||||||
} else if (pythonWSGI?.toLowerCase() === 'uwsgi') {
|
} else if (pythonWSGI?.toLowerCase() === 'uwsgi') {
|
||||||
Dockerfile.push(`RUN apk add --no-cache uwsgi-python3`);
|
Dockerfile.push(`RUN apk add --no-cache uwsgi-python3`);
|
||||||
// Dockerfile.push(`RUN pip install --no-cache-dir uwsgi`)
|
// Dockerfile.push(`RUN pip install --no-cache-dir uwsgi`)
|
||||||
@@ -50,6 +52,8 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
Dockerfile.push(`EXPOSE ${port}`);
|
Dockerfile.push(`EXPOSE ${port}`);
|
||||||
if (pythonWSGI?.toLowerCase() === 'gunicorn') {
|
if (pythonWSGI?.toLowerCase() === 'gunicorn') {
|
||||||
Dockerfile.push(`CMD gunicorn -w=4 -b=0.0.0.0:8000 ${pythonModule}:${pythonVariable}`);
|
Dockerfile.push(`CMD gunicorn -w=4 -b=0.0.0.0:8000 ${pythonModule}:${pythonVariable}`);
|
||||||
|
} else if (pythonWSGI?.toLowerCase() === 'uvicorn') {
|
||||||
|
Dockerfile.push(`CMD uvicorn ${pythonModule}:${pythonVariable} --port ${port} --host 0.0.0.0`);
|
||||||
} else if (pythonWSGI?.toLowerCase() === 'uwsgi') {
|
} else if (pythonWSGI?.toLowerCase() === 'uwsgi') {
|
||||||
Dockerfile.push(
|
Dockerfile.push(
|
||||||
`CMD uwsgi --master -p 4 --http-socket 0.0.0.0:8000 --uid uwsgi --plugins python3 --protocol uwsgi --wsgi ${pythonModule}:${pythonVariable}`
|
`CMD uwsgi --master -p 4 --http-socket 0.0.0.0:8000 --uid uwsgi --plugins python3 --protocol uwsgi --wsgi ${pythonModule}:${pythonVariable}`
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { buildCacheImageWithNode, buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
import { buildCacheImageWithNode, buildImage } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image): Promise<void> => {
|
const createDockerfile = async (data, image): Promise<void> => {
|
||||||
const { applicationId, tag, workdir, publishDirectory, baseImage, buildId, port } = data;
|
const { applicationId, tag, workdir, publishDirectory, baseImage, buildId, port } = data;
|
||||||
@@ -9,7 +9,7 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
||||||
Dockerfile.push('WORKDIR /app');
|
Dockerfile.push('WORKDIR /app');
|
||||||
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /app/${publishDirectory} ./`);
|
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /app/${publishDirectory} ./`);
|
||||||
if (baseImage.includes('nginx')) {
|
if (baseImage?.includes('nginx')) {
|
||||||
Dockerfile.push(`COPY /nginx.conf /etc/nginx/nginx.conf`);
|
Dockerfile.push(`COPY /nginx.conf /etc/nginx/nginx.conf`);
|
||||||
}
|
}
|
||||||
Dockerfile.push(`EXPOSE ${port}`);
|
Dockerfile.push(`EXPOSE ${port}`);
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { asyncExecShell } from '$lib/common';
|
|
||||||
import { buildCacheImageWithCargo, buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import TOML from '@iarna/toml';
|
import TOML from '@iarna/toml';
|
||||||
|
import { asyncExecShell } from '../common';
|
||||||
|
import { buildCacheImageWithCargo, buildImage } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image, name): Promise<void> => {
|
const createDockerfile = async (data, image, name): Promise<void> => {
|
||||||
const { workdir, port, applicationId, tag, buildId } = data;
|
const { workdir, port, applicationId, tag, buildId } = data;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { buildCacheImageWithNode, buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
import { buildCacheImageWithNode, buildImage } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image): Promise<void> => {
|
const createDockerfile = async (data, image): Promise<void> => {
|
||||||
const {
|
const {
|
||||||
@@ -40,7 +40,7 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
} else {
|
} else {
|
||||||
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
|
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
|
||||||
}
|
}
|
||||||
if (baseImage.includes('nginx')) {
|
if (baseImage?.includes('nginx')) {
|
||||||
Dockerfile.push(`COPY /nginx.conf /etc/nginx/nginx.conf`);
|
Dockerfile.push(`COPY /nginx.conf /etc/nginx/nginx.conf`);
|
||||||
}
|
}
|
||||||
Dockerfile.push(`EXPOSE ${port}`);
|
Dockerfile.push(`EXPOSE ${port}`);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { buildCacheImageWithNode, buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
import { buildCacheImageWithNode, buildImage } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image): Promise<void> => {
|
const createDockerfile = async (data, image): Promise<void> => {
|
||||||
const { applicationId, tag, workdir, publishDirectory, baseImage, buildId, port } = data;
|
const { applicationId, tag, workdir, publishDirectory, baseImage, buildId, port } = data;
|
||||||
@@ -9,7 +9,7 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
Dockerfile.push('WORKDIR /app');
|
Dockerfile.push('WORKDIR /app');
|
||||||
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
||||||
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /app/${publishDirectory} ./`);
|
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /app/${publishDirectory} ./`);
|
||||||
if (baseImage.includes('nginx')) {
|
if (baseImage?.includes('nginx')) {
|
||||||
Dockerfile.push(`COPY /nginx.conf /etc/nginx/nginx.conf`);
|
Dockerfile.push(`COPY /nginx.conf /etc/nginx/nginx.conf`);
|
||||||
}
|
}
|
||||||
Dockerfile.push(`EXPOSE ${port}`);
|
Dockerfile.push(`EXPOSE ${port}`);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { buildCacheImageWithNode, buildImage } from '$lib/docker';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
import { buildCacheImageWithNode, buildImage } from './common';
|
||||||
|
|
||||||
const createDockerfile = async (data, image): Promise<void> => {
|
const createDockerfile = async (data, image): Promise<void> => {
|
||||||
const { applicationId, tag, workdir, publishDirectory, baseImage, buildId, port } = data;
|
const { applicationId, tag, workdir, publishDirectory, baseImage, buildId, port } = data;
|
||||||
@@ -9,7 +9,7 @@ const createDockerfile = async (data, image): Promise<void> => {
|
|||||||
Dockerfile.push('WORKDIR /app');
|
Dockerfile.push('WORKDIR /app');
|
||||||
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
|
||||||
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /app/${publishDirectory} ./`);
|
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /app/${publishDirectory} ./`);
|
||||||
if (baseImage.includes('nginx')) {
|
if (baseImage?.includes('nginx')) {
|
||||||
Dockerfile.push(`COPY /nginx.conf /etc/nginx/nginx.conf`);
|
Dockerfile.push(`COPY /nginx.conf /etc/nginx/nginx.conf`);
|
||||||
}
|
}
|
||||||
Dockerfile.push(`EXPOSE ${port}`);
|
Dockerfile.push(`EXPOSE ${port}`);
|
||||||
1661
apps/api/src/lib/common.ts
Normal file
1661
apps/api/src/lib/common.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,4 +4,4 @@ import relativeTime from 'dayjs/plugin/relativeTime.js';
|
|||||||
dayjs.extend(utc);
|
dayjs.extend(utc);
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
export { dayjs };
|
export { dayjs as day };
|
||||||
83
apps/api/src/lib/docker.ts
Normal file
83
apps/api/src/lib/docker.ts
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
import { executeDockerCmd } from './common';
|
||||||
|
|
||||||
|
export function formatLabelsOnDocker(data) {
|
||||||
|
return data.trim().split('\n').map(a => JSON.parse(a)).map((container) => {
|
||||||
|
const labels = container.Labels.split(',')
|
||||||
|
let jsonLabels = {}
|
||||||
|
labels.forEach(l => {
|
||||||
|
const name = l.split('=')[0]
|
||||||
|
const value = l.split('=')[1]
|
||||||
|
jsonLabels = { ...jsonLabels, ...{ [name]: value } }
|
||||||
|
})
|
||||||
|
container.Labels = jsonLabels;
|
||||||
|
return container
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export async function checkContainer({ dockerId, container, remove = false }: { dockerId: string, container: string, remove?: boolean }): Promise<boolean> {
|
||||||
|
let containerFound = false;
|
||||||
|
try {
|
||||||
|
const { stdout } = await executeDockerCmd({
|
||||||
|
dockerId,
|
||||||
|
command:
|
||||||
|
`docker inspect --format '{{json .State}}' ${container}`
|
||||||
|
});
|
||||||
|
|
||||||
|
const parsedStdout = JSON.parse(stdout);
|
||||||
|
const status = parsedStdout.Status;
|
||||||
|
const isRunning = status === 'running';
|
||||||
|
if (status === 'created') {
|
||||||
|
await executeDockerCmd({
|
||||||
|
dockerId,
|
||||||
|
command:
|
||||||
|
`docker rm ${container}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (remove && status === 'exited') {
|
||||||
|
await executeDockerCmd({
|
||||||
|
dockerId,
|
||||||
|
command:
|
||||||
|
`docker rm ${container}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (isRunning) {
|
||||||
|
containerFound = true;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// Container not found
|
||||||
|
}
|
||||||
|
return containerFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function isContainerExited(dockerId: string, containerName: string): Promise<boolean> {
|
||||||
|
let isExited = false;
|
||||||
|
try {
|
||||||
|
const { stdout } = await executeDockerCmd({ dockerId, command: `docker inspect -f '{{.State.Status}}' ${containerName}` })
|
||||||
|
if (stdout.trim() === 'exited') {
|
||||||
|
isExited = true;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
return isExited;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function removeContainer({
|
||||||
|
id,
|
||||||
|
dockerId
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
dockerId: string;
|
||||||
|
}): Promise<void> {
|
||||||
|
try {
|
||||||
|
const { stdout } = await executeDockerCmd({ dockerId, command: `docker inspect --format '{{json .State}}' ${id}` })
|
||||||
|
|
||||||
|
if (JSON.parse(stdout).Running) {
|
||||||
|
await executeDockerCmd({ dockerId, command: `docker stop -t 0 ${id}` })
|
||||||
|
await executeDockerCmd({ dockerId, command: `docker rm ${id}` })
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { asyncExecShell, saveBuildLog } from '$lib/common';
|
|
||||||
import got from 'got';
|
|
||||||
import jsonwebtoken from 'jsonwebtoken';
|
import jsonwebtoken from 'jsonwebtoken';
|
||||||
import * as db from '$lib/database';
|
import { saveBuildLog } from '../buildPacks/common';
|
||||||
|
import { asyncExecShell, decrypt, prisma } from '../common';
|
||||||
|
|
||||||
export default async function ({
|
export default async function ({
|
||||||
applicationId,
|
applicationId,
|
||||||
@@ -11,7 +11,8 @@ export default async function ({
|
|||||||
apiUrl,
|
apiUrl,
|
||||||
htmlUrl,
|
htmlUrl,
|
||||||
branch,
|
branch,
|
||||||
buildId
|
buildId,
|
||||||
|
customPort
|
||||||
}: {
|
}: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
workdir: string;
|
workdir: string;
|
||||||
@@ -21,10 +22,16 @@ export default async function ({
|
|||||||
htmlUrl: string;
|
htmlUrl: string;
|
||||||
branch: string;
|
branch: string;
|
||||||
buildId: string;
|
buildId: string;
|
||||||
|
customPort: number;
|
||||||
}): Promise<string> {
|
}): Promise<string> {
|
||||||
|
const { default: got } = await import('got')
|
||||||
const url = htmlUrl.replace('https://', '').replace('http://', '');
|
const url = htmlUrl.replace('https://', '').replace('http://', '');
|
||||||
await saveBuildLog({ line: 'GitHub importer started.', buildId, applicationId });
|
await saveBuildLog({ line: 'GitHub importer started.', buildId, applicationId });
|
||||||
const { privateKey, appId, installationId } = await db.getUniqueGithubApp({ githubAppId });
|
|
||||||
|
const body = await prisma.githubApp.findUnique({ where: { id: githubAppId } });
|
||||||
|
if (body.privateKey) body.privateKey = decrypt(body.privateKey);
|
||||||
|
const { privateKey, appId, installationId } = body
|
||||||
|
|
||||||
const githubPrivateKey = privateKey.replace(/\\n/g, '\n').replace(/"/g, '');
|
const githubPrivateKey = privateKey.replace(/\\n/g, '\n').replace(/"/g, '');
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
@@ -49,7 +56,7 @@ export default async function ({
|
|||||||
applicationId
|
applicationId
|
||||||
});
|
});
|
||||||
await asyncExecShell(
|
await asyncExecShell(
|
||||||
`GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=no' git clone -q -b ${branch} https://x-access-token:${token}@${url}/${repository}.git ${workdir}/ && cd ${workdir} && git submodule update --init --recursive && git lfs pull && cd .. `
|
`git clone -q -b ${branch} https://x-access-token:${token}@${url}/${repository}.git --config core.sshCommand="ssh -p ${customPort}" ${workdir}/ && cd ${workdir} && git submodule update --init --recursive && git lfs pull && cd .. `
|
||||||
);
|
);
|
||||||
const { stdout: commit } = await asyncExecShell(`cd ${workdir}/ && git rev-parse HEAD`);
|
const { stdout: commit } = await asyncExecShell(`cd ${workdir}/ && git rev-parse HEAD`);
|
||||||
return commit.replace('\n', '');
|
return commit.replace('\n', '');
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { asyncExecShell, saveBuildLog } from '$lib/common';
|
import { saveBuildLog } from "../buildPacks/common";
|
||||||
|
import { asyncExecShell } from "../common";
|
||||||
|
|
||||||
export default async function ({
|
export default async function ({
|
||||||
applicationId,
|
applicationId,
|
||||||
@@ -8,7 +9,8 @@ export default async function ({
|
|||||||
repository,
|
repository,
|
||||||
branch,
|
branch,
|
||||||
buildId,
|
buildId,
|
||||||
privateSshKey
|
privateSshKey,
|
||||||
|
customPort
|
||||||
}: {
|
}: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
workdir: string;
|
workdir: string;
|
||||||
@@ -18,6 +20,7 @@ export default async function ({
|
|||||||
buildId: string;
|
buildId: string;
|
||||||
repodir: string;
|
repodir: string;
|
||||||
privateSshKey: string;
|
privateSshKey: string;
|
||||||
|
customPort: number;
|
||||||
}): Promise<string> {
|
}): Promise<string> {
|
||||||
const url = htmlUrl.replace('https://', '').replace('http://', '').replace(/\/$/, '');
|
const url = htmlUrl.replace('https://', '').replace('http://', '').replace(/\/$/, '');
|
||||||
await saveBuildLog({ line: 'GitLab importer started.', buildId, applicationId });
|
await saveBuildLog({ line: 'GitLab importer started.', buildId, applicationId });
|
||||||
@@ -31,7 +34,7 @@ export default async function ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
await asyncExecShell(
|
await asyncExecShell(
|
||||||
`GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=no' git clone -q -b ${branch} git@${url}:${repository}.git --config core.sshCommand="ssh -q -i ${repodir}id.rsa -o StrictHostKeyChecking=no" ${workdir}/ && cd ${workdir}/ && git submodule update --init --recursive && git lfs pull && cd .. `
|
`git clone -q -b ${branch} git@${url}:${repository}.git --config core.sshCommand="ssh -p ${customPort} -q -i ${repodir}id.rsa -o StrictHostKeyChecking=no" ${workdir}/ && cd ${workdir}/ && git submodule update --init --recursive && git lfs pull && cd .. `
|
||||||
);
|
);
|
||||||
const { stdout: commit } = await asyncExecShell(`cd ${workdir}/ && git rev-parse HEAD`);
|
const { stdout: commit } = await asyncExecShell(`cd ${workdir}/ && git rev-parse HEAD`);
|
||||||
return commit.replace('\n', '');
|
return commit.replace('\n', '');
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user