-
-
Notifications
You must be signed in to change notification settings - Fork 825
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 #200 from ciocan/feat/listmonk
feat: listmonk template
- Loading branch information
Showing
4 changed files
with
122 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,56 @@ | ||
services: | ||
db: | ||
image: postgres:13 | ||
ports: | ||
- 5432 | ||
networks: | ||
- dokploy-network | ||
environment: | ||
- POSTGRES_PASSWORD=listmonk | ||
- POSTGRES_USER=listmonk | ||
- POSTGRES_DB=listmonk | ||
restart: unless-stopped | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U listmonk"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 6 | ||
volumes: | ||
- listmonk-data:/var/lib/postgresql/data | ||
|
||
setup: | ||
image: listmonk/listmonk:v3.0.0 | ||
networks: | ||
- dokploy-network | ||
volumes: | ||
- ./config.toml:/listmonk/config.toml | ||
depends_on: | ||
- db | ||
command: [sh, -c, "sleep 3 && ./listmonk --install --idempotent --yes --config config.toml"] | ||
|
||
app: | ||
restart: unless-stopped | ||
image: listmonk/listmonk:v3.0.0 | ||
ports: | ||
- "${LISTMONK_PORT}" | ||
networks: | ||
- dokploy-network | ||
environment: | ||
- TZ=Etc/UTC | ||
depends_on: | ||
- db | ||
- setup | ||
volumes: | ||
- ./config.toml:/listmonk/config.toml | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.routers.${HASH}.rule=Host(`${LISTMONK_HOST}`)" | ||
- "traefik.http.services.${HASH}.loadbalancer.server.port=${LISTMONK_PORT}" | ||
|
||
volumes: | ||
listmonk-data: | ||
driver: local | ||
|
||
networks: | ||
dokploy-network: | ||
external: true |
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,52 @@ | ||
import { | ||
generateHash, | ||
generateRandomDomain, | ||
type Template, | ||
type Schema, | ||
generatePassword, | ||
} from "../utils"; | ||
|
||
export function generate(schema: Schema): Template { | ||
const mainServiceHash = generateHash(schema.projectName); | ||
const randomDomain = generateRandomDomain(schema); | ||
const adminPassword = generatePassword(32); | ||
|
||
const envs = [ | ||
`LISTMONK_HOST=${randomDomain}`, | ||
"LISTMONK_PORT=9000", | ||
`HASH=${mainServiceHash}`, | ||
`# login with admin:${adminPassword}`, | ||
"# check config.toml in Advanced / Volumes for more options", | ||
]; | ||
|
||
const mounts: Template["mounts"] = [ | ||
{ | ||
mountPath: "./config.toml", | ||
content: `[app] | ||
address = "0.0.0.0:9000" | ||
admin_username = "admin" | ||
admin_password = "${adminPassword}" | ||
[db] | ||
host = "db" | ||
port = 5432 | ||
user = "listmonk" | ||
password = "listmonk" | ||
database = "listmonk" | ||
ssl_mode = "disable" | ||
max_open = 25 | ||
max_idle = 25 | ||
max_lifetime = "300s" | ||
params = "" | ||
`, | ||
}, | ||
]; | ||
|
||
return { | ||
envs, | ||
mounts, | ||
}; | ||
} |
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