Skip to content

Commit d37bde0

Browse files
authored
Merge pull request #1226 from nktnet1/shlink-template
feat(template): added shlink, a url shortener service
2 parents d43cd52 + 55fae23 commit d37bde0

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-0
lines changed
Lines changed: 8 additions & 0 deletions
Loading
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
services:
2+
shlink:
3+
image: shlinkio/shlink:stable
4+
environment:
5+
- INITIAL_API_KEY=${INITIAL_API_KEY}
6+
- DEFAULT_DOMAIN=${DEFAULT_DOMAIN}
7+
# Note: you should also update SHLINK_SERVER_URL in the shlink-web service.
8+
- IS_HTTPS_ENABLED=false
9+
volumes:
10+
- shlink-data:/etc/shlink/data
11+
healthcheck:
12+
test: ["CMD", "curl", "-f", "http://127.0.0.1:8080/rest/v3/health"]
13+
interval: 30s
14+
timeout: 10s
15+
retries: 3
16+
shlink-web:
17+
image: shlinkio/shlink-web-client
18+
environment:
19+
- SHLINK_SERVER_API_KEY=${INITIAL_API_KEY}
20+
# Note: if you've set IS_HTTPS_ENABLED=true, change http to https.
21+
- SHLINK_SERVER_URL=http://${DEFAULT_DOMAIN}
22+
healthcheck:
23+
test: ["CMD", "curl", "-f", "http://127.0.0.1:8080"]
24+
interval: 30s
25+
timeout: 10s
26+
retries: 3
27+
28+
volumes:
29+
shlink-data:
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import {
2+
type DomainSchema,
3+
type Schema,
4+
type Template,
5+
generatePassword,
6+
generateRandomDomain,
7+
} from "../utils";
8+
9+
export function generate(schema: Schema): Template {
10+
const defaultDomain = generateRandomDomain(schema);
11+
const initialApiKey = generatePassword(30);
12+
13+
const domains: DomainSchema[] = [
14+
{
15+
host: `web-${defaultDomain}`,
16+
port: 8080,
17+
serviceName: "shlink-web",
18+
},
19+
{
20+
host: defaultDomain,
21+
port: 8080,
22+
serviceName: "shlink",
23+
},
24+
];
25+
26+
const envs = [
27+
`INITIAL_API_KEY=${initialApiKey}`,
28+
`DEFAULT_DOMAIN=${defaultDomain}`,
29+
];
30+
31+
return {
32+
envs,
33+
domains,
34+
};
35+
}

apps/dokploy/templates/templates.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,4 +1423,19 @@ export const templates: TemplateData[] = [
14231423
tags: ["q&a", "self-hosted"],
14241424
load: () => import("./answer/index").then((m) => m.generate),
14251425
},
1426+
{
1427+
id: "shlink",
1428+
name: "Shlink",
1429+
version: "v1.4.1",
1430+
description:
1431+
"URL shortener that can be used to serve shortened URLs under your own domain.",
1432+
logo: "shlink.svg",
1433+
links: {
1434+
github: "https://github.com/shlinkio/shlink",
1435+
website: "https://shlink.io",
1436+
docs: "https://shlink.io/documentation",
1437+
},
1438+
tags: ["sharing", "shortener", "url"],
1439+
load: () => import("./shlink/index").then((m) => m.generate),
1440+
},
14261441
];

0 commit comments

Comments
 (0)