From c0876044b0c165c96ce6c7bb71b1b484c5c17639 Mon Sep 17 00:00:00 2001 From: DrMxrcy Date: Wed, 20 Nov 2024 09:43:32 -0500 Subject: [PATCH 1/3] feat(add): YOURLS Template --- apps/dokploy/public/templates/yourls.svg | 1 + apps/dokploy/templates/templates.ts | 14 ++++++ .../templates/yourls/docker-compose.yml | 43 +++++++++++++++++++ apps/dokploy/templates/yourls/index.ts | 35 +++++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 apps/dokploy/public/templates/yourls.svg create mode 100644 apps/dokploy/templates/yourls/docker-compose.yml create mode 100644 apps/dokploy/templates/yourls/index.ts diff --git a/apps/dokploy/public/templates/yourls.svg b/apps/dokploy/public/templates/yourls.svg new file mode 100644 index 00000000..2d1d7733 --- /dev/null +++ b/apps/dokploy/public/templates/yourls.svg @@ -0,0 +1 @@ + diff --git a/apps/dokploy/templates/templates.ts b/apps/dokploy/templates/templates.ts index 46806a8a..1ec09ad5 100644 --- a/apps/dokploy/templates/templates.ts +++ b/apps/dokploy/templates/templates.ts @@ -867,4 +867,18 @@ export const templates: TemplateData[] = [ tags: ["support", "chat", "customer-service"], load: () => import("./chatwoot/index").then((m) => m.generate), }, + { + id: "yourls", + name: "YOURLS", + version: "latest", + description: "YOURLS (Your Own URL Shortener) is a set of PHP scripts that will allow you to run your own URL shortening service (a la TinyURL or Bitly).", + logo: "yourls.svg", + links: { + github: "https://github.com/YOURLS/YOURLS", + website: "https://yourls.org/", + docs: "https://yourls.org/#documentation", + }, + tags: ["url-shortener", "php"], + load: () => import("./yourls/index").then((m) => m.generate), + }, ]; diff --git a/apps/dokploy/templates/yourls/docker-compose.yml b/apps/dokploy/templates/yourls/docker-compose.yml new file mode 100644 index 00000000..ad2fcd1c --- /dev/null +++ b/apps/dokploy/templates/yourls/docker-compose.yml @@ -0,0 +1,43 @@ +version: '3.7' + +services: + yourls-app: + image: yourls:latest + networks: + - dokploy-network + environment: + YOURLS_SITE: https://${YOURLS_HOST} + YOURLS_USER: ${YOURLS_ADMIN_USER} + YOURLS_PASS: ${YOURLS_ADMIN_PASSWORD} + YOURLS_DB_HOST: yourls-mysql + YOURLS_DB_USER: yourls + YOURLS_DB_PASS: ${MYSQL_PASSWORD} + YOURLS_DB_NAME: yourls + volumes: + - yourls-data:/var/www/html + depends_on: + yourls-mysql: + condition: service_healthy + restart: always + + yourls-mysql: + image: mysql:5.7 + networks: + - dokploy-network + environment: + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} + MYSQL_DATABASE: yourls + MYSQL_USER: yourls + MYSQL_PASSWORD: ${MYSQL_PASSWORD} + volumes: + - yourls-mysql-data:/var/lib/mysql + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u$$MYSQL_USER", "-p$$MYSQL_PASSWORD"] + interval: 10s + timeout: 5s + retries: 5 + restart: always + +volumes: + yourls-data: + yourls-mysql-data: \ No newline at end of file diff --git a/apps/dokploy/templates/yourls/index.ts b/apps/dokploy/templates/yourls/index.ts new file mode 100644 index 00000000..7a755b55 --- /dev/null +++ b/apps/dokploy/templates/yourls/index.ts @@ -0,0 +1,35 @@ +import { + type DomainSchema, + type Schema, + type Template, + generatePassword, + generateRandomDomain, +} from "../utils"; + +export function generate(schema: Schema): Template { + const mainDomain = generateRandomDomain(schema); + const mysqlPassword = generatePassword(); + const mysqlRootPassword = generatePassword(); + const adminPassword = generatePassword(); + + const domains: DomainSchema[] = [ + { + host: mainDomain, + port: 80, + serviceName: "yourls-app", + }, + ]; + + const envs = [ + `YOURLS_HOST=${mainDomain}`, + `YOURLS_ADMIN_USER=admin`, + `YOURLS_ADMIN_PASSWORD=${adminPassword}`, + `MYSQL_PASSWORD=${mysqlPassword}`, + `MYSQL_ROOT_PASSWORD=${mysqlRootPassword}`, + ]; + + return { + domains, + envs, + }; +} \ No newline at end of file From 065480482180d411174574cdd50a7dc7563a31c1 Mon Sep 17 00:00:00 2001 From: DrMxrcy Date: Wed, 20 Nov 2024 09:52:35 -0500 Subject: [PATCH 2/3] feat(fix): YOURLS lint --- apps/dokploy/templates/templates.ts | 3 +- apps/dokploy/templates/yourls/index.ts | 56 +++++++++++++------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/apps/dokploy/templates/templates.ts b/apps/dokploy/templates/templates.ts index 1ec09ad5..4419dcf2 100644 --- a/apps/dokploy/templates/templates.ts +++ b/apps/dokploy/templates/templates.ts @@ -871,7 +871,8 @@ export const templates: TemplateData[] = [ id: "yourls", name: "YOURLS", version: "latest", - description: "YOURLS (Your Own URL Shortener) is a set of PHP scripts that will allow you to run your own URL shortening service (a la TinyURL or Bitly).", + description: + "YOURLS (Your Own URL Shortener) is a set of PHP scripts that will allow you to run your own URL shortening service (a la TinyURL or Bitly).", logo: "yourls.svg", links: { github: "https://github.com/YOURLS/YOURLS", diff --git a/apps/dokploy/templates/yourls/index.ts b/apps/dokploy/templates/yourls/index.ts index 7a755b55..c96a2596 100644 --- a/apps/dokploy/templates/yourls/index.ts +++ b/apps/dokploy/templates/yourls/index.ts @@ -1,35 +1,35 @@ import { - type DomainSchema, - type Schema, - type Template, - generatePassword, - generateRandomDomain, + type DomainSchema, + type Schema, + type Template, + generatePassword, + generateRandomDomain, } from "../utils"; export function generate(schema: Schema): Template { - const mainDomain = generateRandomDomain(schema); - const mysqlPassword = generatePassword(); - const mysqlRootPassword = generatePassword(); - const adminPassword = generatePassword(); + const mainDomain = generateRandomDomain(schema); + const mysqlPassword = generatePassword(); + const mysqlRootPassword = generatePassword(); + const adminPassword = generatePassword(); - const domains: DomainSchema[] = [ - { - host: mainDomain, - port: 80, - serviceName: "yourls-app", - }, - ]; + const domains: DomainSchema[] = [ + { + host: mainDomain, + port: 80, + serviceName: "yourls-app", + }, + ]; - const envs = [ - `YOURLS_HOST=${mainDomain}`, - `YOURLS_ADMIN_USER=admin`, - `YOURLS_ADMIN_PASSWORD=${adminPassword}`, - `MYSQL_PASSWORD=${mysqlPassword}`, - `MYSQL_ROOT_PASSWORD=${mysqlRootPassword}`, - ]; + const envs = [ + `YOURLS_HOST=${mainDomain}`, + "YOURLS_ADMIN_USER=admin", + `YOURLS_ADMIN_PASSWORD=${adminPassword}`, + `MYSQL_PASSWORD=${mysqlPassword}`, + `MYSQL_ROOT_PASSWORD=${mysqlRootPassword}`, + ]; - return { - domains, - envs, - }; -} \ No newline at end of file + return { + domains, + envs, + }; +} From d1436c992ec6cef49cb3fb475d5a34bc7315d7c2 Mon Sep 17 00:00:00 2001 From: DrMxrcy Date: Wed, 20 Nov 2024 09:56:40 -0500 Subject: [PATCH 3/3] feat(fix): Define Version --- apps/dokploy/templates/templates.ts | 2 +- apps/dokploy/templates/yourls/docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/dokploy/templates/templates.ts b/apps/dokploy/templates/templates.ts index 4419dcf2..da24df9d 100644 --- a/apps/dokploy/templates/templates.ts +++ b/apps/dokploy/templates/templates.ts @@ -870,7 +870,7 @@ export const templates: TemplateData[] = [ { id: "yourls", name: "YOURLS", - version: "latest", + version: "1.9.2", description: "YOURLS (Your Own URL Shortener) is a set of PHP scripts that will allow you to run your own URL shortening service (a la TinyURL or Bitly).", logo: "yourls.svg", diff --git a/apps/dokploy/templates/yourls/docker-compose.yml b/apps/dokploy/templates/yourls/docker-compose.yml index ad2fcd1c..ff2e14d9 100644 --- a/apps/dokploy/templates/yourls/docker-compose.yml +++ b/apps/dokploy/templates/yourls/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.7' services: yourls-app: - image: yourls:latest + image: yourls:1.9.2 networks: - dokploy-network environment: