Compare commits

...

30 Commits

Author SHA1 Message Date
Andras Bacsai
3bd2183655 Merge pull request #143 from coollabsio/fix/login-quickfix
v2.0.13
2022-02-17 10:23:26 +01:00
Andras Bacsai
1f7080e8f8 fix: Login issues 2022-02-17 10:22:38 +01:00
Andras Bacsai
a116028e1b Merge pull request #137 from coollabsio/next
v2.0.12
2022-02-15 22:03:10 +01:00
Andras Bacsai
e606a02b29 Update packages 2022-02-15 21:49:14 +01:00
Andras Bacsai
531c712ea5 fix: Some nasty bug
fix: Automatic reconfiguration of all services and service proxies
2022-02-15 21:44:36 +01:00
Andras Bacsai
3ae7624361 fix: Cleanup images 2022-02-15 20:37:00 +01:00
Andras Bacsai
fed83462fa remove unncesarry logs 2022-02-15 20:34:40 +01:00
Andras Bacsai
58c9f937c5 fix: Cleanup every 10 mins 2022-02-15 19:14:23 +01:00
Andras Bacsai
5d14b9209d fix: Coolify image cleanup 2022-02-15 19:13:50 +01:00
Andras Bacsai
305a95fa74 fix: TransactionIds 2022-02-15 18:47:20 +01:00
Andras Bacsai
b29c1e702a fix: isDomainConfigured 2022-02-15 18:04:58 +01:00
Andras Bacsai
b04d75ab08 dx: only allow cleanup in production 2022-02-15 17:46:37 +01:00
Andras Bacsai
25abfaadb9 chore: version++ 2022-02-15 17:45:58 +01:00
Andras Bacsai
1df81b8698 fix: Unnecessary proxy restart
feat: Restart proxy
2022-02-15 17:45:20 +01:00
Andras Bacsai
4487846fd7 feat: Force restart coolify proxy
fix: Cannot configure coolify proxy
2022-02-15 15:55:55 +01:00
Andras Bacsai
86918f5160 Merge pull request #134 from coollabsio/next
fix: Error with follow logs
2022-02-15 10:59:58 +01:00
Andras Bacsai
bc723b3f15 fix: Error with follow logs 2022-02-15 10:57:58 +01:00
Andras Bacsai
1881e646d4 Merge pull request #132 from coollabsio/next
v2.0.11
2022-02-15 10:51:25 +01:00
Andras Bacsai
aa98808a1a fix: Typo 2022-02-15 10:46:44 +01:00
Andras Bacsai
f9a2232703 fix: Small fixes 2022-02-15 10:42:26 +01:00
Andras Bacsai
19d6be8663 fix: Load more button 2022-02-15 10:35:22 +01:00
Andras Bacsai
0eb7c890ad fix: GitHub sync PR's 2022-02-15 10:25:23 +01:00
Andras Bacsai
7bfa68aa58 chore: version++ 2022-02-15 09:40:04 +01:00
Andras Bacsai
857a38050e fix: Window error in SSR 2022-02-15 09:39:45 +01:00
Andras Bacsai
c5b7f92caf feat: Follow logs 2022-02-15 09:38:16 +01:00
Andras Bacsai
df31ffd7fb Merge pull request #127 from SaraVieira/logs-improvements
UX improvements for the log page
2022-02-15 09:02:43 +01:00
Sara Vieira
5656f6f709 add env example back 2022-02-14 16:01:08 +01:00
Sara Vieira
15b7822ffd put db in the right place 2022-02-14 15:58:42 +01:00
Sara Vieira
cfa28419cb add yarn lock to gitignore 2022-02-14 15:56:28 +01:00
Sara Vieira
30ef0d2a3a some log improvements 2022-02-14 15:55:19 +01:00
28 changed files with 506 additions and 262 deletions

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@ node_modules
/build /build
/.svelte-kit /.svelte-kit
/package /package
/yarn.lock
.env .env
.env.prod .env.prod

View File

@@ -1,7 +1,7 @@
{ {
"name": "coolify", "name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.", "description": "An open-source & self-hostable Heroku / Netlify alternative.",
"version": "2.0.10", "version": "2.0.13",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {
"dev": "docker compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0", "dev": "docker compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0",
@@ -30,7 +30,7 @@
"@sveltejs/kit": "1.0.0-next.259", "@sveltejs/kit": "1.0.0-next.259",
"@types/bcrypt": "5.0.0", "@types/bcrypt": "5.0.0",
"@types/js-cookie": "3.0.1", "@types/js-cookie": "3.0.1",
"@types/node": "17.0.16", "@types/node": "17.0.18",
"@types/node-forge": "1.0.0", "@types/node-forge": "1.0.0",
"@typescript-eslint/eslint-plugin": "4.31.1", "@typescript-eslint/eslint-plugin": "4.31.1",
"@typescript-eslint/parser": "4.31.1", "@typescript-eslint/parser": "4.31.1",
@@ -41,16 +41,16 @@
"eslint-config-prettier": "8.3.0", "eslint-config-prettier": "8.3.0",
"eslint-plugin-svelte3": "3.2.1", "eslint-plugin-svelte3": "3.2.1",
"husky": "7.0.4", "husky": "7.0.4",
"lint-staged": "12.3.3", "lint-staged": "12.3.4",
"postcss": "8.4.6", "postcss": "8.4.6",
"prettier": "2.5.1", "prettier": "2.5.1",
"prettier-plugin-svelte": "2.6.0", "prettier-plugin-svelte": "2.6.0",
"prettier-plugin-tailwindcss": "0.1.7", "prettier-plugin-tailwindcss": "0.1.7",
"prisma": "3.9.1", "prisma": "3.9.2",
"svelte": "3.46.4", "svelte": "3.46.4",
"svelte-check": "2.4.3", "svelte-check": "2.4.3",
"svelte-preprocess": "4.10.3", "svelte-preprocess": "4.10.3",
"tailwindcss": "3.0.19", "tailwindcss": "3.0.22",
"ts-node": "10.5.0", "ts-node": "10.5.0",
"tslib": "2.3.1", "tslib": "2.3.1",
"typescript": "4.5.5" "typescript": "4.5.5"
@@ -58,10 +58,10 @@
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@iarna/toml": "2.2.5", "@iarna/toml": "2.2.5",
"@prisma/client": "3.9.1", "@prisma/client": "3.9.2",
"@sentry/node": "6.17.6", "@sentry/node": "6.17.8",
"bcrypt": "5.0.1", "bcrypt": "5.0.1",
"bullmq": "1.69.0", "bullmq": "1.72.0",
"compare-versions": "4.1.3", "compare-versions": "4.1.3",
"cookie": "0.4.2", "cookie": "0.4.2",
"cuid": "2.1.8", "cuid": "2.1.8",
@@ -75,7 +75,7 @@
"js-yaml": "4.1.0", "js-yaml": "4.1.0",
"jsonwebtoken": "8.5.1", "jsonwebtoken": "8.5.1",
"node-forge": "1.2.1", "node-forge": "1.2.1",
"svelte-kit-cookie-session": "2.0.3", "svelte-kit-cookie-session": "2.0.2",
"unique-names-generator": "4.6.0" "unique-names-generator": "4.6.0"
}, },
"prisma": { "prisma": {

147
pnpm-lock.yaml generated
View File

@@ -2,21 +2,21 @@ lockfileVersion: 5.3
specifiers: specifiers:
'@iarna/toml': 2.2.5 '@iarna/toml': 2.2.5
'@prisma/client': 3.9.1 '@prisma/client': 3.9.2
'@sentry/node': 6.17.6 '@sentry/node': 6.17.8
'@sveltejs/adapter-node': 1.0.0-next.67 '@sveltejs/adapter-node': 1.0.0-next.67
'@sveltejs/adapter-static': 1.0.0-next.27 '@sveltejs/adapter-static': 1.0.0-next.27
'@sveltejs/kit': 1.0.0-next.259 '@sveltejs/kit': 1.0.0-next.259
'@types/bcrypt': 5.0.0 '@types/bcrypt': 5.0.0
'@types/js-cookie': 3.0.1 '@types/js-cookie': 3.0.1
'@types/node': 17.0.16 '@types/node': 17.0.18
'@types/node-forge': 1.0.0 '@types/node-forge': 1.0.0
'@typescript-eslint/eslint-plugin': 4.31.1 '@typescript-eslint/eslint-plugin': 4.31.1
'@typescript-eslint/parser': 4.31.1 '@typescript-eslint/parser': 4.31.1
'@zerodevx/svelte-toast': 0.6.3 '@zerodevx/svelte-toast': 0.6.3
autoprefixer: 10.4.2 autoprefixer: 10.4.2
bcrypt: 5.0.1 bcrypt: 5.0.1
bullmq: 1.69.0 bullmq: 1.72.0
compare-versions: 4.1.3 compare-versions: 4.1.3
cookie: 0.4.2 cookie: 0.4.2
cross-var: 1.1.0 cross-var: 1.1.0
@@ -34,18 +34,18 @@ specifiers:
js-cookie: 3.0.1 js-cookie: 3.0.1
js-yaml: 4.1.0 js-yaml: 4.1.0
jsonwebtoken: 8.5.1 jsonwebtoken: 8.5.1
lint-staged: 12.3.3 lint-staged: 12.3.4
node-forge: 1.2.1 node-forge: 1.2.1
postcss: 8.4.6 postcss: 8.4.6
prettier: 2.5.1 prettier: 2.5.1
prettier-plugin-svelte: 2.6.0 prettier-plugin-svelte: 2.6.0
prettier-plugin-tailwindcss: 0.1.7 prettier-plugin-tailwindcss: 0.1.7
prisma: 3.9.1 prisma: 3.9.2
svelte: 3.46.4 svelte: 3.46.4
svelte-check: 2.4.3 svelte-check: 2.4.3
svelte-kit-cookie-session: 2.0.3 svelte-kit-cookie-session: 2.0.5
svelte-preprocess: 4.10.3 svelte-preprocess: 4.10.3
tailwindcss: 3.0.19 tailwindcss: 3.0.22
ts-node: 10.5.0 ts-node: 10.5.0
tslib: 2.3.1 tslib: 2.3.1
typescript: 4.5.5 typescript: 4.5.5
@@ -53,10 +53,10 @@ specifiers:
dependencies: dependencies:
'@iarna/toml': 2.2.5 '@iarna/toml': 2.2.5
'@prisma/client': 3.9.1_prisma@3.9.1 '@prisma/client': 3.9.2_prisma@3.9.2
'@sentry/node': 6.17.6 '@sentry/node': 6.17.8
bcrypt: 5.0.1 bcrypt: 5.0.1
bullmq: 1.69.0 bullmq: 1.72.0
compare-versions: 4.1.3 compare-versions: 4.1.3
cookie: 0.4.2 cookie: 0.4.2
cuid: 2.1.8 cuid: 2.1.8
@@ -70,7 +70,7 @@ dependencies:
js-yaml: 4.1.0 js-yaml: 4.1.0
jsonwebtoken: 8.5.1 jsonwebtoken: 8.5.1
node-forge: 1.2.1 node-forge: 1.2.1
svelte-kit-cookie-session: 2.0.3 svelte-kit-cookie-session: 2.0.5
unique-names-generator: 4.6.0 unique-names-generator: 4.6.0
devDependencies: devDependencies:
@@ -79,7 +79,7 @@ devDependencies:
'@sveltejs/kit': 1.0.0-next.259_svelte@3.46.4 '@sveltejs/kit': 1.0.0-next.259_svelte@3.46.4
'@types/bcrypt': 5.0.0 '@types/bcrypt': 5.0.0
'@types/js-cookie': 3.0.1 '@types/js-cookie': 3.0.1
'@types/node': 17.0.16 '@types/node': 17.0.18
'@types/node-forge': 1.0.0 '@types/node-forge': 1.0.0
'@typescript-eslint/eslint-plugin': 4.31.1_5d7752337e5ea49772097d8af1823bf9 '@typescript-eslint/eslint-plugin': 4.31.1_5d7752337e5ea49772097d8af1823bf9
'@typescript-eslint/parser': 4.31.1_eslint@7.32.0+typescript@4.5.5 '@typescript-eslint/parser': 4.31.1_eslint@7.32.0+typescript@4.5.5
@@ -90,17 +90,17 @@ devDependencies:
eslint-config-prettier: 8.3.0_eslint@7.32.0 eslint-config-prettier: 8.3.0_eslint@7.32.0
eslint-plugin-svelte3: 3.2.1_eslint@7.32.0+svelte@3.46.4 eslint-plugin-svelte3: 3.2.1_eslint@7.32.0+svelte@3.46.4
husky: 7.0.4 husky: 7.0.4
lint-staged: 12.3.3 lint-staged: 12.3.4
postcss: 8.4.6 postcss: 8.4.6
prettier: 2.5.1 prettier: 2.5.1
prettier-plugin-svelte: 2.6.0_prettier@2.5.1+svelte@3.46.4 prettier-plugin-svelte: 2.6.0_prettier@2.5.1+svelte@3.46.4
prettier-plugin-tailwindcss: 0.1.7_prettier@2.5.1 prettier-plugin-tailwindcss: 0.1.7_prettier@2.5.1
prisma: 3.9.1 prisma: 3.9.2
svelte: 3.46.4 svelte: 3.46.4
svelte-check: 2.4.3_postcss@8.4.6+svelte@3.46.4 svelte-check: 2.4.3_postcss@8.4.6+svelte@3.46.4
svelte-preprocess: 4.10.3_88b359da5cac6d8f6ee1bbb7080a3fa9 svelte-preprocess: 4.10.3_88b359da5cac6d8f6ee1bbb7080a3fa9
tailwindcss: 3.0.19_27d966e3a2f4b84fbc8a2f9653dbb362 tailwindcss: 3.0.22_c940fbabf228b85b1c73d314b43e31f1
ts-node: 10.5.0_99ae9436e134a034c8d45fdd98ebbf22 ts-node: 10.5.0_f3bd4037939c2ed2942ba074291f8ef2
tslib: 2.3.1 tslib: 2.3.1
typescript: 4.5.5 typescript: 4.5.5
@@ -250,10 +250,10 @@ packages:
fastq: 1.13.0 fastq: 1.13.0
dev: true dev: true
/@prisma/client/3.9.1_prisma@3.9.1: /@prisma/client/3.9.2_prisma@3.9.2:
resolution: resolution:
{ {
integrity: sha512-aLwfXKLvL+loQ0IuPPCXkcq8cXBg1IeoHHa5lqQu3dJHdj45wnislA/Ny4UxRQjD5FXqrfAb8sWtF+jhdmjFTg== integrity: sha512-VlEIYVMyfFZHbVBOlunPl47gmP/Z0zzPjPj8I7uKEIaABqrUy50ru3XS0aZd8GFvevVwt7p91xxkUjNjrWhKAQ==
} }
engines: { node: '>=12.6' } engines: { node: '>=12.6' }
requiresBuild: true requiresBuild: true
@@ -264,7 +264,7 @@ packages:
optional: true optional: true
dependencies: dependencies:
'@prisma/engines-version': 3.9.0-58.bcc2ff906db47790ee902e7bbc76d7ffb1893009 '@prisma/engines-version': 3.9.0-58.bcc2ff906db47790ee902e7bbc76d7ffb1893009
prisma: 3.9.1 prisma: 3.9.2
dev: false dev: false
/@prisma/engines-version/3.9.0-58.bcc2ff906db47790ee902e7bbc76d7ffb1893009: /@prisma/engines-version/3.9.0-58.bcc2ff906db47790ee902e7bbc76d7ffb1893009:
@@ -293,56 +293,56 @@ packages:
picomatch: 2.3.0 picomatch: 2.3.0
dev: true dev: true
/@sentry/core/6.17.6: /@sentry/core/6.17.8:
resolution: resolution:
{ {
integrity: sha512-wSNsQSqsW8vQ2HEvUEXYOJnzTyVDSWbyH4RHrWV1pQM8zqGx/qfz0sKFM5XFnE9ZeaXKL8LXV3v5i73v+z8lew== integrity: sha512-4WTjgQom75Rvgn6XYy6e7vMIbWlj8utau1wWvr7kjqFKuuuuycRvPgVzAdVr4B3WDHHCInAZpUchsOLs2qwIEA==
} }
engines: { node: '>=6' } engines: { node: '>=6' }
dependencies: dependencies:
'@sentry/hub': 6.17.6 '@sentry/hub': 6.17.8
'@sentry/minimal': 6.17.6 '@sentry/minimal': 6.17.8
'@sentry/types': 6.17.6 '@sentry/types': 6.17.8
'@sentry/utils': 6.17.6 '@sentry/utils': 6.17.8
tslib: 1.14.1 tslib: 1.14.1
dev: false dev: false
/@sentry/hub/6.17.6: /@sentry/hub/6.17.8:
resolution: resolution:
{ {
integrity: sha512-Ps9nk+DoFia8jhZ1lucdRE0vDx8hqXOsKXJE8a3hK/Ndki0J9jedYqBeLqSgiFG4qRjXpNFcD6TEM6tnQrv5lw== integrity: sha512-GW0XYpkoQu/kSJaTLfsF4extHDOBPNRnT0qKr/YO20Z5wGxYp8LsdnAuU3njcFHcAV2F/QDTj2BPq1U385/4+A==
} }
engines: { node: '>=6' } engines: { node: '>=6' }
dependencies: dependencies:
'@sentry/types': 6.17.6 '@sentry/types': 6.17.8
'@sentry/utils': 6.17.6 '@sentry/utils': 6.17.8
tslib: 1.14.1 tslib: 1.14.1
dev: false dev: false
/@sentry/minimal/6.17.6: /@sentry/minimal/6.17.8:
resolution: resolution:
{ {
integrity: sha512-PLGf8WlhtdHuY6ofwYR3nyClr/TYHHAW6i0r62OZCOXTqnFPJorZpAz3VCCP2jMJmbgVbo03wN+u/xAA/zwObA== integrity: sha512-VJXFZBO/O8SViK0fdzodxpNr+pbpgczNgLpz/MNuSooV6EBesgCMVjXtxDUp1Ie1odc0GUprN/ZMLYBmYdIrKQ==
} }
engines: { node: '>=6' } engines: { node: '>=6' }
dependencies: dependencies:
'@sentry/hub': 6.17.6 '@sentry/hub': 6.17.8
'@sentry/types': 6.17.6 '@sentry/types': 6.17.8
tslib: 1.14.1 tslib: 1.14.1
dev: false dev: false
/@sentry/node/6.17.6: /@sentry/node/6.17.8:
resolution: resolution:
{ {
integrity: sha512-T1s0yPbGvYpoh9pJgLvpy7s+jVwCyf0ieEoN9rSbnPwbi2vm6MfoV5wtGrE0cBHTPgnyOMv+zq4Q3ww6dfr7Pw== integrity: sha512-b3zg1XjKtxp7o821ENORO1CCzMM4QzKP01rzztMwyMcj28dmUq36QXoQAnwdKn7jEYkJdLnMeniIBR6U6NUJrQ==
} }
engines: { node: '>=6' } engines: { node: '>=6' }
dependencies: dependencies:
'@sentry/core': 6.17.6 '@sentry/core': 6.17.8
'@sentry/hub': 6.17.6 '@sentry/hub': 6.17.8
'@sentry/tracing': 6.17.6 '@sentry/tracing': 6.17.8
'@sentry/types': 6.17.6 '@sentry/types': 6.17.8
'@sentry/utils': 6.17.6 '@sentry/utils': 6.17.8
cookie: 0.4.2 cookie: 0.4.2
https-proxy-agent: 5.0.0 https-proxy-agent: 5.0.0
lru_map: 0.3.3 lru_map: 0.3.3
@@ -351,36 +351,36 @@ packages:
- supports-color - supports-color
dev: false dev: false
/@sentry/tracing/6.17.6: /@sentry/tracing/6.17.8:
resolution: resolution:
{ {
integrity: sha512-+h5ov+zEm5WH9+vmFfdT4EIqBOW7Tggzh0BDz8QRStRc2JbvEiSZDs+HlsycBwWMQi/ucJs93FPtNnWjW+xvBw== integrity: sha512-WJ3W8O6iPI3w7MrzTnYcw3s5PGBNFqT4b9oBCl5Ndjexs8DsGlQOxjrsipo36z6TpnRHpAE4FEbOETb2R8JRJQ==
} }
engines: { node: '>=6' } engines: { node: '>=6' }
dependencies: dependencies:
'@sentry/hub': 6.17.6 '@sentry/hub': 6.17.8
'@sentry/minimal': 6.17.6 '@sentry/minimal': 6.17.8
'@sentry/types': 6.17.6 '@sentry/types': 6.17.8
'@sentry/utils': 6.17.6 '@sentry/utils': 6.17.8
tslib: 1.14.1 tslib: 1.14.1
dev: false dev: false
/@sentry/types/6.17.6: /@sentry/types/6.17.8:
resolution: resolution:
{ {
integrity: sha512-peGM873lDJtHd/jwW9Egr/hhxLuF0bcPIf2kMZlvEvW/G5GCbuaCR4ArQJlh7vQyma+NLn/XdojpJkC0TomKrw== integrity: sha512-0i0f+dpvV62Pm5QMVBHNfEsTGIXoXRGQbeN2LGL4XbhzrzUmIrBPzrnZHv9c/JYtSJnI6A0B9OG7Bdlh3aku+Q==
} }
engines: { node: '>=6' } engines: { node: '>=6' }
dev: false dev: false
/@sentry/utils/6.17.6: /@sentry/utils/6.17.8:
resolution: resolution:
{ {
integrity: sha512-RI797N8Ax5yuKUftVX6dc0XmXqo5CN7XqJYPFzYC8udutQ4L8ZYadtUcqNsdz1ZQxl+rp0XK9Q6wjoWmsI2RXA== integrity: sha512-cAOM53A5FHv95hpDuXKJU8rI4B1XdZ6qe3Yo+/nDS9QDpOgzvyjcItgXPvKW1wUjdHCcnwu7VBfBxB7teYOW9g==
} }
engines: { node: '>=6' } engines: { node: '>=6' }
dependencies: dependencies:
'@sentry/types': 6.17.6 '@sentry/types': 6.17.8
tslib: 1.14.1 tslib: 1.14.1
dev: false dev: false
@@ -502,7 +502,7 @@ packages:
integrity: sha512-agtcFKaruL8TmcvqbndlqHPSJgsolhf/qPWchFlgnW1gECTN/nKbFcoFnvKAQRFfKbh+BO6A3SWdJu9t+xF3Lw== integrity: sha512-agtcFKaruL8TmcvqbndlqHPSJgsolhf/qPWchFlgnW1gECTN/nKbFcoFnvKAQRFfKbh+BO6A3SWdJu9t+xF3Lw==
} }
dependencies: dependencies:
'@types/node': 17.0.16 '@types/node': 17.0.18
dev: true dev: true
/@types/cacheable-request/6.0.2: /@types/cacheable-request/6.0.2:
@@ -513,7 +513,7 @@ packages:
dependencies: dependencies:
'@types/http-cache-semantics': 4.0.1 '@types/http-cache-semantics': 4.0.1
'@types/keyv': 3.1.3 '@types/keyv': 3.1.3
'@types/node': 17.0.16 '@types/node': 17.0.18
'@types/responselike': 1.0.0 '@types/responselike': 1.0.0
dev: false dev: false
@@ -544,7 +544,7 @@ packages:
integrity: sha512-FXCJgyyN3ivVgRoml4h94G/p3kY+u/B86La+QptcqJaWtBWtmc6TtkNfS40n9bIvyLteHh7zXOtgbobORKPbDg== integrity: sha512-FXCJgyyN3ivVgRoml4h94G/p3kY+u/B86La+QptcqJaWtBWtmc6TtkNfS40n9bIvyLteHh7zXOtgbobORKPbDg==
} }
dependencies: dependencies:
'@types/node': 17.0.16 '@types/node': 17.0.18
dev: false dev: false
/@types/node-forge/1.0.0: /@types/node-forge/1.0.0:
@@ -553,13 +553,13 @@ packages:
integrity: sha512-h0bgwPKq5u99T9Gor4qtV1lCZ41xNkai0pie1n/a2mh2/4+jENWOlo7AJ4YKxTZAnSZ8FRurUpdIN7ohaPPuHA== integrity: sha512-h0bgwPKq5u99T9Gor4qtV1lCZ41xNkai0pie1n/a2mh2/4+jENWOlo7AJ4YKxTZAnSZ8FRurUpdIN7ohaPPuHA==
} }
dependencies: dependencies:
'@types/node': 17.0.16 '@types/node': 17.0.18
dev: true dev: true
/@types/node/17.0.16: /@types/node/17.0.18:
resolution: resolution:
{ {
integrity: sha512-ydLaGVfQOQ6hI1xK2A5nVh8bl0OGoIfYMxPWHqqYe9bTkWCfqiVvZoh2I/QF2sNSkZzZyROBoTefIEI+PB6iIA== integrity: sha512-eKj4f/BsN/qcculZiRSujogjvp5O/k4lOW5m35NopjZM/QwLOR075a8pJW5hD+Rtdm2DaCVPENS6KtSQnUD6BA==
} }
/@types/parse-json/4.0.0: /@types/parse-json/4.0.0:
@@ -582,7 +582,7 @@ packages:
integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA== integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==
} }
dependencies: dependencies:
'@types/node': 17.0.16 '@types/node': 17.0.18
dev: false dev: false
/@types/sass/1.16.1: /@types/sass/1.16.1:
@@ -591,7 +591,7 @@ packages:
integrity: sha512-iZUcRrGuz/Tbg3loODpW7vrQJkUtpY2fFSf4ELqqkApcS2TkZ1msk7ie8iZPB86lDOP8QOTTmuvWjc5S0R9OjQ== integrity: sha512-iZUcRrGuz/Tbg3loODpW7vrQJkUtpY2fFSf4ELqqkApcS2TkZ1msk7ie8iZPB86lDOP8QOTTmuvWjc5S0R9OjQ==
} }
dependencies: dependencies:
'@types/node': 17.0.16 '@types/node': 17.0.18
dev: true dev: true
/@typescript-eslint/eslint-plugin/4.31.1_5d7752337e5ea49772097d8af1823bf9: /@typescript-eslint/eslint-plugin/4.31.1_5d7752337e5ea49772097d8af1823bf9:
@@ -1746,10 +1746,10 @@ packages:
ieee754: 1.2.1 ieee754: 1.2.1
dev: false dev: false
/bullmq/1.69.0: /bullmq/1.72.0:
resolution: resolution:
{ {
integrity: sha512-1aIO7bN0HQeADWoXa+I72GgofvoBFRs/kcoveB3KN8ytKv7QJbGhtks0pYNhHn/P9H3OWHWDccpNEfnv3VGfcw== integrity: sha512-Q0pk6GphHyYsacpjZZFhjp/+TY+2g2FDsJS3qwIyskQL4j7vZaa1iYX3gKDEBn4C5eZMP1EOl9GWkm2bhdB0Wg==
} }
dependencies: dependencies:
cron-parser: 2.18.0 cron-parser: 2.18.0
@@ -3718,10 +3718,10 @@ packages:
resolution: { integrity: sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= } resolution: { integrity: sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= }
dev: true dev: true
/lint-staged/12.3.3: /lint-staged/12.3.4:
resolution: resolution:
{ {
integrity: sha512-OqcLsqcPOqzvsfkxjeBpZylgJ3SRG1RYqc9LxC6tkt6tNsq1bNVkAixBwX09f6CobcHswzqVOCBpFR1Fck0+ag== integrity: sha512-yv/iK4WwZ7/v0GtVkNb3R82pdL9M+ScpIbJLJNyCXkJ1FGaXvRCOg/SeL59SZtPpqZhE7BD6kPKFLIDUhDx2/w==
} }
engines: { node: ^12.20.0 || ^14.13.1 || >=16.0.0 } engines: { node: ^12.20.0 || ^14.13.1 || >=16.0.0 }
hasBin: true hasBin: true
@@ -4397,7 +4397,7 @@ packages:
dependencies: dependencies:
import-cwd: 3.0.0 import-cwd: 3.0.0
lilconfig: 2.0.4 lilconfig: 2.0.4
ts-node: 10.5.0_99ae9436e134a034c8d45fdd98ebbf22 ts-node: 10.5.0_f3bd4037939c2ed2942ba074291f8ef2
yaml: 1.10.2 yaml: 1.10.2
dev: true dev: true
@@ -4486,10 +4486,10 @@ packages:
hasBin: true hasBin: true
dev: true dev: true
/prisma/3.9.1: /prisma/3.9.2:
resolution: resolution:
{ {
integrity: sha512-IGcJAu5LzlFv+i+NNhOEh1J1xVVttsVdRBxmrMN7eIH+7mRN6L89Hz1npUAiz4jOpNlHC7n9QwaOYZGxTqlwQw== integrity: sha512-i9eK6cexV74OgeWaH3+e6S07kvC9jEZTl6BqtBH398nlCU0tck7mE9dicY6YQd+euvMjjCtY89q4NgmaPnUsSg==
} }
engines: { node: '>=12.6' } engines: { node: '>=12.6' }
hasBin: true hasBin: true
@@ -5203,10 +5203,10 @@ packages:
svelte: 3.46.4 svelte: 3.46.4
dev: true dev: true
/svelte-kit-cookie-session/2.0.3: /svelte-kit-cookie-session/2.0.5:
resolution: resolution:
{ {
integrity: sha512-jOBUpvrkt/fI5zaqWsWHDDIGnfuPQt3/PC1FDJpEV/E/hA8DvGO52esFny1HvUAP1tkVZ5FU3k6Yd3HyQH5oUQ== integrity: sha512-IX1IXtn42UTz/isem1LqH0SAZdCx6Z6Iu2V4Q83V2EScFbXZWfeFY08Azl8ZrPKdIDhSNHBLAAumRjA6TBxCvQ==
} }
dev: false dev: false
@@ -5288,16 +5288,15 @@ packages:
strip-ansi: 6.0.1 strip-ansi: 6.0.1
dev: true dev: true
/tailwindcss/3.0.19_27d966e3a2f4b84fbc8a2f9653dbb362: /tailwindcss/3.0.22_c940fbabf228b85b1c73d314b43e31f1:
resolution: resolution:
{ {
integrity: sha512-rjsdfz/qZya5xQ0OVynEMETgWq1CacmftgMYeXXh6bRM5vxsNwRSbMJsCCIjq/w67om9VP/AFMolOwiE+5VKig== integrity: sha512-F8lt74RlNZirnkaSk310+vGQta7c0/hgx7/bqxruM4wS9lp8oqV93lzavajC3VT0Lp4UUtUVIt8ifKcmGzkr0A==
} }
engines: { node: '>=12.13.0' } engines: { node: '>=12.13.0' }
hasBin: true hasBin: true
peerDependencies: peerDependencies:
autoprefixer: ^10.0.2 autoprefixer: ^10.0.2
postcss: ^8.0.9
dependencies: dependencies:
arg: 5.0.1 arg: 5.0.1
autoprefixer: 10.4.2_postcss@8.4.6 autoprefixer: 10.4.2_postcss@8.4.6
@@ -5408,7 +5407,7 @@ packages:
engines: { node: '>=0.10.0' } engines: { node: '>=0.10.0' }
dev: true dev: true
/ts-node/10.5.0_99ae9436e134a034c8d45fdd98ebbf22: /ts-node/10.5.0_f3bd4037939c2ed2942ba074291f8ef2:
resolution: resolution:
{ {
integrity: sha512-6kEJKwVxAJ35W4akuiysfKwKmjkbYxwQMTBaAxo9KKAx/Yd26mPUyhGz3ji+EsJoAgrLqVsYHNuuYwQe22lbtw== integrity: sha512-6kEJKwVxAJ35W4akuiysfKwKmjkbYxwQMTBaAxo9KKAx/Yd26mPUyhGz3ji+EsJoAgrLqVsYHNuuYwQe22lbtw==
@@ -5430,7 +5429,7 @@ packages:
'@tsconfig/node12': 1.0.9 '@tsconfig/node12': 1.0.9
'@tsconfig/node14': 1.0.1 '@tsconfig/node14': 1.0.1
'@tsconfig/node16': 1.0.2 '@tsconfig/node16': 1.0.2
'@types/node': 17.0.16 '@types/node': 17.0.18
acorn: 8.5.0 acorn: 8.5.0
acorn-walk: 8.2.0 acorn-walk: 8.2.0
arg: 4.1.3 arg: 4.1.3

View File

@@ -74,26 +74,12 @@ export async function makeLabelForStandaloneDatabase({ id, image, volume }) {
]; ];
} }
export async function makeLabelForPlausibleAnalytics({ id, images, volume }) { export function makeLabelForServices(type) {
const service = await db.prisma.service.findFirst({
where: { id },
include: { plausibleAnalytics: true }
});
delete service.destinationDockerId;
delete service.createdAt;
delete service.updatedAt;
return [ return [
'coolify.managed=true', 'coolify.managed=true',
`coolify.version=${version}`, `coolify.version=${version}`,
`coolify.type=service-plausibleanalytics`, `coolify.type=service`,
`coolify.configuration=${base64Encode( `coolify.service.type=${type}`
JSON.stringify({
version,
images,
volume,
...service
})
)}`
]; ];
} }

