Skip to content

Commit 1b116bd

Browse files
Merge pull request #252 from Cinzya/saas-traefikv3
Traefik v3 example for SaaS configuration
2 parents 871f68b + 4304fbf commit 1b116bd

File tree

5 files changed

+49
-18
lines changed

5 files changed

+49
-18
lines changed

bun.lockb

447 Bytes
Binary file not shown.

docs/.vitepress/config.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import spec from '../public/openapi.json' with { type: 'json' }
77
import container from 'markdown-it-container'
88
import { bundledLanguages } from 'shiki'
99
import { join, dirname } from 'node:path'
10+
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
1011

1112
const sidebar = useSidebar({ spec, collapsible: true })
1213

@@ -585,6 +586,7 @@ export default defineConfig({
585586
}
586587
}
587588
})
589+
md.use(tabsMarkdownPlugin)
588590
},
589591
theme: {
590592
light: 'github-light',

docs/.vitepress/theme/index.ts

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import "./scrollbar.css";
1818
import "./tailwind.postcss";
1919
import "vitepress-openapi/dist/style.css";
2020

21+
// Import plugins
22+
import { enhanceAppWithTabs } from "vitepress-plugin-tabs/client";
23+
2124
// @ts-ignore
2225
import spec from "../../public/openapi.json" assert { type: "json" };
2326

@@ -40,13 +43,15 @@ export default {
4043
extends: DefaultTheme,
4144
Layout: Landing,
4245
enhanceApp({ app, router, siteData }) {
46+
enhanceAppWithTabs(app);
47+
4348
const openapi = useOpenapi({
4449
spec,
4550
base: "/docs/api-reference/api/operations/",
4651
label: "API",
4752
});
4853

49-
theme.enhanceApp({ app, openapi })
54+
theme.enhanceApp({ app, openapi });
5055
app.component("Card", Card);
5156
app.component("CardGroup", CardGroup);
5257
app.component("LandingSection", Sections);
@@ -60,21 +65,25 @@ export default {
6065
app.component("Browser", Browser);
6166

6267
router.onAfterRouteChange = () => {
63-
if (typeof window !== 'undefined' && (window as any).plausible) {
64-
(window as any).plausible('pageview')
68+
if (typeof window !== "undefined" && (window as any).plausible) {
69+
(window as any).plausible("pageview");
6570
}
66-
}
67-
app.directive('plausible', {
71+
};
72+
app.directive("plausible", {
6873
mounted(el: HTMLElement, binding: DirectiveBinding) {
69-
const eventName = binding.arg
70-
const eventData = binding.value || {}
74+
const eventName = binding.arg;
75+
const eventData = binding.value || {};
7176

72-
el.addEventListener('click', () => {
73-
if (typeof window !== 'undefined' && (window as any).plausible && eventName) {
74-
(window as any).plausible(eventName, { props: eventData })
77+
el.addEventListener("click", () => {
78+
if (
79+
typeof window !== "undefined" &&
80+
(window as any).plausible &&
81+
eventName
82+
) {
83+
(window as any).plausible(eventName, { props: eventData });
7584
}
76-
})
77-
}
78-
})
85+
});
86+
},
87+
});
7988
},
8089
} satisfies Theme;

docs/knowledge-base/proxy/traefik/wildcard-certs.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,14 @@ description: "A guide to configure wildcard subdomain redirects (with Traefik wi
1414
::: tip Tip
1515
Each provider needs environment variables to be set in the Traefik configuration. You can find the required variables in the [official documentation](https://doc.traefik.io/traefik/https/acme/#providers).
1616

17-
1817
If you need fine-grained token, like with [Cloudflare](https://go-acme.github.io/lego/dns/cloudflare/), check the provider configurations.
1918
:::
2019

21-
2220
## Configuration
2321

2422
1. Setup your wildcard subdomain DNS records, `*.coolify.io`.
2523
2. Go to your Proxy settings (Servers / Proxy menu) and add the following configuration based on your [providers](https://doc.traefik.io/traefik/https/acme/#providers). The example will use `Hetzner` as a provider.
2624

27-
2825
```bash
2926
version: '3.8'
3027
networks:
@@ -120,6 +117,26 @@ Redirect all subdomains to one application. You can use this option if you want
120117
- In your application, leave the FQDN configuration `empty`.
121118
- Add the following custom label configuration:
122119

120+
:::tabs key:saas
121+
== Traefik v3
122+
123+
```bash
124+
traefik.enable=true
125+
traefik.http.routers.<unique_router_name_https>.rule=HostRegexp(`^.+\.coolify\.io$`)
126+
traefik.http.routers.<unique_router_name_https>.entryPoints=https
127+
traefik.http.routers.<unique_router_name_https>.middlewares=gzip
128+
traefik.http.routers.<unique_router_name_https>.service=<unique_service_name>
129+
traefik.http.routers.<unique_router_name_https>.tls.certresolver=letsencrypt
130+
traefik.http.services.<unique_service_name>.loadbalancer.server.port=80
131+
traefik.http.routers.<unique_router_name_https>.tls=true
132+
133+
traefik.http.routers.<unique_router_name_http>.rule=HostRegexp(`^.+\.coolify\.io$`)
134+
traefik.http.routers.<unique_router_name_http>.entryPoints=http
135+
traefik.http.routers.<unique_router_name_http>.middlewares=redirect-to-https
136+
```
137+
138+
== Traefik v2
139+
123140
```bash
124141
traefik.enable=true
125142
traefik.http.routers.<unique_router_name_https>.rule=HostRegexp(`{subdomain:[a-zA-Z0-9-]+}.coolify.io`)
@@ -135,11 +152,13 @@ traefik.http.routers.<unique_router_name_http>.entryPoints=http
135152
traefik.http.routers.<unique_router_name_http>.middlewares=redirect-to-https
136153
```
137154

155+
:::
156+
138157
> `traefik.http.routers.<unique_router_name_https>.tls.certresolver` should be the same as your `certresolver` name in Traefik proxy configuration, by default `letsencrypt`.
139158
140159
> `traefik.http.services.<unique_service_name>.loadbalancer.server.port` should be the same as your application listens on. Port 80 if you use a static deployment.
141160
142161
::: warning Caution
143-
You cannot use both configurations (Normal & SaaS) at the same time on one
144-
server.
162+
You cannot use both configurations (Normal & SaaS) at the same time on one
163+
server.
145164
:::

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"vite-plugin-llms": "^1.0.2",
1515
"vite-plugin-yaml": "^1.0.5",
1616
"vitepress": "1.6.3",
17+
"vitepress-plugin-tabs": "^0.6.0",
1718
"vue": "^3.5.13"
1819
},
1920
"postcss": {

0 commit comments

Comments
 (0)