diff --git a/apps/dokploy/public/templates/shlink.svg b/apps/dokploy/public/templates/shlink.svg new file mode 100644 index 00000000..6253cd36 --- /dev/null +++ b/apps/dokploy/public/templates/shlink.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/apps/dokploy/templates/shlink/docker-compose.yml b/apps/dokploy/templates/shlink/docker-compose.yml new file mode 100644 index 00000000..53f48216 --- /dev/null +++ b/apps/dokploy/templates/shlink/docker-compose.yml @@ -0,0 +1,29 @@ +services: + shlink: + image: shlinkio/shlink:stable + environment: + - INITIAL_API_KEY=${INITIAL_API_KEY} + - DEFAULT_DOMAIN=${DEFAULT_DOMAIN} + # Note: you should also update SHLINK_SERVER_URL in the shlink-web service. + - IS_HTTPS_ENABLED=false + volumes: + - shlink-data:/etc/shlink/data + healthcheck: + test: ["CMD", "curl", "-f", "http://127.0.0.1:8080/rest/v3/health"] + interval: 30s + timeout: 10s + retries: 3 + shlink-web: + image: shlinkio/shlink-web-client + environment: + - SHLINK_SERVER_API_KEY=${INITIAL_API_KEY} + # Note: if you've set IS_HTTPS_ENABLED=true, change http to https. + - SHLINK_SERVER_URL=http://${DEFAULT_DOMAIN} + healthcheck: + test: ["CMD", "curl", "-f", "http://127.0.0.1:8080"] + interval: 30s + timeout: 10s + retries: 3 + +volumes: + shlink-data: \ No newline at end of file diff --git a/apps/dokploy/templates/shlink/index.ts b/apps/dokploy/templates/shlink/index.ts new file mode 100644 index 00000000..1e456e1c --- /dev/null +++ b/apps/dokploy/templates/shlink/index.ts @@ -0,0 +1,35 @@ +import { + type DomainSchema, + type Schema, + type Template, + generatePassword, + generateRandomDomain, +} from "../utils"; + +export function generate(schema: Schema): Template { + const defaultDomain = generateRandomDomain(schema); + const initialApiKey = generatePassword(30); + + const domains: DomainSchema[] = [ + { + host: `web-${defaultDomain}`, + port: 8080, + serviceName: "shlink-web", + }, + { + host: defaultDomain, + port: 8080, + serviceName: "shlink", + }, + ]; + + const envs = [ + `INITIAL_API_KEY=${initialApiKey}`, + `DEFAULT_DOMAIN=${defaultDomain}`, + ]; + + return { + envs, + domains, + }; +} diff --git a/apps/dokploy/templates/templates.ts b/apps/dokploy/templates/templates.ts index 7ba3829f..57698af3 100644 --- a/apps/dokploy/templates/templates.ts +++ b/apps/dokploy/templates/templates.ts @@ -1423,4 +1423,19 @@ export const templates: TemplateData[] = [ tags: ["q&a", "self-hosted"], load: () => import("./answer/index").then((m) => m.generate), }, + { + id: "shlink", + name: "Shlink", + version: "v1.4.1", + description: + "URL shortener that can be used to serve shortened URLs under your own domain.", + logo: "shlink.svg", + links: { + github: "https://github.com/shlinkio/shlink", + website: "https://shlink.io", + docs: "https://shlink.io/documentation", + }, + tags: ["sharing", "shortener", "url"], + load: () => import("./shlink/index").then((m) => m.generate), + }, ];