mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-27 12:33:54 +00:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8994dde8f0 | ||
|
|
b7303a0828 | ||
|
|
5bc330162a | ||
|
|
0ebc0217f3 | ||
|
|
95c810b80a | ||
|
|
82d7fb883d | ||
|
|
b96e710543 | ||
|
|
24e5e85225 | ||
|
|
7b8f81f1b2 | ||
|
|
62e60fc7ab | ||
|
|
ccd3d4aded | ||
|
|
f0cf155b5c | ||
|
|
b66f67d889 | ||
|
|
e5dc07bde1 | ||
|
|
a955eb0fec | ||
|
|
c070af9681 | ||
|
|
c15e060ef2 | ||
|
|
6d6f2454a7 | ||
|
|
9ff44ed46b | ||
|
|
adf3ef61b8 | ||
|
|
832107e0b8 | ||
|
|
0ea1e71808 |
@@ -1,5 +1,6 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
.pnpm-store
|
||||
build
|
||||
.svelte-kit
|
||||
package
|
||||
@@ -9,4 +10,8 @@ package
|
||||
dist
|
||||
client
|
||||
apps/api/db/*.db
|
||||
local-serve
|
||||
local-serve
|
||||
apps/api/db/migration.db-journal
|
||||
apps/api/core*
|
||||
logs
|
||||
others/certificates
|
||||
|
||||
@@ -1,57 +1,48 @@
|
||||
# Contribution
|
||||
# Contributing
|
||||
|
||||
First, thanks for considering to contribute to my project. It really means a lot! :)
|
||||
> "First, thanks for considering to contribute to my project.
|
||||
It really means a lot! 😁" - [@andrasbacsai](https://github.com/andrasbacsai)
|
||||
|
||||
You can ask for guidance anytime on our Discord server in the #contribution channel.
|
||||
You can ask for guidance anytime on our
|
||||
[Discord server](https://coollabs.io/discord) in the `#contribution` channel.
|
||||
|
||||
## Setup your development environment
|
||||
### Container based development flow (recommended and the easiest)
|
||||
All you need is to intall [Docker Engine 20.11+](https://docs.docker.com/engine/install/) on your local machine and run `pnpm dev:container`. It will build the base image for Coolify and start the development server inside Docker. All required ports (3000, 3001) will be exposed to your host.
|
||||
You'll need a set of skills to [get started](docs/contribution/GettingStarted.md).
|
||||
|
||||
### Github codespaces
|
||||
## 1) Setup your development environment
|
||||
|
||||
If you have github codespaces enabled then you can just create a codespace and run `pnpm dev` to run your the dev environment. All the required dependencies and packages has been configured for you already.
|
||||
- 🌟 [Container based](docs/dev_setup/Container.md) ← *Recomended*
|
||||
- 📦 [DockerContainer](docs/dev_setup/DockerContiner.md) *WIP
|
||||
- 🐙 [Github Codespaces](docs/dev_setup/GithubCodespaces.md)
|
||||
- ☁️ [GitPod](docs/dev_setup/GitPod.md)
|
||||
- 🍏 [Local Mac](docs/dev_setup/Mac.md)
|
||||
|
||||
### Gitpod
|
||||
1. Use [container based development flow](#container-based-development-flow-easiest)
|
||||
2. Or setup your workspace manually:
|
||||
## 2) Basic requirements
|
||||
|
||||
Create a workspace from this repository, run `pnpm install && pnpm db:push && pnpm db:seed` and then `pnpm dev`. All the required dependencies and packages has been configured for you already.
|
||||
- [Install Pnpm](https://pnpm.io/installation)
|
||||
- [Install Docker Engine](https://docs.docker.com/engine/install/)
|
||||
- [Setup Docker Compose Plugin](https://docs.docker.com/compose/install/compose-plugin/)
|
||||
- [Setup GIT LFS Support](https://git-lfs.github.com/)
|
||||
|
||||
> Some packages, just `pack` are not installed in this way. You cannot test all the features. Please use the [container based development flow](#container-based-development-flow-easiest).
|
||||
## 3) Setup Coolify
|
||||
|
||||
### Local Machine
|
||||
> At the moment, Coolify `doesn't support Windows`. You must use `Linux` or `MacOS` or consider using Gitpod or Github Codespaces.
|
||||
- Copy `apps/api/.env.example` to `apps/api/.env`
|
||||
- Edit `apps/api/.env`, set the `COOLIFY_APP_ID` environment variable to something cool.
|
||||
- Run `pnpm install` to install dependencies.
|
||||
- Run `pnpm db:push` to o create a local SQlite database. This will apply all migrations at `db/dev.db`.
|
||||
- Run `pnpm db:seed` seed the database.
|
||||
- Run `pnpm dev` start coding.
|
||||
|
||||
Install all the prerequisites manually to your host system. If you would not like to install anything, I suggest to use the [container based development flow](#container-based-development-flow-easiest).
|
||||
```sh
|
||||
# Or... Copy and paste commands bellow:
|
||||
cp apps/api/.env.example apps/api.env
|
||||
pnpm install
|
||||
pnpm db:push
|
||||
pnpm db:seed
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
- Due to the lock file, this repository is best with [pnpm](https://pnpm.io). I recommend you try and use `pnpm` because it is cool and efficient!
|
||||
- You need to have [Docker Engine](https://docs.docker.com/engine/install/) installed locally.
|
||||
- You need to have [Docker Compose Plugin](https://docs.docker.com/compose/install/compose-plugin/) installed locally.
|
||||
- You need to have [GIT LFS Support](https://git-lfs.github.com/) installed locally.
|
||||
## 4) Start Coding
|
||||
|
||||
Optional:
|
||||
- To test Heroku buildpacks, you need [pack](https://github.com/buildpacks/pack) binary installed locally.
|
||||
You should be able to access `http://localhost:3000`.
|
||||
|
||||
### Inside a Docker container
|
||||
`WIP`
|
||||
|
||||
## Setup Coolify
|
||||
- Copy `apps/api/.env.template` to `apps/api/.env.template` and set the `COOLIFY_APP_ID` environment variable to something cool.
|
||||
- `pnpm install` to install dependencies.
|
||||
- `pnpm db:push` to o create a local SQlite database.
|
||||
|
||||
This will apply all migrations at `db/dev.db`.
|
||||
|
||||
- `pnpm db:seed` seed the database.
|
||||
- `pnpm dev` start coding.
|
||||
|
||||
## Technical skills required
|
||||
|
||||
- **Languages**: Node.js / Javascript / Typescript
|
||||
- **Framework JS/TS**: [SvelteKit](https://kit.svelte.dev/) & [Fastify](https://www.fastify.io/)
|
||||
- **Database ORM**: [Prisma.io](https://www.prisma.io/)
|
||||
- **Docker Engine API**
|
||||
|
||||
## How to add a new service?
|
||||
You can find all details [here](https://github.com/coollabsio/coolify-community-templates)
|
||||
1. Click `Register` and setup your first user.
|
||||
@@ -105,6 +105,10 @@ A fresh installation is necessary. v2 and v3 are not compatible with v1.
|
||||
- Email: [andras@coollabs.io](mailto:andras@coollabs.io)
|
||||
- Discord: [Invitation](https://coollabs.io/discord)
|
||||
|
||||
## Development Contributions
|
||||
|
||||
Coolify is developed under the Apache License and you can help to make it grow → [Start coding!](./CONTRIBUTION.md)
|
||||
|
||||
## Financial Contributors
|
||||
|
||||
Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/coollabsio/contribute)]
|
||||
|
||||
@@ -786,6 +786,11 @@
|
||||
label: MariaDB | _APP_DB_USER
|
||||
defaultValue: user
|
||||
description: MariaDB server user name.
|
||||
- id: "$$secret__app_db_root_pass"
|
||||
name: MARIADB_ROOT_PASSWORD
|
||||
label: MariaDB | MARIADB_ROOT_PASSWORD
|
||||
defaultValue: "$$generate_hex(16)"
|
||||
description: MariaDB server root user password.
|
||||
- id: "$$secret__app_db_pass"
|
||||
name: _APP_DB_PASS
|
||||
label: MariaDB | _APP_DB_PASS
|
||||
@@ -1886,6 +1891,7 @@
|
||||
description: ""
|
||||
showOnConfiguration: true
|
||||
- templateVersion: 1.0.0
|
||||
ignore: true
|
||||
defaultVersion: latest
|
||||
documentation: https://ghost.org/resources/
|
||||
type: ghost-mariadb
|
||||
|
||||
@@ -173,7 +173,13 @@ const host = '0.0.0.0';
|
||||
// Refresh and check templates
|
||||
setInterval(async () => {
|
||||
await refreshTemplates()
|
||||
}, 60000)
|
||||
|
||||
setInterval(async () => {
|
||||
await refreshTags()
|
||||
}, 60000)
|
||||
|
||||
setInterval(async () => {
|
||||
await migrateServicesToNewTemplate()
|
||||
}, 60000)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cuid from "cuid";
|
||||
import { decrypt, encrypt, fixType, generatePassword, getDomain, prisma } from "./lib/common";
|
||||
import { decrypt, encrypt, fixType, generatePassword, prisma } from "./lib/common";
|
||||
import { getTemplates } from "./lib/services";
|
||||
|
||||
export async function migrateServicesToNewTemplate() {
|
||||
@@ -30,85 +30,92 @@ export async function migrateServicesToNewTemplate() {
|
||||
}
|
||||
})
|
||||
for (const service of services) {
|
||||
const { id } = service
|
||||
if (!service.type) {
|
||||
continue;
|
||||
}
|
||||
let template = templates.find(t => fixType(t.type) === fixType(service.type));
|
||||
if (template) {
|
||||
template = JSON.parse(JSON.stringify(template).replaceAll('$$id', service.id))
|
||||
if (service.type === 'plausibleanalytics' && service.plausibleAnalytics) await plausibleAnalytics(service, template)
|
||||
if (service.type === 'fider' && service.fider) await fider(service, template)
|
||||
if (service.type === 'minio' && service.minio) await minio(service, template)
|
||||
if (service.type === 'vscodeserver' && service.vscodeserver) await vscodeserver(service, template)
|
||||
if (service.type === 'wordpress' && service.wordpress) await wordpress(service, template)
|
||||
if (service.type === 'ghost' && service.ghost) await ghost(service, template)
|
||||
if (service.type === 'meilisearch' && service.meiliSearch) await meilisearch(service, template)
|
||||
if (service.type === 'umami' && service.umami) await umami(service, template)
|
||||
if (service.type === 'hasura' && service.hasura) await hasura(service, template)
|
||||
if (service.type === 'glitchTip' && service.glitchTip) await glitchtip(service, template)
|
||||
if (service.type === 'searxng' && service.searxng) await searxng(service, template)
|
||||
if (service.type === 'weblate' && service.weblate) await weblate(service, template)
|
||||
if (service.type === 'appwrite' && service.appwrite) await appwrite(service, template)
|
||||
try {
|
||||
const { id } = service
|
||||
if (!service.type) {
|
||||
continue;
|
||||
}
|
||||
let template = templates.find(t => fixType(t.type) === fixType(service.type));
|
||||
if (template) {
|
||||
template = JSON.parse(JSON.stringify(template).replaceAll('$$id', service.id))
|
||||
if (service.type === 'plausibleanalytics' && service.plausibleAnalytics) await plausibleAnalytics(service, template)
|
||||
if (service.type === 'fider' && service.fider) await fider(service, template)
|
||||
if (service.type === 'minio' && service.minio) await minio(service, template)
|
||||
if (service.type === 'vscodeserver' && service.vscodeserver) await vscodeserver(service, template)
|
||||
if (service.type === 'wordpress' && service.wordpress) await wordpress(service, template)
|
||||
if (service.type === 'ghost' && service.ghost) await ghost(service, template)
|
||||
if (service.type === 'meilisearch' && service.meiliSearch) await meilisearch(service, template)
|
||||
if (service.type === 'umami' && service.umami) await umami(service, template)
|
||||
if (service.type === 'hasura' && service.hasura) await hasura(service, template)
|
||||
if (service.type === 'glitchTip' && service.glitchTip) await glitchtip(service, template)
|
||||
if (service.type === 'searxng' && service.searxng) await searxng(service, template)
|
||||
if (service.type === 'weblate' && service.weblate) await weblate(service, template)
|
||||
if (service.type === 'appwrite' && service.appwrite) await appwrite(service, template)
|
||||
|
||||
await createVolumes(service, template);
|
||||
try {
|
||||
await createVolumes(service, template);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
if (template.variables.length > 0) {
|
||||
if (template.variables.length > 0) {
|
||||
for (const variable of template.variables) {
|
||||
const { defaultValue } = variable;
|
||||
const regex = /^\$\$.*\((\d+)\)$/g;
|
||||
const length = Number(regex.exec(defaultValue)?.[1]) || undefined
|
||||
if (variable.defaultValue.startsWith('$$generate_password')) {
|
||||
variable.value = generatePassword({ length });
|
||||
} else if (variable.defaultValue.startsWith('$$generate_hex')) {
|
||||
variable.value = generatePassword({ length, isHex: true });
|
||||
} else if (variable.defaultValue.startsWith('$$generate_username')) {
|
||||
variable.value = cuid();
|
||||
} else {
|
||||
variable.value = variable.defaultValue || '';
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const variable of template.variables) {
|
||||
const { defaultValue } = variable;
|
||||
const regex = /^\$\$.*\((\d+)\)$/g;
|
||||
const length = Number(regex.exec(defaultValue)?.[1]) || undefined
|
||||
if (variable.defaultValue.startsWith('$$generate_password')) {
|
||||
variable.value = generatePassword({ length });
|
||||
} else if (variable.defaultValue.startsWith('$$generate_hex')) {
|
||||
variable.value = generatePassword({ length, isHex: true });
|
||||
} else if (variable.defaultValue.startsWith('$$generate_username')) {
|
||||
variable.value = cuid();
|
||||
} else {
|
||||
variable.value = variable.defaultValue || '';
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const variable of template.variables) {
|
||||
if (variable.id.startsWith('$$secret_')) {
|
||||
const found = await prisma.serviceSecret.findFirst({ where: { name: variable.name, serviceId: id } })
|
||||
if (!found) {
|
||||
await prisma.serviceSecret.create({
|
||||
data: { name: variable.name, value: encrypt(variable.value) || '', service: { connect: { id } } }
|
||||
})
|
||||
}
|
||||
if (variable.id.startsWith('$$secret_')) {
|
||||
const found = await prisma.serviceSecret.findFirst({ where: { name: variable.name, serviceId: id } })
|
||||
if (!found) {
|
||||
await prisma.serviceSecret.create({
|
||||
data: { name: variable.name, value: encrypt(variable.value) || '', service: { connect: { id } } }
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
if (variable.id.startsWith('$$config_')) {
|
||||
const found = await prisma.serviceSetting.findFirst({ where: { name: variable.name, serviceId: id } })
|
||||
if (!found) {
|
||||
await prisma.serviceSetting.create({
|
||||
data: { name: variable.name, value: variable.value.toString(), variableName: variable.id, service: { connect: { id } } }
|
||||
})
|
||||
}
|
||||
if (variable.id.startsWith('$$config_')) {
|
||||
const found = await prisma.serviceSetting.findFirst({ where: { name: variable.name, serviceId: id } })
|
||||
if (!found) {
|
||||
await prisma.serviceSetting.create({
|
||||
data: { name: variable.name, value: variable.value.toString(), variableName: variable.id, service: { connect: { id } } }
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const s of Object.keys(template.services)) {
|
||||
if (service.type === 'plausibleanalytics') {
|
||||
continue;
|
||||
}
|
||||
if (template.services[s].volumes) {
|
||||
for (const volume of template.services[s].volumes) {
|
||||
const [volumeName, path] = volume.split(':')
|
||||
if (!volumeName.startsWith('/')) {
|
||||
const found = await prisma.servicePersistentStorage.findFirst({ where: { volumeName, serviceId: id } })
|
||||
if (!found) {
|
||||
await prisma.servicePersistentStorage.create({
|
||||
data: { volumeName, path, containerId: s, predefined: true, service: { connect: { id } } }
|
||||
});
|
||||
for (const s of Object.keys(template.services)) {
|
||||
if (service.type === 'plausibleanalytics') {
|
||||
continue;
|
||||
}
|
||||
if (template.services[s].volumes) {
|
||||
for (const volume of template.services[s].volumes) {
|
||||
const [volumeName, path] = volume.split(':')
|
||||
if (!volumeName.startsWith('/')) {
|
||||
const found = await prisma.servicePersistentStorage.findFirst({ where: { volumeName, serviceId: id } })
|
||||
if (!found) {
|
||||
await prisma.servicePersistentStorage.create({
|
||||
data: { volumeName, path, containerId: s, predefined: true, service: { connect: { id } } }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await prisma.service.update({ where: { id }, data: { templateVersion: template.templateVersion } })
|
||||
}
|
||||
await prisma.service.update({ where: { id }, data: { templateVersion: template.templateVersion } })
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
@@ -246,6 +253,8 @@ async function umami(service: any, template: any) {
|
||||
await migrateSettings(settings, service, template);
|
||||
await migrateSecrets(secrets, service);
|
||||
|
||||
await prisma.service.update({ where: { id: service.id }, data: { type: "umami-postgresql" } })
|
||||
|
||||
// Disconnect old service data
|
||||
// await prisma.service.update({ where: { id: service.id }, data: { umami: { disconnect: true } } })
|
||||
}
|
||||
@@ -433,33 +442,41 @@ async function plausibleAnalytics(service: any, template: any) {
|
||||
|
||||
async function migrateSettings(settings: any[], service: any, template: any) {
|
||||
for (const setting of settings) {
|
||||
if (!setting) continue;
|
||||
let [name, value] = setting.split('@@@')
|
||||
let minio = name
|
||||
if (name === 'MINIO_SERVER_URL') {
|
||||
name = 'coolify_fqdn_minio_console'
|
||||
try {
|
||||
if (!setting) continue;
|
||||
let [name, value] = setting.split('@@@')
|
||||
let minio = name
|
||||
if (name === 'MINIO_SERVER_URL') {
|
||||
name = 'coolify_fqdn_minio_console'
|
||||
}
|
||||
if (!value || value === 'null') {
|
||||
continue;
|
||||
}
|
||||
let variableName = template.variables.find((v: any) => v.name === name)?.id
|
||||
if (!variableName) {
|
||||
variableName = `$$config_${name.toLowerCase()}`
|
||||
}
|
||||
// console.log('Migrating setting', name, value, 'for service', service.id, ', service name:', service.name, 'variableName: ', variableName)
|
||||
|
||||
await prisma.serviceSetting.findFirst({ where: { name: minio, serviceId: service.id } }) || await prisma.serviceSetting.create({ data: { name: minio, value, variableName, service: { connect: { id: service.id } } } })
|
||||
} catch(error) {
|
||||
console.log(error)
|
||||
}
|
||||
if (!value || value === 'null') {
|
||||
continue;
|
||||
}
|
||||
let variableName = template.variables.find((v: any) => v.name === name)?.id
|
||||
if (!variableName) {
|
||||
variableName = `$$config_${name.toLowerCase()}`
|
||||
}
|
||||
// console.log('Migrating setting', name, value, 'for service', service.id, ', service name:', service.name, 'variableName: ', variableName)
|
||||
|
||||
await prisma.serviceSetting.findFirst({ where: { name: minio, serviceId: service.id } }) || await prisma.serviceSetting.create({ data: { name: minio, value, variableName, service: { connect: { id: service.id } } } })
|
||||
}
|
||||
}
|
||||
async function migrateSecrets(secrets: any[], service: any) {
|
||||
for (const secret of secrets) {
|
||||
if (!secret) continue;
|
||||
let [name, value] = secret.split('@@@')
|
||||
if (!value || value === 'null') {
|
||||
continue
|
||||
try {
|
||||
if (!secret) continue;
|
||||
let [name, value] = secret.split('@@@')
|
||||
if (!value || value === 'null') {
|
||||
continue
|
||||
}
|
||||
// console.log('Migrating secret', name, value, 'for service', service.id, ', service name:', service.name)
|
||||
await prisma.serviceSecret.findFirst({ where: { name, serviceId: service.id } }) || await prisma.serviceSecret.create({ data: { name, value, service: { connect: { id: service.id } } } })
|
||||
} catch(error) {
|
||||
console.log(error)
|
||||
}
|
||||
// console.log('Migrating secret', name, value, 'for service', service.id, ', service name:', service.name)
|
||||
await prisma.serviceSecret.findFirst({ where: { name, serviceId: service.id } }) || await prisma.serviceSecret.create({ data: { name, value, service: { connect: { id: service.id } } } })
|
||||
}
|
||||
}
|
||||
async function createVolumes(service: any, template: any) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import { day } from './dayjs';
|
||||
import { saveBuildLog } from './buildPacks/common';
|
||||
import { scheduler } from './scheduler';
|
||||
|
||||
export const version = '3.11.0';
|
||||
export const version = '3.11.2';
|
||||
export const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
const algorithm = 'aes-256-ctr';
|
||||
|
||||
@@ -49,10 +49,6 @@ export async function refreshTags() {
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
throw {
|
||||
status: 500,
|
||||
message: 'Could not fetch templates from get.coollabs.io'
|
||||
};
|
||||
}
|
||||
|
||||
return {};
|
||||
@@ -73,12 +69,7 @@ export async function refreshTemplates() {
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
throw {
|
||||
status: 500,
|
||||
message: 'Could not fetch templates from get.coollabs.io'
|
||||
};
|
||||
}
|
||||
|
||||
return {};
|
||||
} catch ({ status, message }) {
|
||||
return errorHandler({ status, message });
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FastifyPluginAsync } from 'fastify';
|
||||
import { checkUpdate, login, showDashboard, update, resetQueue, getCurrentUser, cleanupManually, restartCoolify, refreshTemplates } from './handlers';
|
||||
import { checkUpdate, login, showDashboard, update, resetQueue, getCurrentUser, cleanupManually, restartCoolify } from './handlers';
|
||||
import { GetCurrentUser } from './types';
|
||||
|
||||
export interface Update {
|
||||
@@ -52,10 +52,6 @@ const root: FastifyPluginAsync = async (fastify): Promise<void> => {
|
||||
fastify.post('/internal/cleanup', {
|
||||
onRequest: [fastify.authenticate]
|
||||
}, async (request) => await cleanupManually(request));
|
||||
|
||||
fastify.post('/internal/refreshTemplates', {
|
||||
onRequest: [fastify.authenticate]
|
||||
}, async () => await refreshTemplates());
|
||||
};
|
||||
|
||||
export default root;
|
||||
|
||||
@@ -3,9 +3,9 @@ import { errorHandler, getDomain, isDev, prisma, executeDockerCmd, fixType } fro
|
||||
import { getTemplates } from "../../../lib/services";
|
||||
import { OnlyId } from "../../../types";
|
||||
|
||||
function generateServices(id, containerId, port) {
|
||||
function generateServices(serviceId, containerId, port) {
|
||||
return {
|
||||
[`${id}-${port || 'default'}`]: {
|
||||
[serviceId]: {
|
||||
loadbalancer: {
|
||||
servers: [
|
||||
{
|
||||
@@ -16,18 +16,18 @@ function generateServices(id, containerId, port) {
|
||||
}
|
||||
}
|
||||
}
|
||||
function generateRouters(id, domain, nakedDomain, pathPrefix, isHttps, isWWW, isDualCerts, isCustomSSL) {
|
||||
function generateRouters(serviceId, domain, nakedDomain, pathPrefix, isHttps, isWWW, isDualCerts, isCustomSSL) {
|
||||
let http: any = {
|
||||
entrypoints: ['web'],
|
||||
rule: `Host(\`${nakedDomain}\`)${pathPrefix ? ` && PathPrefix(\`${pathPrefix}\`)` : ''}`,
|
||||
service: `${id}`,
|
||||
service: `${serviceId}`,
|
||||
priority: 2,
|
||||
middlewares: []
|
||||
}
|
||||
let https: any = {
|
||||
entrypoints: ['websecure'],
|
||||
rule: `Host(\`${nakedDomain}\`)${pathPrefix ? ` && PathPrefix(\`${pathPrefix}\`)` : ''}`,
|
||||
service: `${id}`,
|
||||
service: `${serviceId}`,
|
||||
priority: 2,
|
||||
tls: {
|
||||
certresolver: 'letsencrypt'
|
||||
@@ -37,14 +37,14 @@ function generateRouters(id, domain, nakedDomain, pathPrefix, isHttps, isWWW, is
|
||||
let httpWWW: any = {
|
||||
entrypoints: ['web'],
|
||||
rule: `Host(\`www.${nakedDomain}\`)${pathPrefix ? ` && PathPrefix(\`${pathPrefix}\`)` : ''}`,
|
||||
service: `${id}`,
|
||||
service: `${serviceId}`,
|
||||
priority: 2,
|
||||
middlewares: []
|
||||
}
|
||||
let httpsWWW: any = {
|
||||
entrypoints: ['websecure'],
|
||||
rule: `Host(\`www.${nakedDomain}\`)${pathPrefix ? ` && PathPrefix(\`${pathPrefix}\`)` : ''}`,
|
||||
service: `${id}`,
|
||||
service: `${serviceId}`,
|
||||
priority: 2,
|
||||
tls: {
|
||||
certresolver: 'letsencrypt'
|
||||
@@ -129,10 +129,10 @@ function generateRouters(id, domain, nakedDomain, pathPrefix, isHttps, isWWW, is
|
||||
}
|
||||
}
|
||||
return {
|
||||
[id]: { ...http },
|
||||
[`${id}-secure`]: { ...https },
|
||||
[`${id}-www`]: { ...httpWWW },
|
||||
[`${id}-secure-www`]: { ...httpsWWW },
|
||||
[`${serviceId}-${pathPrefix}`]: { ...http },
|
||||
[`${serviceId}-${pathPrefix}-secure`]: { ...https },
|
||||
[`${serviceId}-${pathPrefix}-www`]: { ...httpWWW },
|
||||
[`${serviceId}-${pathPrefix}-secure-www`]: { ...httpsWWW },
|
||||
}
|
||||
}
|
||||
export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote: boolean = false) {
|
||||
@@ -310,9 +310,10 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote
|
||||
const pathPrefix = '/'
|
||||
const isCustomSSL = false;
|
||||
const dualCerts = false;
|
||||
const serviceId = `${id}-${port || 'default'}`
|
||||
|
||||
traefik.http.routers = { ...traefik.http.routers, ...generateRouters(`${id}-${port || 'default'}`, domain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }
|
||||
traefik.http.services = { ...traefik.http.services, ...generateServices(id, containerId, port) }
|
||||
traefik.http.routers = { ...traefik.http.routers, ...generateRouters(serviceId, domain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }
|
||||
traefik.http.services = { ...traefik.http.services, ...generateServices(serviceId, containerId, port) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,9 +329,9 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote
|
||||
const isHttps = fqdn.startsWith('https://');
|
||||
const isWWW = fqdn.includes('www.');
|
||||
const pathPrefix = '/'
|
||||
|
||||
traefik.http.routers = { ...traefik.http.routers, ...generateRouters(`${id}-${port || 'default'}`, domain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }
|
||||
traefik.http.services = { ...traefik.http.services, ...generateServices(id, id, port) }
|
||||
const serviceId = `${id}-${port || 'default'}`
|
||||
traefik.http.routers = { ...traefik.http.routers, ...generateRouters(serviceId, domain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }
|
||||
traefik.http.services = { ...traefik.http.services, ...generateServices(serviceId, id, port) }
|
||||
if (previews) {
|
||||
const { stdout } = await executeDockerCmd({ dockerId, command: `docker container ls --filter="status=running" --filter="network=${network}" --filter="name=${id}-" --format="{{json .Names}}"` })
|
||||
const containers = stdout
|
||||
@@ -343,9 +344,9 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote
|
||||
const previewDomain = `${container.split('-')[1]}.${domain}`;
|
||||
const nakedDomain = previewDomain.replace(/^www\./, '');
|
||||
const pathPrefix = '/'
|
||||
|
||||
traefik.http.routers = { ...traefik.http.routers, ...generateRouters(`${container}-${port || 'default'}`, previewDomain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }
|
||||
traefik.http.services = { ...traefik.http.services, ...generateServices(container, container, port) }
|
||||
const serviceId = `${container}-${port || 'default'}`
|
||||
traefik.http.routers = { ...traefik.http.routers, ...generateRouters(serviceId, previewDomain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }
|
||||
traefik.http.services = { ...traefik.http.services, ...generateServices(serviceId, container, port) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,7 +413,7 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote
|
||||
let port, pathPrefix, customDomain;
|
||||
if (configuration) {
|
||||
port = configuration?.port;
|
||||
pathPrefix = configuration?.pathPrefix || null;
|
||||
pathPrefix = configuration?.pathPrefix || '/';
|
||||
customDomain = configuration?.domain
|
||||
}
|
||||
if (customDomain) {
|
||||
@@ -425,8 +426,9 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote
|
||||
const isHttps = fqdn.startsWith('https://');
|
||||
const isWWW = fqdn.includes('www.');
|
||||
const isCustomSSL = false;
|
||||
traefik.http.routers = { ...traefik.http.routers, ...generateRouters(`${id}-${port || 'default'}`, domain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }
|
||||
traefik.http.services = { ...traefik.http.services, ...generateServices(id, id, port) }
|
||||
const serviceId = `${oneService}-${port || 'default'}`
|
||||
traefik.http.routers = { ...traefik.http.routers, ...generateRouters(serviceId, domain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }
|
||||
traefik.http.services = { ...traefik.http.services, ...generateServices(serviceId, oneService, port) }
|
||||
}
|
||||
} else {
|
||||
if (found.services[oneService].ports && found.services[oneService].ports.length > 0) {
|
||||
@@ -441,9 +443,9 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote
|
||||
const isWWW = fqdn.includes('www.');
|
||||
const pathPrefix = '/'
|
||||
const isCustomSSL = false
|
||||
|
||||
traefik.http.routers = { ...traefik.http.routers, ...generateRouters(`${id}-${port || 'default'}`, domain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }
|
||||
traefik.http.services = { ...traefik.http.services, ...generateServices(id, id, port) }
|
||||
const serviceId = `${oneService}-${port || 'default'}`
|
||||
traefik.http.routers = { ...traefik.http.routers, ...generateRouters(serviceId, domain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }
|
||||
traefik.http.services = { ...traefik.http.services, ...generateServices(serviceId, id, port) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -466,9 +468,9 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote
|
||||
const port = 3000
|
||||
const pathPrefix = '/'
|
||||
const isCustomSSL = false
|
||||
|
||||
traefik.http.routers = { ...traefik.http.routers, ...generateRouters(`${id}-${port || 'default'}`, domain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }
|
||||
traefik.http.services = { ...traefik.http.services, ...generateServices(id, container, port) }
|
||||
const serviceId = `${id}-${port || 'default'}`
|
||||
traefik.http.routers = { ...traefik.http.routers, ...generateRouters(serviceId, domain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }
|
||||
traefik.http.services = { ...traefik.http.services, ...generateServices(serviceId, container, port) }
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -79,9 +79,7 @@
|
||||
$isDeploymentEnabled = checkIfDeploymentEnabledServices($appSession.isAdmin, service);
|
||||
|
||||
let statusInterval: any;
|
||||
let loading = {
|
||||
refreshTemplates: false
|
||||
};
|
||||
|
||||
|
||||
async function deleteService() {
|
||||
const sure = confirm($t('application.confirm_to_delete', { name: service.name }));
|
||||
@@ -106,20 +104,6 @@
|
||||
await startService();
|
||||
}
|
||||
}
|
||||
async function refreshTemplate() {
|
||||
try {
|
||||
loading.refreshTemplates = true;
|
||||
await post(`/internal/refreshTemplates`, {});
|
||||
addToast({
|
||||
message: 'Services refreshed.',
|
||||
type: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
return errorNotification(error);
|
||||
} finally {
|
||||
loading.refreshTemplates = false;
|
||||
}
|
||||
}
|
||||
async function stopService(skip = false) {
|
||||
if (skip) {
|
||||
$status.service.initialLoading = true;
|
||||
@@ -278,14 +262,6 @@
|
||||
Delete Service
|
||||
</button>
|
||||
{/if}
|
||||
{#if $page.url.pathname === `/services/${id}/configuration/type` && dev}
|
||||
<button
|
||||
disabled={loading.refreshTemplates}
|
||||
class:loading={loading.refreshTemplates}
|
||||
class="btn btn-sm btn-primary text-sm"
|
||||
on:click={refreshTemplate}>Refresh Services List</button
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
</nav>
|
||||
<div
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
</div>
|
||||
<div class=" lg:pt-20 lg:p-0 px-8 pt-20">
|
||||
<div class="grid grid-flow-rows grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8">
|
||||
{#each sortMe(filteredServices) as service}
|
||||
{#each sortMe(filteredServices).filter(s=> !s.ignore) as service}
|
||||
{#key service.name}
|
||||
<button
|
||||
on:click={() => handleSubmit(service)}
|
||||
|
||||
21
docs/contribution/GettingStarted.md
Normal file
21
docs/contribution/GettingStarted.md
Normal file
@@ -0,0 +1,21 @@
|
||||
## Getting Started
|
||||
|
||||
To contribute to `Coolify` development, you'll benefit from knowing the following:
|
||||
|
||||
- **Languages**
|
||||
- [Node.js]() - 📚 [Introduction](https://nodejs.dev/en/learn/introduction-to-nodejs/)
|
||||
- Javascript - 📚 [Learn Javascript](https://learnjavascript.online/)
|
||||
- Typescript - 📚 [Learn@FreecodeCamp](https://www.freecodecamp.org/news/learn-typescript-beginners-guide/)
|
||||
|
||||
- **Framework JS/TS**
|
||||
- [SvelteKit](https://kit.svelte.dev/) - 📚 [Tutorial](https://svelte.dev/tutorial/basics)
|
||||
- [Fastify](https://www.fastify.io/)
|
||||
|
||||
- **Database ORM**
|
||||
- [Prisma.io](https://www.prisma.io/) - 📚 [Quickstart](https://www.prisma.io/docs/getting-started/quickstart)
|
||||
|
||||
- **Docker**
|
||||
- [Docker Engine API](https://docs.docker.com/engine/api/)
|
||||
|
||||
## How to add a new service?
|
||||
You can find all details [here](https://github.com/coollabsio/coolify-community-templates)
|
||||
10
docs/dev_setup/Container.md
Normal file
10
docs/dev_setup/Container.md
Normal file
@@ -0,0 +1,10 @@
|
||||
### Container based development flow (recommended and the easiest)
|
||||
|
||||
All you need is to
|
||||
|
||||
1. Install [Docker Engine 20.11+](https://docs.docker.com/engine/install/) on your local machine
|
||||
2. Run `pnpm dev:container`.
|
||||
|
||||
It will build the base image for Coolify and start the development server inside Docker.
|
||||
|
||||
All required ports (3000, 3001) will be exposed to your host.
|
||||
2
docs/dev_setup/DockerContiner.md
Normal file
2
docs/dev_setup/DockerContiner.md
Normal file
@@ -0,0 +1,2 @@
|
||||
### Inside a Docker container
|
||||
# `WIP`
|
||||
19
docs/dev_setup/GitPod.md
Normal file
19
docs/dev_setup/GitPod.md
Normal file
@@ -0,0 +1,19 @@
|
||||
### Gitpod
|
||||
|
||||
#### Option 1 - Prefered:
|
||||
|
||||
Follow the same steps as [container based development flow](./Container.md)
|
||||
|
||||
#### Option 2 - Manual setup:
|
||||
|
||||
1. Create a workspace from this repository,
|
||||
1. run `pnpm install && pnpm db:push && pnpm db:seed`
|
||||
1. and then `pnpm dev`.
|
||||
|
||||
All the required dependencies and packages has been configured for you already.
|
||||
|
||||
---
|
||||
|
||||
> Some packages, just `pack` are not installed in this way.
|
||||
You cannot test all the features.
|
||||
Please use the [container based development flow](./Container.md).
|
||||
8
docs/dev_setup/GithubCodespaces.md
Normal file
8
docs/dev_setup/GithubCodespaces.md
Normal file
@@ -0,0 +1,8 @@
|
||||
### Github codespaces
|
||||
|
||||
If you have github codespaces enabled then you can just:
|
||||
|
||||
1. create a codespace and
|
||||
2. run `pnpm dev` to run your the dev environment.
|
||||
|
||||
All the required dependencies and packages has been configured for you already.
|
||||
17
docs/dev_setup/LocalMachine.md
Normal file
17
docs/dev_setup/LocalMachine.md
Normal file
@@ -0,0 +1,17 @@
|
||||
### Local Machine
|
||||
|
||||
At the moment, Coolify `doesn't support Windows`.
|
||||
|
||||
You must use `Linux` or `MacOS` or consider using Gitpod or Github Codespaces.
|
||||
|
||||
Install all the prerequisites manually to your host system.
|
||||
If you would not like to install anything,
|
||||
I suggest to use the [container based development flow](#container-based-development-flow-easiest).
|
||||
|
||||
- Due to the lock file, this repository is best with [pnpm](https://pnpm.io). I recommend you try and use `pnpm` because it is cool and efficient!
|
||||
- You need to have [Docker Engine](https://docs.docker.com/engine/install/) installed locally.
|
||||
- You need to have [Docker Compose Plugin](https://docs.docker.com/compose/install/compose-plugin/) installed locally.
|
||||
- You need to have [GIT LFS Support](https://git-lfs.github.com/) installed locally.
|
||||
|
||||
Optional:
|
||||
- To test Heroku buildpacks, you need [pack](https://github.com/buildpacks/pack) binary installed locally.
|
||||
2
docs/dev_setup/Mac.md
Normal file
2
docs/dev_setup/Mac.md
Normal file
@@ -0,0 +1,2 @@
|
||||
### Mac Setup
|
||||
|
||||
1
docs/dev_setup/MacArm.md
Normal file
1
docs/dev_setup/MacArm.md
Normal file
@@ -0,0 +1 @@
|
||||
### Mac Setup
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "coolify",
|
||||
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
||||
"version": "3.11.0",
|
||||
"version": "3.11.2",
|
||||
"license": "Apache-2.0",
|
||||
"repository": "github:coollabsio/coolify",
|
||||
"scripts": {
|
||||
@@ -25,7 +25,7 @@
|
||||
"build:api": "NODE_ENV=production pnpm run --filter api build",
|
||||
"build:ui": "NODE_ENV=production pnpm run --filter ui build",
|
||||
"dockerlogin": "echo $DOCKER_PASS | docker login --username=$DOCKER_USER --password-stdin",
|
||||
"release:staging:amd": "cross-var docker buildx build --platform linux/amd64 -t coollabsio/coolify:$npm_package_version --push .",
|
||||
"release:staging:amd": "docker build -t coollabsio/coolify:next . && docker push coollabsio/coolify:next",
|
||||
"release:local": "rm -fr ./local-serve && mkdir ./local-serve && pnpm build && cp -Rp apps/api/build/* ./local-serve && cp -Rp apps/ui/build/ ./local-serve/public && cp -Rp apps/api/prisma/ ./local-serve/prisma && cp -Rp apps/api/package.json ./local-serve && env | grep '^COOLIFY_' > ./local-serve/.env && cd ./local-serve && pnpm install . && pnpm start"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Reference in New Issue
Block a user