View File

@@ -59,10 +59,14 @@ export async function removeApplication({ id, teamId }) {
const id = containerObj.ID; const id = containerObj.ID;
const preview = containerObj.Image.split('-')[1]; const preview = containerObj.Image.split('-')[1];
await removeDestinationDocker({ id, engine: destinationDocker.engine }); await removeDestinationDocker({ id, engine: destinationDocker.engine });
if (preview) { try {
await removeProxyConfiguration({ domain: `${preview}.${domain}` }); if (preview) {
} else { await removeProxyConfiguration({ domain: `${preview}.${domain}` });
await removeProxyConfiguration({ domain }); } else {
await removeProxyConfiguration({ domain });
}
} catch (error) {
console.log(error);
} }
} }
} }

View File

@@ -22,15 +22,15 @@ export async function isSecretExists({ id, name }) {
export async function isDomainConfigured({ id, fqdn }) { export async function isDomainConfigured({ id, fqdn }) {
const domain = getDomain(fqdn); const domain = getDomain(fqdn);
const foundApp = await prisma.application.findFirst({ const foundApp = await prisma.application.findFirst({
where: { fqdn: { endsWith: domain }, id: { not: id } }, where: { fqdn: { endsWith: `//${domain}` }, id: { not: id } },
select: { fqdn: true } select: { fqdn: true }
}); });
const foundService = await prisma.service.findFirst({ const foundService = await prisma.service.findFirst({
where: { fqdn: { endsWith: domain }, id: { not: id } }, where: { fqdn: { endsWith: `//${domain}` }, id: { not: id } },
select: { fqdn: true } select: { fqdn: true }
}); });
const coolifyFqdn = await prisma.setting.findFirst({ const coolifyFqdn = await prisma.setting.findFirst({
where: { fqdn: { endsWith: domain }, id: { not: id } }, where: { fqdn: { endsWith: `//${domain}` }, id: { not: id } },
select: { fqdn: true } select: { fqdn: true }
}); });
if (foundApp || foundService || coolifyFqdn) return true; if (foundApp || foundService || coolifyFqdn) return true;

View File

@@ -114,27 +114,55 @@ export const supportedServiceTypesAndVersions = [
name: 'plausibleanalytics', name: 'plausibleanalytics',
fancyName: 'Plausible Analytics', fancyName: 'Plausible Analytics',
baseImage: 'plausible/analytics', baseImage: 'plausible/analytics',
versions: ['latest'] versions: ['latest'],
ports: {
main: 8000
}
},
{
name: 'nocodb',
fancyName: 'NocoDB',
baseImage: 'nocodb/nocodb',
versions: ['latest'],
ports: {
main: 8080
}
},
{
name: 'minio',
fancyName: 'MinIO',
baseImage: 'minio/minio',
versions: ['latest'],
ports: {
main: 9001
}
}, },
{ name: 'nocodb', fancyName: 'NocoDB', baseImage: 'nocodb/nocodb', versions: ['latest'] },
{ name: 'minio', fancyName: 'MinIO', baseImage: 'minio/minio', versions: ['latest'] },
{ {
name: 'vscodeserver', name: 'vscodeserver',
fancyName: 'VSCode Server', fancyName: 'VSCode Server',
baseImage: 'codercom/code-server', baseImage: 'codercom/code-server',
versions: ['latest'] versions: ['latest'],
ports: {
main: 8080
}
}, },
{ {
name: 'wordpress', name: 'wordpress',
fancyName: 'Wordpress', fancyName: 'Wordpress',
baseImage: 'wordpress', baseImage: 'wordpress',
versions: ['latest', 'php8.1', 'php8.0', 'php7.4', 'php7.3'] versions: ['latest', 'php8.1', 'php8.0', 'php7.4', 'php7.3'],
ports: {
main: 80
}
}, },
{ {
name: 'vaultwarden', name: 'vaultwarden',
fancyName: 'Vaultwarden', fancyName: 'Vaultwarden',
baseImage: 'vaultwarden/server', baseImage: 'vaultwarden/server',
versions: ['latest'] versions: ['latest'],
ports: {
main: 80
}
} }
]; ];

