Skip to content

Commit

Permalink
Merge pull request #200 from ciocan/feat/listmonk
Browse files Browse the repository at this point in the history
feat: listmonk template
  • Loading branch information
Siumauricio authored Jul 6, 2024
2 parents 3884dc9 + 295bd06 commit 675fbb7
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
Binary file added public/templates/listmonk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions templates/listmonk/docker-compose.yml
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
52 changes: 52 additions & 0 deletions templates/listmonk/index.ts
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,
};
}
14 changes: 14 additions & 0 deletions templates/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,20 @@ export const templates: TemplateData[] = [
tags: ['chat'],
load: () => import('./open-webui/index').then((m) => m.generate),
},
{
id: 'listmonk',
name: 'Listmonk',
version: 'v3.0.0',
description: 'High performance, self-hosted, newsletter and mailing list manager with a modern dashboard.',
logo: 'listmonk.png',
links: {
github: 'https://github.com/knadh/listmonk',
website: 'https://listmonk.app/',
docs: 'https://listmonk.app/docs/',
},
tags: ['email', 'newsletter', 'mailing-list'],
load: () => import('./listmonk/index').then((m) => m.generate),
},
{
id: 'doublezero',
name: 'Double Zero',
Expand Down

0 comments on commit 675fbb7

Please sign in to comment.