An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Merge remote-tracking branch 'upstream/next' into feature/glitchtip-service
Guillaume Bonnet2962aa6166ff
diff --cc README.mdindex e7a6175da3,475d00d1d6..afa8eca48c--- a/README.md+++ b/README.md@@@ -129,11 -92,7 +92,8 @@@ Deploy your resource to- [Umami](https://github.com/mikecao/umami)- [Fider](https://fider.io)- [Hasura](https://hasura.io)+- [GlitchTip](https://glitchtip.com)-- If you have a new service you would like to add, raise an idea [here](https://feedback.coolify.io/) to get feedback from the community!-## Migration from v1A fresh installation is necessary. v2 and v3 are not compatible with v1.diff --cc apps/api/src/routes/api/v1/services/handlers.tsindex 259aad6e43,bfd8a9352f..d5b5893bf2--- a/apps/api/src/routes/api/v1/services/handlers.ts+++ b/apps/api/src/routes/api/v1/services/handlers.ts@@@ -602,59 -598,54 +601,57 @@@ export async function startService(requ}export async function stopService(request: FastifyRequest<ServiceStartStop>) {try {- const { type } = request.params- if (type === 'plausibleanalytics') {- return await stopPlausibleAnalyticsService(request)- }- if (type === 'nocodb') {- return await stopNocodbService(request)- }- if (type === 'minio') {- return await stopMinioService(request)- }- if (type === 'vscodeserver') {- return await stopVscodeService(request)- }- if (type === 'wordpress') {- return await stopWordpressService(request)- }- if (type === 'vaultwarden') {- return await stopVaultwardenService(request)- }- if (type === 'languagetool') {- return await stopLanguageToolService(request)- }- if (type === 'n8n') {- return await stopN8nService(request)- }- if (type === 'uptimekuma') {- return await stopUptimekumaService(request)- }- if (type === 'ghost') {- return await stopGhostService(request)- }- if (type === 'meilisearch') {- return await stopMeilisearchService(request)- }- if (type === 'umami') {- return await stopUmamiService(request)- }- if (type === 'hasura') {- return await stopHasuraService(request)- }- if (type === 'fider') {- return await stopFiderService(request)- }- if (type === 'appwrite') {- return await stopAppWriteService(request)- }- if (type === 'moodle') {- return await stopMoodleService(request)- }- if (type === 'glitchTip') {- return await stopGlitchTipService(request)- }- throw `Service type ${type} not supported.`+ return await stopServiceContainers(request)+ // const { type } = request.params+ // if (type === 'plausibleanalytics') {+ // return await stopPlausibleAnalyticsService(request)+ // }+ // if (type === 'nocodb') {+ // return await stopNocodbService(request)+ // }+ // if (type === 'minio') {+ // return await stopMinioService(request)+ // }+ // if (type === 'vscodeserver') {+ // return await stopVscodeService(request)+ // }+ // if (type === 'wordpress') {+ // return await stopWordpressService(request)+ // }+ // if (type === 'vaultwarden') {+ // return await stopVaultwardenService(request)+ // }+ // if (type === 'languagetool') {+ // return await stopLanguageToolService(request)+ // }+ // if (type === 'n8n') {+ // return await stopN8nService(request)+ // }+ // if (type === 'uptimekuma') {+ // return await stopUptimekumaService(request)+ // }+ // if (type === 'ghost') {+ // return await stopGhostService(request)+ // }+ // if (type === 'meilisearch') {+ // return await stopMeilisearchService(request)+ // }+ // if (type === 'umami') {+ // return await stopUmamiService(request)+ // }+ // if (type === 'hasura') {+ // return await stopHasuraService(request)+ // }+ // if (type === 'fider') {+ // return await stopFiderService(request)+ // }+ // if (type === 'moodle') {+ // return await stopMoodleService(request)+ // }++ // if (type === 'glitchTip') {++ // return await stopGlitchTipService(request)++ // }+ // throw `Service type ${type} not supported.`} catch (error) {throw { status: 500, message: error?.message || error }}@@@ -3115,281 -2570,6 +2576,252 @@@ async function startMoodleService(requereturn {}} catch ({ status, message }) {+ return errorHandler({ status, message })+ }+}- async function stopMoodleService(request: FastifyRequest<ServiceStartStop>) {- try {- const { id } = request.params;- const teamId = request.user.teamId;- const service = await getServiceFromDB({ id, teamId });- const { destinationDockerId, destinationDocker } = service;- if (destinationDockerId) {- try {- const found = await checkContainer({ dockerId: destinationDocker.id, container: id });- if (found) {- await removeContainer({ id, dockerId: destinationDocker.id });- }- } catch (error) {- console.error(error);- }- try {- const found = await checkContainer({ dockerId: destinationDocker.id, container: `${id}-mariadb` });- if (found) {- await removeContainer({ id: `${id}-mariadb`, dockerId: destinationDocker.id });- }- } catch (error) {- console.error(error);- }- }- return {}- } catch ({ status, message }) {- return errorHandler({ status, message })- }- }++async function startGlitchTipService(request: FastifyRequest<ServiceStartStop>) {+ try {+ const { id } = request.params;+ const teamId = request.user.teamId;+ const service = await getServiceFromDB({ id, teamId });+ const {+ type,+ version,+ fqdn,+ destinationDockerId,+ destinationDocker,+ serviceSecret,+ persistentStorage,+ exposePort,+ glitchTip: {+ postgresqlDatabase,+ postgresqlPassword,+ postgresqlUser,+ secretKeyBase,+ defaultEmail,+ defaultUsername,+ defaultPassword,+ defaultFromEmail,+ emailSmtpHost,+ emailSmtpPort,+ emailSmtpUser,+ emailSmtpPassword,+ emailSmtpUseTls,+ emailSmtpUseSsl,+ emailBackend,+ mailgunApiKey,+ sendgridApiKey,+ enableOpenUserRegistration,+ }+ } = service;+ const network = destinationDockerId && destinationDocker.network;+ const port = getServiceMainPort('glitchTip');++ const { workdir } = await createDirectories({ repository: type, buildId: id });+ const image = getServiceImage(type);++ const config = {+ glitchTip: {+ image: `${image}:${version}`,+ environmentVariables: {+ PORT: port,+ GLITCHTIP_DOMAIN: fqdn,+ SECRET_KEY: secretKeyBase,+ DATABASE_URL: `postgresql://${postgresqlUser}:${postgresqlPassword}@${id}-postgresql:5432/${postgresqlDatabase}`,+ REDIS_URL: `redis://${id}-redis:6379/0`,+ DEFAULT_FROM_EMAIL: defaultFromEmail,+ EMAIL_HOST: emailSmtpHost,+ EMAIL_PORT: emailSmtpPort,+ EMAIL_HOST_USER: emailSmtpUser,+ EMAIL_HOST_PASSWORD: emailSmtpPassword,+ EMAIL_USE_TLS: emailSmtpUseTls,+ EMAIL_USE_SSL: emailSmtpUseSsl,+ EMAIL_BACKEND: emailBackend,+ MAILGUN_API_KEY: mailgunApiKey,+ SENDGRID_API_KEY: sendgridApiKey,+ ENABLE_OPEN_USER_REGISTRATION: enableOpenUserRegistration,+ DJANGO_SUPERUSER_EMAIL: defaultEmail,+ DJANGO_SUPERUSER_USERNAME: defaultUsername,+ DJANGO_SUPERUSER_PASSWORD: defaultPassword,+ }+ },+ postgresql: {+ image: 'postgres:14-alpine',+ volume: `${id}-postgresql-data:/var/lib/postgresql/data`,+ environmentVariables: {+ POSTGRES_USER: postgresqlUser,+ POSTGRES_PASSWORD: postgresqlPassword,+ POSTGRES_DB: postgresqlDatabase+ }+ },+ redis: {+ image: 'redis:7-alpine',+ volume: `${id}-redis-data:/data`,+ }+ };+ if (serviceSecret.length > 0) {+ serviceSecret.forEach((secret) => {+ config.glitchTip.environmentVariables[secret.name] = secret.value;+ });+ }+ const { volumes, volumeMounts } = persistentVolumes(id, persistentStorage, config.glitchTip)+ const composeFile: ComposeFile = {+ version: '3.8',+ services: {+ [id]: {+ container_name: id,+ image: config.glitchTip.image,+ environment: config.glitchTip.environmentVariables,+ networks: [network],+ volumes,+ restart: 'always',+ labels: makeLabelForServices('glitchTip'),+ ...(exposePort ? { ports: [`${exposePort}:${port}`] } : {}),+ deploy: {+ restart_policy: {+ condition: 'on-failure',+ delay: '5s',+ max_attempts: 3,+ window: '120s'+ }+ },+ depends_on: [`${id}-postgresql`, `${id}-redis`]+ },+ [`${id}-worker`]: {+ container_name: `${id}-worker`,+ image: config.glitchTip.image,+ command: './bin/run-celery-with-beat.sh',+ environment: config.glitchTip.environmentVariables,+ networks: [network],+ restart: 'always',+ deploy: {+ restart_policy: {+ condition: 'on-failure',+ delay: '5s',+ max_attempts: 3,+ window: '120s'+ }+ },+ depends_on: [`${id}-postgresql`, `${id}-redis`]+ },+ [`${id}-setup`]: {+ container_name: `${id}-setup`,+ image: config.glitchTip.image,+ command: 'sh -c "(./manage.py migrate || true) && (./manage.py createsuperuser --noinput || true)"',+ environment: config.glitchTip.environmentVariables,+ networks: [network],+ restart: "no",+ depends_on: [`${id}-postgresql`, `${id}-redis`]+ },+ [`${id}-postgresql`]: {+ image: config.postgresql.image,+ container_name: `${id}-postgresql`,+ environment: config.postgresql.environmentVariables,+ networks: [network],+ volumes: [config.postgresql.volume],+ restart: 'always',+ deploy: {+ restart_policy: {+ condition: 'on-failure',+ delay: '5s',+ max_attempts: 3,+ window: '120s'+ }+ }+ },+ [`${id}-redis`]: {+ image: config.redis.image,+ container_name: `${id}-redis`,+ networks: [network],+ volumes: [config.redis.volume],+ restart: 'always',+ deploy: {+ restart_policy: {+ condition: 'on-failure',+ delay: '5s',+ max_attempts: 3,+ window: '120s'+ }+ }+ }+ },+ networks: {+ [network]: {+ external: true+ }+ },+ volumes: {+ ...volumeMounts,+ [config.postgresql.volume.split(':')[0]]: {+ name: config.postgresql.volume.split(':')[0]+ },+ [config.redis.volume.split(':')[0]]: {+ name: config.redis.volume.split(':')[0]+ }+ }+ };+ const composeFileDestination = `${workdir}/docker-compose.yaml`;+ await fs.writeFile(composeFileDestination, yaml.dump(composeFile));++ await executeDockerCmd({ dockerId: destinationDocker.id, command: `docker compose -f ${composeFileDestination} pull` })+ await executeDockerCmd({ dockerId: destinationDocker.id, command: `docker compose -f ${composeFileDestination} up --build -d` })++ return {}+ } catch ({ status, message }) {+ return errorHandler({ status, message })+ }+}+async function stopGlitchTipService(request: FastifyRequest<ServiceStartStop>) {+ try {+ const { id } = request.params;+ const teamId = request.user.teamId;+ const service = await getServiceFromDB({ id, teamId });+ const { destinationDockerId, destinationDocker } = service;+ if (destinationDockerId) {+ try {+ const found = await checkContainer({ dockerId: destinationDocker.id, container: id });+ if (found) {+ await removeContainer({ id, dockerId: destinationDocker.id });+ }+ } catch (error) {+ console.error(error);+ }+ try {+ const found = await checkContainer({ dockerId: destinationDocker.id, container: `${id}-worker` });+ if (found) {+ await removeContainer({ id: `${id}-worker`, dockerId: destinationDocker.id });+ }+ } catch (error) {+ console.error(error);+ }+ try {+ const found = await checkContainer({ dockerId: destinationDocker.id, container: `${id}-setup` });+ if (found) {+ await removeContainer({ id: `${id}-setup`, dockerId: destinationDocker.id });+ }+ } catch (error) {+ console.error(error);+ }+ try {+ const found = await checkContainer({ dockerId: destinationDocker.id, container: `${id}-postgresql` });+ if (found) {+ await removeContainer({ id: `${id}-postgresql`, dockerId: destinationDocker.id });+ }+ } catch (error) {+ console.error(error);+ }+ try {+ const found = await checkContainer({ dockerId: destinationDocker.id, container: `${id}-redis` });+ if (found) {+ await removeContainer({ id: `${id}-redis`, dockerId: destinationDocker.id });+ }+ } catch (error) {+ console.error(error);+ }+ }+ return {}+ } catch ({ status, message }) {return errorHandler({ status, message })}}diff --cc apps/ui/src/lib/components/svg/services/ServiceIcons.svelteindex 856d7f7858,c5f537736b..fb89bf8984--- a/apps/ui/src/lib/components/svg/services/ServiceIcons.svelte+++ b/apps/ui/src/lib/components/svg/services/ServiceIcons.svelte@@@ -32,8 -32,8 +32,10 @@@<Icons.Hasura {isAbsolute} />{:else if type === 'fider'}<Icons.Fider {isAbsolute} />+ {:else if type === 'appwrite'}+ <Icons.Appwrite {isAbsolute} />{:else if type === 'moodle'}<Icons.Moodle {isAbsolute} />+{:else if type === 'glitchTip'}+ <Icons.GlitchTip {isAbsolute} />{/if}diff --cc apps/ui/src/lib/components/svg/services/index.tsindex 14a7bf05c0,1e47a5def0..30b37922a7--- a/apps/ui/src/lib/components/svg/services/index.ts+++ b/apps/ui/src/lib/components/svg/services/index.ts@@@ -1,18 -1,18 +1,18 @@@//@ts-nocheckexport { default as PlausibleAnalytics } from './PlausibleAnalytics.svelte';- export { default as NocoDb } from './NocoDB.svelte';- export { default as MinIo } from './MinIO.svelte';- export { default as VsCodeServer } from './VSCodeServer.svelte';- export { default as Wordpress } from './Wordpress.svelte';- export { default as VaultWarden } from './VaultWarden.svelte';- export { default as LanguageTool } from './LanguageTool.svelte';- export { default as N8n } from './N8n.svelte';- export { default as UptimeKuma } from './UptimeKuma.svelte';- export { default as Ghost } from './Ghost.svelte';- export { default as MeiliSearch } from './MeiliSearch.svelte';- export { default as Umami } from './Umami.svelte';- export { default as Hasura } from './Hasura.svelte';- export { default as Fider } from './Fider.svelte';- export { default as Appwrite } from './Moodle.svelte';- export { default as Moodle } from './Moodle.svelte';+ export { default as NocoDb } from './NocoDB.svelte';+ export { default as MinIo } from './MinIO.svelte';+ export { default as VsCodeServer } from './VSCodeServer.svelte';+ export { default as Wordpress } from './Wordpress.svelte';+ export { default as VaultWarden } from './VaultWarden.svelte';+ export { default as LanguageTool } from './LanguageTool.svelte';+ export { default as N8n } from './N8n.svelte';+ export { default as UptimeKuma } from './UptimeKuma.svelte';+ export { default as Ghost } from './Ghost.svelte';+ export { default as MeiliSearch } from './MeiliSearch.svelte';+ export { default as Umami } from './Umami.svelte';+ export { default as Hasura } from './Hasura.svelte';+ export { default as Fider } from './Fider.svelte';+ export { default as Appwrite } from './Appwrite.svelte';+ export { default as Moodle } from './Moodle.svelte';-+export { default as GlitchTip } from './GlitchTip.svelte';