View File

@@ -38,7 +38,7 @@ export async function configureDestinationForDatabase({ id, destinationId }) {
if (type && version) { if (type && version) {
const baseImage = getDatabaseImage(type); const baseImage = getDatabaseImage(type);
asyncExecShell( asyncExecShell(
`DOCKER_HOST=${host} docker pull ${baseImage}:${version} && echo "FROM ${baseImage}:${version}" | docker build --label coolify.managed="true" -t "${baseImage}:${version}" -` `DOCKER_HOST=${host} docker pull ${baseImage}:${version} && echo "FROM ${baseImage}:${version}" | docker build --label coolify.image="true" -t "${baseImage}:${version}" -`
); );
} }
} }

View File

@@ -71,7 +71,7 @@ export async function forceSSLOffApplication({ domain }) {
if (!dev) { if (!dev) {
const haproxy = await haproxyInstance(); const haproxy = await haproxyInstance();
await checkHAProxy(haproxy); await checkHAProxy(haproxy);
const transactionId = await getNextTransactionId(); let transactionId;
try { try {
const rules: any = await haproxy const rules: any = await haproxy
.get(`v2/services/haproxy/configuration/http_request_rules`, { .get(`v2/services/haproxy/configuration/http_request_rules`, {
@@ -84,6 +84,8 @@ export async function forceSSLOffApplication({ domain }) {
if (rules.data.length > 0) { if (rules.data.length > 0) {
const rule = rules.data.find((rule) => rule.cond_test.includes(`-i ${domain}`)); const rule = rules.data.find((rule) => rule.cond_test.includes(`-i ${domain}`));
if (rule) { if (rule) {
transactionId = await getNextTransactionId();
await haproxy await haproxy
.delete(`v2/services/haproxy/configuration/http_request_rules/${rule.index}`, { .delete(`v2/services/haproxy/configuration/http_request_rules/${rule.index}`, {
searchParams: { searchParams: {
@@ -98,7 +100,7 @@ export async function forceSSLOffApplication({ domain }) {
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} finally { } finally {
await completeTransaction(transactionId); if (transactionId) await completeTransaction(transactionId);
} }
} else { } else {
console.log(`[DEBUG] Removing ssl for ${domain}`); console.log(`[DEBUG] Removing ssl for ${domain}`);
@@ -108,8 +110,7 @@ export async function forceSSLOnApplication({ domain }) {
if (!dev) { if (!dev) {
const haproxy = await haproxyInstance(); const haproxy = await haproxyInstance();
await checkHAProxy(haproxy); await checkHAProxy(haproxy);
const transactionId = await getNextTransactionId(); let transactionId;
try { try {
const rules: any = await haproxy const rules: any = await haproxy
.get(`v2/services/haproxy/configuration/http_request_rules`, { .get(`v2/services/haproxy/configuration/http_request_rules`, {
@@ -127,6 +128,8 @@ export async function forceSSLOnApplication({ domain }) {
if (rule) return; if (rule) return;
nextRule = rules.data[rules.data.length - 1].index + 1; nextRule = rules.data[rules.data.length - 1].index + 1;
} }
transactionId = await getNextTransactionId();
await haproxy await haproxy
.post(`v2/services/haproxy/configuration/http_request_rules`, { .post(`v2/services/haproxy/configuration/http_request_rules`, {
searchParams: { searchParams: {
@@ -149,7 +152,7 @@ export async function forceSSLOnApplication({ domain }) {
console.log(error); console.log(error);
throw error; throw error;
} finally { } finally {
await completeTransaction(transactionId); if (transactionId) await completeTransaction(transactionId);
} }
} else { } else {
console.log(`[DEBUG] Adding ssl for ${domain}`); console.log(`[DEBUG] Adding ssl for ${domain}`);
@@ -159,9 +162,10 @@ export async function forceSSLOnApplication({ domain }) {
export async function deleteProxy({ id }) { export async function deleteProxy({ id }) {
const haproxy = await haproxyInstance(); const haproxy = await haproxyInstance();
await checkHAProxy(haproxy); await checkHAProxy(haproxy);
const transactionId = await getNextTransactionId(); let transactionId;
try { try {
await haproxy.get(`v2/services/haproxy/configuration/backends/${id}`).json(); await haproxy.get(`v2/services/haproxy/configuration/backends/${id}`).json();
transactionId = await getNextTransactionId();
await haproxy await haproxy
.delete(`v2/services/haproxy/configuration/backends/${id}`, { .delete(`v2/services/haproxy/configuration/backends/${id}`, {
searchParams: { searchParams: {
@@ -180,7 +184,7 @@ export async function deleteProxy({ id }) {
} catch (error) { } catch (error) {
console.log(error.response.body); console.log(error.response.body);
} finally { } finally {
await completeTransaction(transactionId); if (transactionId) await completeTransaction(transactionId);
} }
} }
@@ -212,7 +216,7 @@ export async function configureProxyForApplication({ domain, imageId, applicatio
if (backendAvailable.data.forwardfor.enabled === 'enabled') { if (backendAvailable.data.forwardfor.enabled === 'enabled') {
if (backendAvailable.data.name === domain) { if (backendAvailable.data.name === domain) {
if (server.data.check === 'enabled') { if (server.data.check === 'enabled') {
if (server.data.address === applicationId) { if (server.data.address === imageId) {
if (server.data.port === port) { if (server.data.port === port) {
serverConfigured = true; serverConfigured = true;
} }
@@ -274,8 +278,8 @@ export async function configureCoolifyProxyOff(fqdn) {
await checkHAProxy(haproxy); await checkHAProxy(haproxy);
try { try {
const transactionId = await getNextTransactionId();
await haproxy.get(`v2/services/haproxy/configuration/backends/${domain}`).json(); await haproxy.get(`v2/services/haproxy/configuration/backends/${domain}`).json();
const transactionId = await getNextTransactionId();
await haproxy await haproxy
.delete(`v2/services/haproxy/configuration/backends/${domain}`, { .delete(`v2/services/haproxy/configuration/backends/${domain}`, {
searchParams: { searchParams: {
@@ -505,52 +509,60 @@ export async function configureNetworkCoolifyProxy(engine) {
export async function configureSimpleServiceProxyOn({ id, domain, port }) { export async function configureSimpleServiceProxyOn({ id, domain, port }) {
const haproxy = await haproxyInstance(); const haproxy = await haproxyInstance();
await checkHAProxy(haproxy); await checkHAProxy(haproxy);
let serverConfigured = false;
let backendAvailable: any = null;
try { try {
await haproxy.get(`v2/services/haproxy/configuration/backends/${domain}`).json(); backendAvailable = await haproxy
const transactionId = await getNextTransactionId(); .get(`v2/services/haproxy/configuration/backends/${domain}`)
await haproxy .json();
.delete(`v2/services/haproxy/configuration/backends/${domain}`, { const server: any = await haproxy
.get(`v2/services/haproxy/configuration/servers/${id}`, {
searchParams: { searchParams: {
transaction_id: transactionId backend: domain
} }
}) })
.json(); .json();
await completeTransaction(transactionId); if (backendAvailable && server) {
// Very sophisticated way to check if the server is already configured in proxy
if (backendAvailable.data.forwardfor.enabled === 'enabled') {
if (backendAvailable.data.name === domain) {
if (server.data.check === 'enabled') {
if (server.data.address === id) {
if (server.data.port === port) {
serverConfigured = true;
}
}
}
}
}
}
} catch (error) {} } catch (error) {}
try { if (serverConfigured) return;
const transactionId = await getNextTransactionId(); const transactionId = await getNextTransactionId();
await haproxy.post('v2/services/haproxy/configuration/backends', { await haproxy.post('v2/services/haproxy/configuration/backends', {
searchParams: { searchParams: {
transaction_id: transactionId transaction_id: transactionId
}, },
json: { json: {
'init-addr': 'last,libc,none', 'init-addr': 'last,libc,none',
forwardfor: { enabled: 'enabled' }, forwardfor: { enabled: 'enabled' },
name: domain name: domain
} }
}); });
await haproxy.post('v2/services/haproxy/configuration/servers', { await haproxy.post('v2/services/haproxy/configuration/servers', {
searchParams: { searchParams: {
transaction_id: transactionId, transaction_id: transactionId,
backend: domain backend: domain
}, },
json: { json: {
address: id,
check: 'enabled',
name: id,
port: port
}
});
console.log({
address: id, address: id,
check: 'enabled', check: 'enabled',
name: id, name: id,
port: port port: port
}); }
await completeTransaction(transactionId); });
} catch (error) { await completeTransaction(transactionId);
console.log(error);
}
} }
export async function configureSimpleServiceProxyOff({ domain }) { export async function configureSimpleServiceProxyOff({ domain }) {
@@ -605,7 +617,7 @@ export async function removeWwwRedirection(domain) {
export async function setWwwRedirection(fqdn) { export async function setWwwRedirection(fqdn) {
const haproxy = await haproxyInstance(); const haproxy = await haproxyInstance();
await checkHAProxy(haproxy); await checkHAProxy(haproxy);
const transactionId = await getNextTransactionId(); let transactionId;
try { try {
const domain = getDomain(fqdn); const domain = getDomain(fqdn);
@@ -629,6 +641,7 @@ export async function setWwwRedirection(fqdn) {
nextRule = rules.data[rules.data.length - 1].index + 1; nextRule = rules.data[rules.data.length - 1].index + 1;
} }
const redirectValue = `${isHttps ? 'https://' : 'http://'}${domain}%[capture.req.uri]`; const redirectValue = `${isHttps ? 'https://' : 'http://'}${domain}%[capture.req.uri]`;
transactionId = await getNextTransactionId();
await haproxy await haproxy
.post(`v2/services/haproxy/configuration/http_request_rules`, { .post(`v2/services/haproxy/configuration/http_request_rules`, {
searchParams: { searchParams: {
@@ -651,6 +664,6 @@ export async function setWwwRedirection(fqdn) {
console.log(error); console.log(error);
throw error; throw error;
} finally { } finally {
await completeTransaction(transactionId); if (transactionId) await completeTransaction(transactionId);
} }
} }

View File

@@ -23,7 +23,7 @@ export default async function () {
]; ];
for (const image of images) { for (const image of images) {
await asyncExecShell( await asyncExecShell(
`DOCKER_HOST=${host} docker pull ${image} && echo "FROM ${image}" | docker build --label coolify.managed="true" -t "${image}" -` `DOCKER_HOST=${host} docker pull ${image} && echo "FROM ${image}" | docker build --label coolify.image="true" -t "${image}" -`
); );
} }
} catch (error) {} } catch (error) {}
@@ -35,11 +35,17 @@ export default async function () {
// Cleanup images that are not managed by coolify // Cleanup images that are not managed by coolify
try { try {
await asyncExecShell( await asyncExecShell(
`DOCKER_HOST=${host} docker image prune --filter 'label!=coolify.managed=true' -a -f` `DOCKER_HOST=${host} docker image prune --filter 'label!=coolify.image=true' -a -f`
); );
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
// Cleanup dangling images
try {
await asyncExecShell(`DOCKER_HOST=${host} docker image prune -f`);
} catch (error) {
console.log(error);
}
} }
} }
} }

View File

@@ -87,7 +87,7 @@ const cron = async () => {
await queue.proxy.add('proxy', {}, { repeat: { every: 10000 } }); await queue.proxy.add('proxy', {}, { repeat: { every: 10000 } });
// await queue.ssl.add('ssl', {}, { repeat: { every: 10000 } }); // await queue.ssl.add('ssl', {}, { repeat: { every: 10000 } });
await queue.cleanup.add('cleanup', {}, { repeat: { every: 3600000 } }); if (!dev) await queue.cleanup.add('cleanup', {}, { repeat: { every: 600000 } });
await queue.sslRenew.add('sslRenew', {}, { repeat: { every: 1800000 } }); await queue.sslRenew.add('sslRenew', {}, { repeat: { every: 1800000 } });
const events = { const events = {
@@ -144,7 +144,7 @@ buildWorker.on('failed', async (job: Bullmq.Job, failedReason) => {
}); });
}); });
const buildLogQueueName = dev ? cuid() : 'log_queue'; const buildLogQueueName = 'log_queue';
const buildLogQueue = new Queue(buildLogQueueName, connectionOptions); const buildLogQueue = new Queue(buildLogQueueName, connectionOptions);
const buildLogWorker = new Worker(buildLogQueueName, async (job) => await logger(job), { const buildLogWorker = new Worker(buildLogQueueName, async (job) => await logger(job), {
concurrency: 1, concurrency: 1,

View File

@@ -1,14 +1,16 @@
import { getDomain } from '$lib/common'; import { getDomain } from '$lib/common';
import { getApplicationById, prisma } from '$lib/database'; import { getApplicationById, prisma, supportedServiceTypesAndVersions } from '$lib/database';
import { dockerInstance } from '$lib/docker'; import { dockerInstance } from '$lib/docker';
import { import {
checkContainer, checkContainer,
configureCoolifyProxyOn, configureCoolifyProxyOn,
configureProxyForApplication, configureProxyForApplication,
configureSimpleServiceProxyOn,
forceSSLOnApplication, forceSSLOnApplication,
reloadHaproxy, reloadHaproxy,
setWwwRedirection, setWwwRedirection,
startCoolifyProxy startCoolifyProxy,
startHttpProxy
} from '$lib/haproxy'; } from '$lib/haproxy';
import * as db from '$lib/database'; import * as db from '$lib/database';
@@ -24,39 +26,76 @@ export default async function () {
(container) => container.Labels['coolify.managed'] (container) => container.Labels['coolify.managed']
); );
for (const configuration of configurations) { for (const configuration of configurations) {
const parsedConfiguration = JSON.parse( if (configuration.Labels['coolify.configuration']) {
Buffer.from(configuration.Labels['coolify.configuration'], 'base64').toString() const parsedConfiguration = JSON.parse(
); Buffer.from(configuration.Labels['coolify.configuration'], 'base64').toString()
if (configuration.Labels['coolify.type'] === 'standalone-application') { );
const { fqdn, applicationId, port, pullmergeRequestId } = parsedConfiguration; if (
if (fqdn) { parsedConfiguration &&
const found = await getApplicationById({ id: applicationId }); configuration.Labels['coolify.type'] === 'standalone-application'
if (found) { ) {
const domain = getDomain(fqdn); const { fqdn, applicationId, port, pullmergeRequestId } = parsedConfiguration;
await configureProxyForApplication({ if (fqdn) {
domain, const found = await getApplicationById({ id: applicationId });
imageId: pullmergeRequestId if (found) {
? `${applicationId}-${pullmergeRequestId}` const domain = getDomain(fqdn);
: applicationId, await configureProxyForApplication({
applicationId, domain,
port imageId: pullmergeRequestId
}); ? `${applicationId}-${pullmergeRequestId}`
const isHttps = fqdn.startsWith('https://'); : applicationId,
if (isHttps) await forceSSLOnApplication({ domain }); applicationId,
await setWwwRedirection(fqdn); port
});
const isHttps = fqdn.startsWith('https://');
if (isHttps) await forceSSLOnApplication({ domain });
await setWwwRedirection(fqdn);
}
}
}
}
}
for (const container of containers) {
const image = container.Image.split(':')[0];
const found = supportedServiceTypesAndVersions.find((a) => a.baseImage === image);
if (found) {
const type = found.name;
const mainPort = found.ports.main;
const id = container.Names[0].replace('/', '');
const service = await db.prisma.service.findUnique({
where: { id },
include: {
destinationDocker: true,
minio: true,
plausibleAnalytics: true,
vscodeserver: true,
wordpress: true
}
});
const { fqdn } = service;
const domain = getDomain(fqdn);
await configureSimpleServiceProxyOn({ id, domain, port: mainPort });
const publicPort = service[type]?.publicPort;
if (publicPort) {
const containerFound = await checkContainer(
destination.engine,
`haproxy-for-${publicPort}`
);
if (!containerFound) {
await startHttpProxy(destination, id, publicPort, 9000);
} }
} }
} }
} }
} }
} }
const services = await prisma.service.findMany({});
// Check Coolify FQDN and configure proxy if needed // Check Coolify FQDN and configure proxy if needed
const { fqdn } = await db.listSettings(); const { fqdn } = await db.listSettings();
if (fqdn) { if (fqdn) {
const domain = getDomain(fqdn); const domain = getDomain(fqdn);
const found = await checkContainer('/var/run/docker.sock', 'coolify-haproxy'); await startCoolifyProxy('/var/run/docker.sock');
if (!found) await startCoolifyProxy('/var/run/docker.sock'); await configureCoolifyProxyOn(fqdn);
await configureCoolifyProxyOn({ domain });
await setWwwRedirection(fqdn); await setWwwRedirection(fqdn);
const isHttps = fqdn.startsWith('https://'); const isHttps = fqdn.startsWith('https://');
if (isHttps) await forceSSLOnApplication({ domain }); if (isHttps) await forceSSLOnApplication({ domain });
@@ -64,7 +103,5 @@ export default async function () {
} catch (error) { } catch (error) {
console.log(error); console.log(error);
throw error; throw error;
} finally {
// await reloadHaproxy('/var/run/docker.sock');
} }
} }

View File

@@ -96,10 +96,9 @@
async function update() { async function update() {
updateStatus.loading = true; updateStatus.loading = true;
// if (!dev) {
try { try {
await post(`/update.json`, { type: 'update', latestVersion }); await post(`/update.json`, { type: 'update', latestVersion });
toast.push('Update completed. Waiting for the new version to start...'); toast.push('Update completed.<br>Waiting for the new version to start...');
let reachable = false; let reachable = false;
let tries = 0; let tries = 0;
do { do {
@@ -119,10 +118,9 @@
await asyncSleep(3000); await asyncSleep(3000);
return window.location.reload(); return window.location.reload();
} catch ({ error }) { } catch ({ error }) {
return errorNotification(error);
} finally {
updateStatus.success = false; updateStatus.success = false;
updateStatus.loading = false; updateStatus.loading = false;
return errorNotification(error);
} }
} }
</script> </script>

View File

@@ -15,16 +15,32 @@
let loading = true; let loading = true;
let currentStatus; let currentStatus;
let streamInterval; let streamInterval;
let followingBuild;
let followingInterval;
let logsEl;
const { id } = $page.params; const { id } = $page.params;
const cleanAnsiCodes = (str: string) => str.replace(/\x1B\[(\d+)m/g, '');
function followBuild() {
followingBuild = !followingBuild;
if (followingBuild) {
followingInterval = setInterval(() => {
logsEl.scrollTop = logsEl.scrollHeight;
window.scrollTo(0, document.body.scrollHeight);
}, 100);
} else {
window.clearInterval(followingInterval);
}
}
async function streamLogs(sequence = 0) { async function streamLogs(sequence = 0) {
try { try {
let { logs: responseLogs, status } = await get( let { logs: responseLogs, status } = await get(
`/applications/${id}/logs/build/build.json?buildId=${buildId}&sequence=${sequence}` `/applications/${id}/logs/build/build.json?buildId=${buildId}&sequence=${sequence}`
); );
currentStatus = status; currentStatus = status;
logs = logs.concat(responseLogs); logs = logs.concat(responseLogs.map((log) => ({ ...log, line: cleanAnsiCodes(log.line) })));
loading = false; loading = false;
streamInterval = setInterval(async () => { streamInterval = setInterval(async () => {
if (status !== 'running') { if (status !== 'running') {
@@ -38,18 +54,21 @@
); );
status = data.status; status = data.status;
currentStatus = status; currentStatus = status;
logs = logs.concat(data.logs);
logs = logs.concat(data.logs.map((log) => ({ ...log, line: cleanAnsiCodes(log.line) })));
dispatch('updateBuildStatus', { status }); dispatch('updateBuildStatus', { status });
} catch ({ error }) { } catch ({ error }) {
return errorNotification(error); return errorNotification(error);
} }
}, 1000); }, 1000);
} catch ({ error }) { } catch ({ error }) {
console.log(error);
return errorNotification(error); return errorNotification(error);
} }
} }
onDestroy(() => { onDestroy(() => {
clearInterval(streamInterval); clearInterval(streamInterval);
clearInterval(followingInterval);
}); });
onMount(async () => { onMount(async () => {
window.scrollTo(0, 0); window.scrollTo(0, 0);
@@ -60,12 +79,37 @@
{#if loading} {#if loading}
<Loading /> <Loading />
{:else} {:else}
<div class="relative"> <div class="relative ">
{#if currentStatus === 'running'} {#if currentStatus === 'running'}
<LoadingLogs /> <LoadingLogs />
{/if} {/if}
<div class="flex justify-end sticky top-0 p-2">
<button
on:click={followBuild}
data-tooltip="Follow logs"
class:text-green-500={followingBuild}
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<circle cx="12" cy="12" r="9" />
<line x1="8" y1="12" x2="12" y2="16" />
<line x1="12" y1="8" x2="12" y2="16" />
<line x1="16" y1="12" x2="12" y2="16" />
</svg>
</button>
</div>
<div <div
class="font-mono leading-6 text-left text-md tracking-tighter rounded bg-coolgray-200 py-5 px-6 whitespace-pre-wrap break-words" class="font-mono leading-6 text-left text-md tracking-tighter rounded bg-coolgray-200 py-5 px-6 whitespace-pre-wrap break-words overflow-auto max-h-[80vh] -mt-12"
bind:this={logsEl}
> >
{#each logs as log} {#each logs as log}
<div>{log.line + '\n'}</div> <div>{log.line + '\n'}</div>

View File

@@ -33,7 +33,6 @@
export let buildCount; export let buildCount;
let buildId; let buildId;
$: buildId;
let skip = 0; let skip = 0;
let noMoreBuilds = buildCount < 5 || buildCount <= skip; let noMoreBuilds = buildCount < 5 || buildCount <= skip;
@@ -92,45 +91,47 @@
Build logs of <a href={application.fqdn} target="_blank">{getDomain(application.fqdn)}</a> Build logs of <a href={application.fqdn} target="_blank">{getDomain(application.fqdn)}</a>
</div> </div>
</div> </div>
<div class="flex flex-row justify-start space-x-2 px-10 pt-6 "> <div class="block flex-row justify-start space-x-2 px-5 pt-6 sm:px-10 md:flex">
<div class="min-w-[16rem] space-y-2"> <div class="mb-4 min-w-[16rem] space-y-2 md:mb-0 ">
{#each builds as build (build.id)} <div class="top-4 md:sticky">
<div {#each builds as build (build.id)}
data-tooltip={new Intl.DateTimeFormat('default', dateOptions).format( <div
new Date(build.createdAt) data-tooltip={new Intl.DateTimeFormat('default', dateOptions).format(
) + `\n${build.status}`} new Date(build.createdAt)
on:click={() => loadBuild(build.id)} ) + `\n${build.status}`}
class="tooltip-top flex cursor-pointer items-center justify-center rounded-r border-l-2 border-transparent py-4 no-underline transition-all duration-100 hover:bg-coolgray-400 hover:shadow-xl" on:click={() => loadBuild(build.id)}
class:bg-coolgray-400={buildId === build.id} class="tooltip-top flex cursor-pointer items-center justify-center rounded-r border-l-2 border-transparent py-4 no-underline transition-all duration-100 hover:bg-coolgray-400 hover:shadow-xl "
class:border-red-500={build.status === 'failed'} class:bg-coolgray-400={buildId === build.id}
class:border-green-500={build.status === 'success'} class:border-red-500={build.status === 'failed'}
class:border-yellow-500={build.status === 'inprogress'} class:border-green-500={build.status === 'success'}
> class:border-yellow-500={build.status === 'inprogress'}
<div class="flex-col px-2"> >
<div class="text-sm font-bold"> <div class="flex-col px-2">
{application.branch} <div class="text-sm font-bold">
{application.branch}
</div>
<div class="text-xs">
{build.type}
</div>
</div> </div>
<div class="text-xs"> <div class="flex-1" />
{build.type}
</div>
</div>
<div class="flex-1" />
<div class="w-48 text-center text-xs"> <div class="w-48 text-center text-xs">
{#if build.status === 'running'} {#if build.status === 'running'}
<div class="font-bold">Running</div> <div class="font-bold">Running</div>
{:else} {:else}
<div>{build.since}</div> <div>{build.since}</div>
<div>Finished in <span class="font-bold">{build.took}s</span></div> <div>Finished in <span class="font-bold">{build.took}s</span></div>
{/if} {/if}
</div>
</div> </div>
</div> {/each}
{/each} </div>
{#if buildCount > 0 && !noMoreBuilds} <div class="flex space-x-2">
<button class="w-full" on:click={loadMoreBuilds}>Load More</button> <button disabled={noMoreBuilds} class="w-full" on:click={loadMoreBuilds}>Load More</button>
{/if} </div>
</div> </div>
<div class="w-96 flex-1"> <div class="flex-1 md:w-96">
{#if buildId} {#if buildId}
{#key buildId} {#key buildId}
<svelte:component this={BuildLog} {buildId} on:updateBuildStatus={updateBuildStatus} /> <svelte:component this={BuildLog} {buildId} on:updateBuildStatus={updateBuildStatus} />

View File

@@ -27,19 +27,23 @@
import { getDomain } from '$lib/components/common'; import { getDomain } from '$lib/components/common';
import { get } from '$lib/api'; import { get } from '$lib/api';
import { errorNotification } from '$lib/form'; import { errorNotification } from '$lib/form';
let loadLogsInterval = null; let loadLogsInterval = null;
let logs = []; let logs = [];
let followingBuild;
let followingInterval;
let logsEl;
const { id } = $page.params; const { id } = $page.params;
onMount(async () => { onMount(async () => {
loadLogs(); loadLogs();
loadLogsInterval = setInterval(() => { loadLogsInterval = setInterval(() => {
loadLogs(); loadLogs();
}, 3000); }, 1000);
}); });
onDestroy(() => { onDestroy(() => {
clearInterval(loadLogsInterval); clearInterval(loadLogsInterval);
clearInterval(followingInterval);
}); });
async function loadLogs() { async function loadLogs() {
try { try {
@@ -50,6 +54,18 @@
return errorNotification(error); return errorNotification(error);
} }
} }
function followBuild() {
followingBuild = !followingBuild;
if (followingBuild) {
followingInterval = setInterval(() => {
logsEl.scrollTop = logsEl.scrollHeight;
window.scrollTo(0, document.body.scrollHeight);
}, 100);
} else {
window.clearInterval(followingInterval);
}
}
</script> </script>
<div class="flex space-x-1 p-6 font-bold"> <div class="flex space-x-1 p-6 font-bold">
@@ -63,8 +79,33 @@
{:else} {:else}
<div class="relative w-full"> <div class="relative w-full">
<LoadingLogs /> <LoadingLogs />
<div class="flex justify-end sticky top-0 p-2">
<button
on:click={followBuild}
data-tooltip="Follow logs"
class:text-green-500={followingBuild}
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<circle cx="12" cy="12" r="9" />
<line x1="8" y1="12" x2="12" y2="16" />
<line x1="12" y1="8" x2="12" y2="16" />
<line x1="16" y1="12" x2="12" y2="16" />
</svg>
</button>
</div>
<div <div
class="font-mono leading-6 text-left text-md tracking-tighter rounded bg-coolgray-200 p-6 whitespace-pre-wrap break-words w-full" class="font-mono leading-6 text-left text-md tracking-tighter rounded bg-coolgray-200 p-6 whitespace-pre-wrap break-words w-full mb-10 -mt-12"
bind:this={logsEl}
> >
{#each logs as log} {#each logs as log}
{log + '\n'} {log + '\n'}

View File

@@ -14,6 +14,7 @@
let cannotDisable = settings.fqdn && destination.engine === '/var/run/docker.sock'; let cannotDisable = settings.fqdn && destination.engine === '/var/run/docker.sock';
// let scannedApps = []; // let scannedApps = [];
let loading = false; let loading = false;
let restarting = false;
async function handleSubmit() { async function handleSubmit() {
loading = true; loading = true;
try { try {
@@ -42,6 +43,17 @@
} catch ({ error }) { } catch ({ error }) {
return errorNotification(error); return errorNotification(error);
} }
} else if (state === true && destination.isCoolifyProxyUsed === false) {
destination.isCoolifyProxyUsed = !destination.isCoolifyProxyUsed;
try {
await post(`/destinations/${id}/settings.json`, {
isCoolifyProxyUsed: destination.isCoolifyProxyUsed,
engine: destination.engine
});
await startProxy();
} catch ({ error }) {
return errorNotification(error);
}
} }
}); });
async function changeProxySetting() { async function changeProxySetting() {
@@ -89,6 +101,25 @@
return errorNotification(error); return errorNotification(error);
} }
} }
async function forceRestartProxy() {
const sure = confirm(
'Are you sure you want to restart the proxy? Everyting will be reconfigured in ~10 sec.'
);
if (sure) {
try {
restarting = true;
toast.push('Coolify Proxy restarting...');
await post(`/destinations/${id}/restart.json`, {
engine: destination.engine,
fqdn: settings.fqdn
});
} catch ({ error }) {
setTimeout(() => {
window.location.reload();
}, 5000);
}
}
}
</script> </script>
<div class="flex justify-center px-6 pb-8"> <div class="flex justify-center px-6 pb-8">
@@ -103,6 +134,12 @@
disabled={loading} disabled={loading}
>{loading ? 'Saving...' : 'Save'} >{loading ? 'Saving...' : 'Save'}
</button> </button>
<button
class={restarting ? '' : 'bg-red-600 hover:bg-red-500'}
disabled={restarting}
on:click|preventDefault={forceRestartProxy}
>{restarting ? 'Restarting... please wait...' : 'Force restart proxy'}</button
>
<!-- <button type="button" class="bg-coollabs hover:bg-coollabs-100" on:click={scanApps} <!-- <button type="button" class="bg-coollabs hover:bg-coollabs-100" on:click={scanApps}
>Scan for applications</button >Scan for applications</button
> --> > -->

View File

@@ -0,0 +1,34 @@
import { getDomain, getUserDetails } from '$lib/common';
import { ErrorHandler } from '$lib/database';
import * as db from '$lib/database';
import {
configureCoolifyProxyOn,
forceSSLOnApplication,
setWwwRedirection,
startCoolifyProxy,
stopCoolifyProxy
} from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
if (status === 401) return { status, body };
const { engine, fqdn } = await event.request.json();
try {
const domain = getDomain(fqdn);
await stopCoolifyProxy(engine);
await startCoolifyProxy(engine);
await db.setDestinationSettings({ engine, isCoolifyProxyUsed: true });
await configureCoolifyProxyOn(fqdn);
await setWwwRedirection(fqdn);
const isHttps = fqdn.startsWith('https://');
if (isHttps) await forceSSLOnApplication({ domain });
return {
status: 200
};
} catch (error) {
return ErrorHandler(error);
}
};

View File

@@ -15,6 +15,7 @@ import {
import getPort from 'get-port'; import getPort from 'get-port';
import { getDomain } from '$lib/components/common'; import { getDomain } from '$lib/components/common';
import { ErrorHandler } from '$lib/database'; import { ErrorHandler } from '$lib/database';
import { makeLabelForServices } from '$lib/buildPacks/common';
export const post: RequestHandler = async (event) => { export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event); const { teamId, status, body } = await getUserDetails(event);
@@ -63,7 +64,8 @@ export const post: RequestHandler = async (event) => {
environment: config.environmentVariables, environment: config.environmentVariables,
networks: [network], networks: [network],
volumes: [config.volume], volumes: [config.volume],
restart: 'always' restart: 'always',
labels: makeLabelForServices('minio')
} }
}, },
networks: { networks: {

View File

@@ -12,6 +12,7 @@ import {
} from '$lib/haproxy'; } from '$lib/haproxy';
import { getDomain } from '$lib/components/common'; import { getDomain } from '$lib/components/common';
import { ErrorHandler } from '$lib/database'; import { ErrorHandler } from '$lib/database';
import { makeLabelForServices } from '$lib/buildPacks/common';
export const post: RequestHandler = async (event) => { export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event); const { teamId, status, body } = await getUserDetails(event);
@@ -39,7 +40,8 @@ export const post: RequestHandler = async (event) => {
container_name: id, container_name: id,
image: `nocodb/nocodb:${version}`, image: `nocodb/nocodb:${version}`,
networks: [network], networks: [network],
restart: 'always' restart: 'always',
labels: makeLabelForServices('nocodb')
} }
}, },
networks: { networks: {

View File

@@ -12,6 +12,7 @@ import {
} from '$lib/haproxy'; } from '$lib/haproxy';
import { getDomain } from '$lib/components/common'; import { getDomain } from '$lib/components/common';
import { ErrorHandler } from '$lib/database'; import { ErrorHandler } from '$lib/database';
import { makeLabelForServices } from '$lib/buildPacks/common';
export const post: RequestHandler = async (event) => { export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event); const { teamId, status, body } = await getUserDetails(event);
@@ -82,7 +83,6 @@ export const post: RequestHandler = async (event) => {
const network = destinationDockerId && destinationDocker.network; const network = destinationDockerId && destinationDocker.network;
const host = getEngine(destinationDocker.engine); const host = getEngine(destinationDocker.engine);
const engine = destinationDocker.engine; const engine = destinationDocker.engine;
// const labels = await makeLabelForPlausibleAnalytics({ id, })
const { workdir } = await createDirectories({ repository: type, buildId: id }); const { workdir } = await createDirectories({ repository: type, buildId: id });
@@ -138,7 +138,8 @@ COPY ./init-db.sh /docker-entrypoint-initdb.d/init-db.sh`;
environment: config.plausibleAnalytics.environmentVariables, environment: config.plausibleAnalytics.environmentVariables,
volumes: [config.postgresql.volume], volumes: [config.postgresql.volume],
restart: 'always', restart: 'always',
depends_on: [`${id}-postgresql`, `${id}-clickhouse`] depends_on: [`${id}-postgresql`, `${id}-clickhouse`],
labels: makeLabelForServices('plausibleAnalytics')
}, },
[`${id}-postgresql`]: { [`${id}-postgresql`]: {
container_name: `${id}-postgresql`, container_name: `${id}-postgresql`,

View File

@@ -12,6 +12,7 @@ import {
} from '$lib/haproxy'; } from '$lib/haproxy';
import { getDomain } from '$lib/components/common'; import { getDomain } from '$lib/components/common';
import { getServiceImage, ErrorHandler } from '$lib/database'; import { getServiceImage, ErrorHandler } from '$lib/database';
import { makeLabelForServices } from '$lib/buildPacks/common';
export const post: RequestHandler = async (event) => { export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event); const { teamId, status, body } = await getUserDetails(event);
@@ -46,7 +47,8 @@ export const post: RequestHandler = async (event) => {
image: config.image, image: config.image,
networks: [network], networks: [network],
volumes: [config.volume], volumes: [config.volume],
restart: 'always' restart: 'always',
labels: makeLabelForServices('vaultWarden')
} }
}, },
networks: { networks: {

View File

@@ -12,6 +12,7 @@ import {
} from '$lib/haproxy'; } from '$lib/haproxy';
import { getDomain } from '$lib/components/common'; import { getDomain } from '$lib/components/common';
import { ErrorHandler } from '$lib/database'; import { ErrorHandler } from '$lib/database';
import { makeLabelForServices } from '$lib/buildPacks/common';
export const post: RequestHandler = async (event) => { export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event); const { teamId, status, body } = await getUserDetails(event);
@@ -54,7 +55,8 @@ export const post: RequestHandler = async (event) => {
environment: config.environmentVariables, environment: config.environmentVariables,
networks: [network], networks: [network],
volumes: [config.volume], volumes: [config.volume],
restart: 'always' restart: 'always',
labels: makeLabelForServices('vscodeServer')
} }
}, },
networks: { networks: {

View File

@@ -12,6 +12,7 @@ import {
} from '$lib/haproxy'; } from '$lib/haproxy';
import { getDomain } from '$lib/components/common'; import { getDomain } from '$lib/components/common';
import { ErrorHandler } from '$lib/database'; import { ErrorHandler } from '$lib/database';
import { makeLabelForServices } from '$lib/buildPacks/common';
export const post: RequestHandler = async (event) => { export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event); const { teamId, status, body } = await getUserDetails(event);
@@ -78,7 +79,8 @@ export const post: RequestHandler = async (event) => {
environment: config.wordpress.environmentVariables, environment: config.wordpress.environmentVariables,
networks: [network], networks: [network],
restart: 'always', restart: 'always',
depends_on: [`${id}-mysql`] depends_on: [`${id}-mysql`],
labels: makeLabelForServices('wordpress')
}, },
[`${id}-mysql`]: { [`${id}-mysql`]: {
container_name: `${id}-mysql`, container_name: `${id}-mysql`,

View File

@@ -87,8 +87,7 @@ export const post: RequestHandler = async (event) => {
} }
} }
if (fqdn) { if (fqdn) {
const found = await checkContainer('/var/run/docker.sock', 'coolify-haproxy'); await startCoolifyProxy('/var/run/docker.sock');
if (!found) await startCoolifyProxy('/var/run/docker.sock');
const domain = getDomain(fqdn); const domain = getDomain(fqdn);
const isHttps = fqdn.startsWith('https://'); const isHttps = fqdn.startsWith('https://');
if (domain) { if (domain) {

View File

@@ -36,8 +36,6 @@ export const post: RequestHandler = async (event) => {
body: {} body: {}
}; };
} else { } else {
await asyncExecShell(`docker pull coollabsio/coolify:${latestVersion}`);
await asyncSleep(2000);
return { return {
status: 200, status: 200,
body: {} body: {}

View File

@@ -5,6 +5,7 @@ import cuid from 'cuid';
import crypto from 'crypto'; import crypto from 'crypto';
import { buildQueue } from '$lib/queues'; import { buildQueue } from '$lib/queues';
import { checkContainer, removeProxyConfiguration } from '$lib/haproxy'; import { checkContainer, removeProxyConfiguration } from '$lib/haproxy';
import { dev } from '$app/env';
export const options: RequestHandler = async () => { export const options: RequestHandler = async () => {
return { return {
@@ -22,8 +23,8 @@ export const post: RequestHandler = async (event) => {
const buildId = cuid(); const buildId = cuid();
const allowedGithubEvents = ['push', 'pull_request']; const allowedGithubEvents = ['push', 'pull_request'];
const allowedActions = ['opened', 'reopened', 'synchronize', 'closed']; const allowedActions = ['opened', 'reopened', 'synchronize', 'closed'];
const githubEvent = event.request.headers.get('x-github-event').toLowerCase(); const githubEvent = event.request.headers.get('x-github-event')?.toLowerCase();
const githubSignature = event.request.headers.get('x-hub-signature-256').toLowerCase(); const githubSignature = event.request.headers.get('x-hub-signature-256')?.toLowerCase();
if (!allowedGithubEvents.includes(githubEvent)) { if (!allowedGithubEvents.includes(githubEvent)) {
return { return {
status: 500, status: 500,
@@ -34,7 +35,6 @@ export const post: RequestHandler = async (event) => {
} }
let repository, projectId, branch; let repository, projectId, branch;
const body = await event.request.json(); const body = await event.request.json();
if (githubEvent === 'push') { if (githubEvent === 'push') {
repository = body.repository; repository = body.repository;
projectId = repository.id; projectId = repository.id;
@@ -54,14 +54,17 @@ export const post: RequestHandler = async (event) => {
'utf8' 'utf8'
); );
const checksum = Buffer.from(githubSignature, 'utf8'); const checksum = Buffer.from(githubSignature, 'utf8');
if (checksum.length !== digest.length || !crypto.timingSafeEqual(digest, checksum)) { if (!dev) {
return { if (checksum.length !== digest.length || !crypto.timingSafeEqual(digest, checksum)) {
status: 500, return {
body: { status: 500,
message: 'SHA256 checksum failed. Are you doing something fishy?' body: {
} message: 'SHA256 checksum failed. Are you doing something fishy?'
}; }
};
}
} }
if (githubEvent === 'push') { if (githubEvent === 'push') {
if (!applicationFound.configHash) { if (!applicationFound.configHash) {
const configHash = crypto const configHash = crypto
@@ -120,7 +123,11 @@ export const post: RequestHandler = async (event) => {
}; };
} }
} }
if (pullmergeRequestAction === 'opened' || pullmergeRequestAction === 'reopened') { if (
pullmergeRequestAction === 'opened' ||
pullmergeRequestAction === 'reopened' ||
pullmergeRequestAction === 'synchronize'
) {
await buildQueue.add(buildId, { await buildQueue.add(buildId, {
build_id: buildId, build_id: buildId,
type: 'webhook_pr', type: 'webhook_pr',

View File

@@ -69,7 +69,7 @@ a {
} }
.nav-side { .nav-side {
@apply absolute right-0 top-0 z-50 m-5 flex items-center justify-end space-x-2 bg-coolblack/40 text-white; @apply relative right-0 top-0 z-50 m-5 flex flex-wrap items-center justify-end space-x-2 bg-coolblack/40 text-white sm:absolute;
} }
.add-icon { .add-icon {