From 62fa37d7602e160b552cdde50f1ca6d8681ba89e Mon Sep 17 00:00:00 2001 From: Bryan Joshua Pedini Date: Mon, 19 Sep 2022 09:17:08 +0200 Subject: [PATCH] turned base into kuttit --- docker-compose.yml | 86 ++++++++++++++++++++++++++++++++++++++++++---- env.example | 62 ++++++++++++++++++++++++++++----- 2 files changed, 133 insertions(+), 15 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index cf8e041..7f91633 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,42 @@ --- services: - app: + kuttit: + image: kutt/kutt:${KUTTIT_VERSION} restart: unless-stopped + command: ["./wait-for-it.sh", "postgres:5432", "--", "npm", "start"] + depends_on: + - postgres + - redis + environment: + - PORT=${TRAEFIK_SERVICE_PORT} + - SITE_NAME=${KUTTIT_NAME} + - DEFAULT_DOMAIN=${KUTTIT_DOMAIN} + - LINK_LENGTH=${KUTTIT_LINK_LENGTH} + - DB_HOST=postgres + - DB_PORT=5432 + - DB_NAME=${POSTGRES_NAME} + - DB_USER=${POSTGRES_USER} + - DB_PASSWORD=${POSTGRES_PASS} + - DB_SSL=false + - REDIS_HOST=redis + - REDIS_PORT=6379 + - REDIS_PASSWORD=${REDIS_PASS} + - DISALLOW_REGISTRATION=${KUTTIT_DISABLE_REGISTRATION} + - DISALLOW_ANONYMOUS_LINKS=${KUTTIT_DISABLE_ANONYMOUS} + - USER_LIMIT_PER_DAY=${KUTTIT_DAILY_USER_LIMIT} + - NON_USER_COOLDOWN=${KUTTIT_NON_USER_COOLDOWN} + - DEFAULT_MAX_STATS_PER_LINK=${KUTTIT_LINK_STATS} + - CUSTOM_DOMAIN_USE_HTTPS=${KUTTIT_DOMAIN_HTTPS} + - JWT_SECRET=${KUTTIT_JWT_SECRET} + - ADMIN_EMAILS=${KUTTIT_ADMIN_EMAILS} + - MAIL_HOST=${KUTTIT_MAIL_HOST} + - MAIL_PORT=${KUTTIT_MAIL_PORT} + - MAIL_FROM=${KUTTIT_MAIL_FROM} + - MAIL_USER=${KUTTIT_MAIL_USER} + - MAIL_PASSWORD=${KUTTIT_MAIL_PASS} + - MAIL_SECURE=${KUTTIT_MAIL_SECURE} + - REPORT_EMAIL=${KUTTIT_REPORT_EMAIL} + - CONTACT_EMAIL=${KUTTIT_CONTACT_EMAIL} labels: ### Section Træfik - traefik.enable=${TRAEFIK_ENABLED} @@ -22,15 +57,54 @@ services: # specify a service so a custom port can be used - traefik.http.services.${TRAEFIK_SERVICE}.loadbalancer.server.port=${TRAEFIK_SERVICE_PORT} ### Section Diun - - diun.enable=${DIUN_ENABLE} - - diun.watch_repo=${DIUN_WATCHREPO} - - diun.sort_tags=${DIUN_SORTALGO} - - diun.include_tags=${DIUN_INCLUDE} - - diun.exclude_tags=${DIUN_EXCLUDE} + - diun.enable=${DIUN_KUTTIT_ENABLE} + - diun.watch_repo=${DIUN_KUTTIT_WATCHREPO} + - diun.sort_tags=${DIUN_KUTTIT_SORTALGO} + - diun.include_tags=${DIUN_KUTTIT_INCLUDE} + - diun.exclude_tags=${DIUN_KUTTIT_EXCLUDE} networks: + - internal - traefik + redis: + image: redis:${REDIS_VERSION} + restart: unless-stopped + command: --requirepass ${REDIS_PASS} + environment: + - REDIS_PASS=${REDIS_PASS} + labels: + ### Section Diun + - diun.enable=${DIUN_REDIS_ENABLE} + - diun.watch_repo=${DIUN_REDIS_WATCHREPO} + - diun.sort_tags=${DIUN_REDIS_SORTALGO} + - diun.include_tags=${DIUN_REDIS_INCLUDE} + - diun.exclude_tags=${DIUN_REDIS_EXCLUDE} + networks: + - internal + volumes: + - ${REDIS_DATA}:/data + + postgres: + image: postgres:${POSTGRES_VERSION} + restart: unless-stopped + environment: + - POSTGRES_DB=${POSTGRES_NAME} + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASS} + labels: + ### Section Diun + - diun.enable=${DIUN_POSTGRES_ENABLE} + - diun.watch_repo=${DIUN_POSTGRES_WATCHREPO} + - diun.sort_tags=${DIUN_POSTGRES_SORTALGO} + - diun.include_tags=${DIUN_POSTGRES_INCLUDE} + - diun.exclude_tags=${DIUN_POSTGRES_EXCLUDE} + networks: + - internal + volumes: + - ${POSTGRES_DATA}:/var/lib/postgresql/data + networks: + internal: traefik: external: true name: ${TRAEFIK_NETWORK} diff --git a/env.example b/env.example index 263f7aa..bd95aff 100644 --- a/env.example +++ b/env.example @@ -1,18 +1,62 @@ # Træfik TRAEFIK_ENABLED=true TRAEFIK_NETWORK=traefik -TRAEFIK_ROUTER=app_example_com -TRAEFIK_SERVICE=app_example_com -TRAEFIK_SERVICE_PORT=80 -TRAEFIK_MATCHRULE=Host(`app.example.com`) +TRAEFIK_ROUTER=kuttit_example_com +TRAEFIK_SERVICE=kuttit_example_com +TRAEFIK_SERVICE_PORT=3000 +TRAEFIK_MATCHRULE=Host(`kuttit.example.com`) TRAEFIK_TLSENABLED=true TRAEFIK_CERTRESOLVER=letsencrypt TRAEFIK_HTTP_MIDDLEWARES=http-to-https TRAEFIK_HTTPS_MIDDLEWARES=hsts # Diun -DIUN_ENABLE=true -DIUN_WATCHREPO=true -DIUN_SORTALGO=semver -DIUN_INCLUDE= -DIUN_EXCLUDE= +DIUN_KUTTIT_ENABLE=true +DIUN_KUTTIT_WATCHREPO=true +DIUN_KUTTIT_SORTALGO=semver +DIUN_KUTTIT_INCLUDE=v[0-9]\.[0-9]\.[0-9] +DIUN_KUTTIT_EXCLUDE=latest,develop +DIUN_REDIS_ENABLE=true +DIUN_REDIS_WATCHREPO=true +DIUN_REDIS_SORTALGO=semver +DIUN_REDIS_INCLUDE=[0-9]\.[0-9]\.[0-9]-alpine[0-9]\.[0-9] +DIUN_REDIS_EXCLUDE=latest +DIUN_POSTGRES_ENABLE=true +DIUN_POSTGRES_WATCHREPO=true +DIUN_POSTGRES_SORTALGO=semver +DIUN_POSTGRES_INCLUDE=[0-9]\.[0-9]-alpine[0-9]\.[0-9] +DIUN_POSTGRES_EXCLUDE=latest + +# KuttIt +KUTTIT_VERSION=v2.7.4 +KUTTIT_NAME=kuttit +KUTTIT_DOMAIN=kuttit.example.com +KUTTIT_LINK_LENGTH=6 +KUTTIT_DISABLE_REGISTRATION=true +KUTTIT_DISABLE_ANONYMOUS=true +KUTTIT_DAILY_USER_LIMIT=50 +KUTTIT_NON_USER_COOLDOWN=0 +KUTTIT_LINK_STATS=5000 +KUTTIT_DOMAIN_HTTPS=true +KUTTIT_JWT_SECRET=changeme +KUTTIT_ADMIN_EMAILS=admin@example.com +KUTTIT_MAIL_HOST=mail.example.com +KUTTIT_MAIL_PORT=465 +KUTTIT_MAIL_FROM="Kutt.it " +KUTTIT_MAIL_USER=kuttit@example.com +KUTTIT_MAIL_PASS=changeme +KUTTIT_MAIL_SECURE=true +KUTTIT_REPORT_EMAIL=admin@example.com +KUTTIT_CONTACT_EMAIL=info@example.com + +# Redis +REDIS_VERSION=7.0.4-alpine3.16 +REDIS_DATA=./data/postgres +REDIS_PASS=changeme + +# Postgres +POSTGRES_VERSION=14.5-alpine3.16 +POSTGRES_DATA=./data/postgres +POSTGRES_NAME=kuttit +POSTGRES_USER=kuttit +POSTGRES_PASS=changeme