-
-
Notifications
You must be signed in to change notification settings - Fork 810
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1226 from nktnet1/shlink-template
feat(template): added shlink, a url shortener service
- Loading branch information
Showing
4 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters