feat: use LOCAL_DOMAIN for dashboard

This commit is contained in:
Nicolas Meienberger 2023-06-06 21:19:56 +02:00 committed by Nicolas Meienberger
parent 5ace027f97
commit ebc6007209
5 changed files with 59 additions and 3 deletions

View file

@ -1,6 +1,22 @@
version: '3.7'
services:
reverse-proxy:
container_name: reverse-proxy
image: traefik:v2.8
restart: on-failure
ports:
- 80:80
- 443:443
- 8080:8080
command: --providers.docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ${PWD}/traefik:/root/.config
- ${PWD}/traefik/shared:/shared
networks:
- tipi_main_network
tipi-db:
container_name: tipi-db
image: postgres:14
@ -78,6 +94,21 @@ services:
- ${PWD}/apps:/runtipi/apps
- ${PWD}/logs:/app/logs
- ${STORAGE_PATH}:/app/storage
labels:
traefik.enable: true
# Local domain
traefik.http.routers.dashboard-local-insecure.rule: Host(`${LOCAL_DOMAIN}`)
traefik.http.routers.dashboard-local-insecure.entrypoints: web
traefik.http.routers.dashboard-local-insecure.service: dashboard-local-insecure
traefik.http.middlewares.redirect-to-https.redirectscheme.scheme: https
traefik.http.services.dashboard-local-insecure.loadbalancer.server.port: 3000
traefik.http.routers.dashboard-local-insecure.middlewares: redirect-to-https
# secure
traefik.http.routers.dashboard-local.rule: Host(`${LOCAL_DOMAIN}`)
traefik.http.routers.dashboard-local.entrypoints: websecure
traefik.http.routers.dashboard-local.tls: true
traefik.http.routers.dashboard-local.service: dashboard-local
traefik.http.services.dashboard-local.loadbalancer.server.port: 3000
networks:
tipi_main_network:

View file

@ -89,6 +89,19 @@ services:
traefik.http.routers.dashboard.service: dashboard
traefik.http.routers.dashboard.entrypoints: web
traefik.http.services.dashboard.loadbalancer.server.port: 3000
# Local domain
traefik.http.routers.dashboard-local-insecure.rule: Host(`${LOCAL_DOMAIN}`)
traefik.http.routers.dashboard-local-insecure.entrypoints: web
traefik.http.routers.dashboard-local-insecure.service: dashboard-local-insecure
traefik.http.middlewares.redirect-to-https.redirectscheme.scheme: https
traefik.http.services.dashboard-local-insecure.loadbalancer.server.port: 3000
traefik.http.routers.dashboard-local-insecure.middlewares: redirect-to-https
traefik.http.routers.dashboard-local.rule: Host(`${LOCAL_DOMAIN}`)
traefik.http.routers.dashboard-local.entrypoints: websecure
traefik.http.routers.dashboard-local.redirectregex.regex: ^https://(.*)$
traefik.http.routers.dashboard-local.tls: true
traefik.http.routers.dashboard-local.service: dashboard-local
traefik.http.services.dashboard-local.loadbalancer.server.port: 3000
networks:
tipi_main_network:

View file

@ -96,6 +96,18 @@ services:
traefik.http.routers.dashboard-secure.entrypoints: websecure
traefik.http.routers.dashboard-secure.tls.certresolver: myresolver
traefik.http.services.dashboard-secure.loadbalancer.server.port: 3000
# Local domain
traefik.http.routers.dashboard-local-insecure.rule: Host(`${LOCAL_DOMAIN}`)
traefik.http.routers.dashboard-local-insecure.entrypoints: web
traefik.http.routers.dashboard-local-insecure.service: dashboard-local-insecure
traefik.http.middlewares.redirect-to-https.redirectscheme.scheme: https
traefik.http.services.dashboard-local-insecure.loadbalancer.server.port: 3000
traefik.http.routers.dashboard-local-insecure.middlewares: redirect-to-https
traefik.http.routers.dashboard-local.rule: Host(`${LOCAL_DOMAIN}`)
traefik.http.routers.dashboard-local.entrypoints: websecure
traefik.http.routers.dashboard-local.tls: true
traefik.http.routers.dashboard-local.service: dashboard-local
traefik.http.services.dashboard-local.loadbalancer.server.port: 3000
networks:
tipi_main_network:

View file

@ -100,7 +100,7 @@ export const SettingsForm = (props: IProps) => {
</div>
<p className="mb-4">{t('subtitle')}</p>
<div className="mb-3">
<Input {...register('domain')} label={t('domain-name')} error={errors.domain?.message} placeholder="tipi.localhost" />
<Input {...register('domain')} label={t('domain-name')} error={errors.domain?.message} placeholder="example.com" />
<span className="text-muted">{t('domain-name-hint')}</span>
</div>
<div className="mb-3">

View file

@ -179,7 +179,7 @@ export const generateEnvFile = (app: App) => {
}
const baseEnvFile = readFile('/runtipi/.env').toString();
let envFile = `${baseEnvFile}\nAPP_PORT=${parsedConfig.data.port}\n`;
let envFile = `${baseEnvFile}\nAPP_PORT=${parsedConfig.data.port}\nAPP_ID=${app.id}\n`;
const envMap = getEnvMap(app.id);
if (parsedConfig.data.generate_vapid_keys) {
@ -330,7 +330,7 @@ export const getAppInfo = (id: string, status?: App['status']) => {
* If the app folder does not exist, it copies the app folder from the apps repository.
*
* @param {string} appName - The name of the app.
* @param {boolean} [cleanup=false] - A flag indicating whether to cleanup the app folder before ensuring its existence.
* @param {boolean} [cleanup] - A flag indicating whether to cleanup the app folder before ensuring its existence.
* @throws Will throw an error if the app folder cannot be copied from the repository
*/
export const ensureAppFolder = (appName: string, cleanup = false): void => {