<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Muhammet İkbal Yakupoglu on Medium]]></title>
        <description><![CDATA[Stories by Muhammet İkbal Yakupoglu on Medium]]></description>
        <link>https://medium.com/@myakupoglu?source=rss-3cfe97f9cd14------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ih5Eliz0bXkkYKQMEcLx1g.jpeg</url>
            <title>Stories by Muhammet İkbal Yakupoglu on Medium</title>
            <link>https://medium.com/@myakupoglu?source=rss-3cfe97f9cd14------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 12:29:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@myakupoglu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Kendi PaaS Altyapımızı Kuruyoruz (Bölüm 8): GitHub Actions, Tailscale ve Dokploy ile CI/CD…]]></title>
            <link>https://myakupoglu.medium.com/kendi-paas-altyap%C4%B1m%C4%B1z%C4%B1-kuruyoruz-b%C3%B6l%C3%BCm-8-github-actions-tailscale-ve-dokploy-ile-ci-cd-388186004c91?source=rss-3cfe97f9cd14------2</link>
            <guid isPermaLink="false">https://medium.com/p/388186004c91</guid>
            <category><![CDATA[dokploy]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[tailscale]]></category>
            <category><![CDATA[cicd]]></category>
            <dc:creator><![CDATA[Muhammet İkbal Yakupoglu]]></dc:creator>
            <pubDate>Thu, 02 Jul 2026 15:11:04 GMT</pubDate>
            <atom:updated>2026-07-02T15:11:04.339Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kendi PaaS Altyapımızı Kuruyoruz (Bölüm 8): GitHub Actions, Tailscale ve Dokploy ile CI/CD Otomasyonu</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N90ciC7f35gcDa7CDPjhiA.png" /></figure><p>Serimizin önceki bölümlerinde sunucumuzun temel güvenliğini sağladık, kimlik yönetimimizi yapılandırdık, sistem loglarımızı ve metriklerimizi merkezi bir ekranda toplayarak gözlemlenebilirliği (monitoring) çözdük ve son olarak veritabanlarımızı izole edip otomatik yedekleme kurgumuzu tamamladık.</p><p>Şu an güvenli ve stabil çalışan bir altyapımız var. Ancak bir PaaS ortamının geliştiriciye sunması gereken en büyük avantaj otomasyon rahatlığıdır. Kodumuzu yazıp GitHub’a git push komutunu gönderdiğimiz anda sürecin otomatikleşmesini ve kodun sunucuya gidip kesintisiz bir şekilde yayına alınmasını istiyoruz. Bu bölümde GitHub Actions kullanarak CI/CD sürecimizi kuracağız.</p><p>Normal şartlarda CI/CD süreçlerinde, repoya yeni kod geldiğinde GitHub sunucunuzdaki bir webhook adresine istek atarak dağıtım sürecini tetikler. Ancak bizim mimarimizde bir istisna var: Sunucumuzu dış erişime kapattığımız için Dokploy arayüzümüz ve webhook uç noktalarımız Tailscale ağımızda (100.x.x.x IP bloğunda) yer alıyor. Haliyle GitHub&#39;ın genel internetteki runner’ları bizim Dokploy&#39;a doğrudan ulaşıp bu tetiklemeyi yapamaz.</p><p>Bu durumu çözmek için GitHub Actions runner’ını, sadece deploy işlemi süresince geçici olarak Tailscale ağımıza dahil edeceğiz. İşlemi biten runner, ağımızdan otomatik olarak ayrılacak.</p><h4>Adım 1: Tailscale Geçici (Ephemeral) Auth Key Oluşturma</h4><p>GitHub Actions’ın kapalı ağımıza erişebilmesi için bir yetkilendirme anahtarına ihtiyacı var. Eğer standart bir anahtar kullanırsak, her kod pushladığımızda Tailscale cihaz listemizde atıl durumda bekleyen onlarca “GitHub-Runner” cihazı birikir. Bu yüzden işi bittiğinde kendini yok eden (Ephemeral) bir anahtar oluşturmalıyız.</p><ol><li><a href="https://login.tailscale.com/admin/machines">Tailscale Admin Console</a> adresine giriş yapın.</li><li>Sol menüden <strong>Settings -&gt; Keys -&gt; Auth keys</strong> sekmesine gidin.</li><li><strong>“Generate auth key”</strong> butonuna tıklayın.</li><li>Açılan pencerede şu iki ayarı kesinlikle aktif edin:</li></ol><ul><li><strong>Reusable:</strong> Aynı anahtarı her CI/CD sürecinde tekrar kullanabilmek için.</li><li><strong>Ephemeral:</strong> İşi biten cihazın ağdan otomatik silinmesi için.</li></ul><blockquote>Üretilen tskey-auth-... ile başlayan anahtarı kopyalayın. <em>(Güvenlik gereği bu anahtarı bir daha göremeyeceğiniz için kaybetmemeye dikkat edin).</em></blockquote><h4>Adım 2: Dokploy Webhook URL’sini Alma</h4><p>Dağıtım sürecini başlatabilmek için uygulamanızı tetikleyecek URL’i almamız gerekiyor.</p><ol><li>Dokploy panelinizde projenize ve ilgili uygulamanıza girin.</li><li><strong>Deployments</strong> sekmesine geçin.</li><li>Burada bulunan <strong>Webhook URL</strong> bağlantısını kopyalayın. <em>(Linkin, Dokploy sunucunuzun doğrudan Tailscale IP’sini veya Cloudflare üzerinden verdiğiniz ismi — örneğin </em><em>dokploy.domain.com— içerdiğinden emin olun).</em></li></ol><h4>Adım 3: GitHub Secrets Yapılandırması</h4><p>Elde ettiğimiz Tailscale anahtarını ve Dokploy Webhook adresini güvenlik gereği doğrudan GitHub reposuna plaintext olarak yazamayız. Bunları GitHub Secrets üzerinden ortam değişkeni olarak okuyacağız.</p><ol><li>Uygulamanızın bulunduğu GitHub deposuna gidin.</li><li><strong>Settings -&gt; Secrets and variables -&gt; Actions</strong> menüsünü açın.</li><li><strong>“New repository secret”</strong> butonunu kullanarak şu iki değeri ekleyin:</li></ol><ul><li><strong>Name:</strong> TAILSCALE_AUTHKEY | <strong>Secret:</strong> (1. Adımda kopyaladığınız tskey...)</li><li><strong>Name:</strong> DOKPLOY_WEBHOOK_URL | <strong>Secret:</strong> (2. Adımda kopyaladığınız webhook linki)</li></ul><h4>Adım 4: GitHub Actions Workflow’unun Hazırlanması (Build, Cache ve Deploy)</h4><p>Tüm gereksinimleri sağladığımıza göre otomasyon dosyamızı oluşturabiliriz. Bu aşamada basit bir webhook tetiklemesinden öteye geçip, kaynaklarımızı verimli kullanan gerçek bir CI/CD pipeline’ı kuracağız.</p><p>Sunucumuzun CPU ve RAM’ini kod derlemekle yormamak için, Docker imajımızı GitHub’ın ücretsiz sunucularında derleyip <strong>GitHub Container Registry’ye (GHCR)</strong> paketleyeceğiz. Üstelik her push işleminde dakikalarca beklememek için GitHub Actions’ın “Cache” özelliğini kullanacağız. Dokploy ise en sonda sadece deploya hazır imajı çekip canlıya alacak.</p><p>Projenizin kök dizininde .github/workflows/deploy.yml adında bir dosya oluşturun ve içeriğini aşağıdaki gibi düzenleyin:</p><pre>name: Build and Deploy to Dokploy<br>on:<br>  push:<br>    branches:<br>      - main # Hangi branch güncellendiğinde tetikleneceğini belirler<br><br>env:<br>  REGISTRY: ghcr.io<br>  IMAGE_NAME: ${{ github.repository_owner }}/uygulama-adi<br><br>jobs:<br>  # 1. AŞAMA: Docker İmajının Derlenmesi ve GHCR&#39;ye Yüklenmesi<br>  build-and-push:<br>    name: 📦 Build &amp; Push Docker Image<br>    runs-on: ubuntu-latest<br>    permissions:<br>      contents: write<br>      packages: write # GHCR&#39;ye yazma yetkisi veriyoruz<br>    steps:<br>      - name: Kodları Çek<br>        uses: actions/checkout@v4<br>      - name: Docker Buildx Kurulumu<br>        uses: docker/setup-buildx-action@v3<br>      - name: GitHub Container Registry Giriş<br>        uses: docker/login-action@v3<br>        with:<br>          registry: ${{ env.REGISTRY }}<br>          username: ${{ github.actor }}<br>          password: ${{ secrets.GITHUB_TOKEN }} # GitHub bu token&#39;ı otomatik sağlar<br>      - name: Build ve Push<br>        uses: docker/build-push-action@v6<br>        with:<br>          context: .<br>          push: true<br>          tags: |<br>            ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest<br>            ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}<br>          # Build sürelerini kısaltan cache ayarları:<br>          cache-from: type=gha<br>          cache-to: type=gha,mode=max<br>  # 2. AŞAMA: Dokploy&#39;a Dağıtım (Zero Trust)<br>  deploy-trigger:<br>    name: 🚀 Deploy to Dokploy<br>    needs: build-and-push # İmaj derlenmeden bu aşama BAŞLAMAZ<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Tailscale VPN&#39;e Bağlan<br>        uses: tailscale/github-action@v3<br>        with:<br>          authkey: ${{ secrets.TAILSCALE_AUTHKEY }}<br>      - name: Dokploy Webhook Tetikle<br>        run: curl -X POST -k &quot;${{ secrets.DOKPLOY_WEBHOOK_URL }}?branchName=main&quot;</pre><p><strong>Arka planda ne dönüyor?</strong></p><p>Kod repository’e düştüğünde GitHub runner’ı uyandırır. setup-buildx-action ve cache-from: type=gha sayesinde, Docker katmanları önbellekten okunur ve imaj saniyeler içinde GHCR&#39;ye yüklenir. Son adımda ise runner, Tailscale ağımıza girer ve curl komutuyla Dokploy webhook&#39;umuzu tetikler. Dokploy&#39;un tek yapması gereken, hazır derlenmiş bu imajı saniyeler içinde çekip sıfır kesintiyle canlıya almaktır.</p><h4>Olası Hatalar ve Sorun Giderme</h4><p>Sahada bu sistemi kurarken karşılaşabileceğiniz bazı kritik hatalar ve çözümleri:</p><ul><li><strong>Webhook tetiklenirken </strong><strong>{&quot;message&quot;:&quot;Branch Not Match&quot;} hatası alınması:</strong> Dokploy, dışarıdan gelen bir webhook isteğinin hangi branch için olduğunu bilmek ister. Eğer gönderdiğiniz ?branchName=... parametresi, Dokploy arayüzünde o uygulama için tanımlanmış hedef branch (genellikle main veya master) ile eşleşmezse bu hatayı fırlatır ve deploy işlemini reddeder. Çözümü için GitHub Actions içindeki curl adımında, Dokploy&#39;un beklediği branch adını tam olarak (?branchName=main gibi) yazdığınızdan emin olun.</li><li><strong>GitHub Actions’ta “403 Forbidden” Hatası (Paket Yüklerken):</strong> Pipeline’ın packages: write izni olmasına rağmen bu hatayı alıyorsanız, repository ayarlarınızda Action&#39;ların paket oluşturma yetkisi kısıtlanmış demektir. GitHub&#39;da <strong>Settings -&gt; Actions -&gt; General -&gt; Workflow permissions</strong> altından &quot;Read and write permissions&quot; seçeneğinin aktif olduğunu doğrulayın.</li><li><strong>Dokploy’un GHCR’den İmaj Çekememesi (Unauthorized):</strong> GitHub Container Registry (GHCR) varsayılan olarak gizlidir. Dolayısıyla CI/CD sürecimiz imajı GHCR’ye başarıyla yüklese bile, Dokploy bu private registry’ye erişip imajı sunucunuza indiremez. Bunu çözmek için Dokploy’u GitHub’da yetkilendirmeliyiz:</li></ul><ol><li>GitHub profilinize gidip <strong>Settings -&gt; Developer Settings -&gt; Personal access tokens (Tokens (classic))</strong> adımlarını izleyin.</li><li>read:packages yetkisini işaretleyerek yeni bir token oluşturun ve kopyalayın.</li><li>Dokploy panelinde sol menüden <strong>Settings -&gt; Registry</strong> sekmesine gidin.</li><li>Sağ üstteki <strong>“Add Registry”</strong> butonuna tıklayın, açılan ekranda “Provider” olarak ghcr.io&#39;yu seçin.</li><li>“Username” kısmına GitHub kullanıcı adınızı, “Password” kısmına ise az önce kopyaladığınız Personal Access Token’ı yapıştırıp kaydedin. Artık Dokploy, GHCR’deki private imajlarınıza sorunsuzca erişebilecektir.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SXPpP_YlL8LmZOtAE-2ptQ.png" /><figcaption>Dokploy Registry</figcaption></figure><h3>Kapanış: Kendi PaaS Altyapımız Artık Hazır</h3><p>Böylece 8 bölümlük serimizin sonuna geldik. Boş bir Linux sunucusuyla başladığımız bu süreçte; önce UFW ve Tailscale ile sunucumuzu dış erişime kapatarak Zero Trust temellerini attık. Cloudflare üzerinden DNS ve proxy ayarlarımızı yapılandırdık, LLDAP ve Authelia entegrasyonuyla merkezi kimlik yönetimimizi (SSO) sağladık. Beszel, Loki ve Grafana üçlüsüyle sistem metriklerini ve logları tek bir ekranda toplarken, MinIO ve Rclone ile otomatik yedekleme süreçlerimizi otomatize ettik. Bugün de GitHub Actions ile CI/CD pipeline’ımızı tamamlayarak sistemimizi tam anlamıyla bir PaaS ortamına dönüştürmüş olduk.</p><p>Artık Vercel, Heroku veya Render gibi platformların sunduğu geliştirici deneyimini kendi sunucumuzda yaşıyoruz. Verisi, logları, trafiği ve en önemlisi maliyeti tamamen bizim kontrolümüzde olan, güvenli bir altyapımız var. Local bilgisayarınızda çalışan bir kodu canlıya almak, artık sadece terminale git push yazıp sürecin tamamlanmasını izlemekten ibaret.</p><p>“Kendi PaaS Altyapımızı Kuruyoruz” serisini burada noktalıyoruz. Umarım bu yazı dizisi, bulut sağlayıcıların yüksek faturalarından kurtulup kendi altyapısının kontrolünü eline almak ve arka planda dönen mimarinin “nasıl” ve “neden” böyle çalıştığını pratik bir şekilde öğrenmek isteyen herkes için faydalı bir kaynak olmuştur.</p><p>Sunucularınızın <em>Uptime</em>’ı yüksek, pipeline’larınız her daim yeşil olsun. Başka yazılarda görüşmek üzere!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=388186004c91" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kendi PaaS Altyapımızı Kuruyoruz (Bölüm 7): Veritabanı İzolasyonu ve Otomatik Yedekleme (MinIO…]]></title>
            <link>https://myakupoglu.medium.com/kendi-paas-altyap%C4%B1m%C4%B1z%C4%B1-kuruyoruz-b%C3%B6l%C3%BCm-7-veritaban%C4%B1-i%CC%87zolasyonu-ve-otomatik-yedekleme-minio-e112bcf914c4?source=rss-3cfe97f9cd14------2</link>
            <guid isPermaLink="false">https://medium.com/p/e112bcf914c4</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[dokploy]]></category>
            <category><![CDATA[rclone]]></category>
            <category><![CDATA[backup]]></category>
            <dc:creator><![CDATA[Muhammet İkbal Yakupoglu]]></dc:creator>
            <pubDate>Thu, 02 Jul 2026 15:10:20 GMT</pubDate>
            <atom:updated>2026-07-02T15:20:03.796Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kendi PaaS Altyapımızı Kuruyoruz (Bölüm 7): Veritabanı İzolasyonu ve Otomatik Yedekleme (MinIO, Rclone &amp; Google Drive)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QBPShwqFNrqkfdIq-p5VRw.png" /></figure><p>Serimizin önceki bölümlerinde sunucu altyapımızı kurduk, kimlik yönetimimizi “Zero Trust” felsefesiyle yapılandırdık ve sistem loglarımızı merkezi bir ekranda topladık. Ancak tüm bu uygulamalar çalışırken arka planda sistemin en değerli varlığı birikiyor: <strong>Kullanıcı Verileri</strong>.</p><p>Production ortamında veritabanlarını diğer uygulamalarla aynı ağ karmaşasında bırakmak veya manuel yedeklemelere güvenmek büyük bir risktir. Olası bir sunucu çökmesinde, yanlışlıkla silinen bir klasörde veya bir siber saldırıda veriyi geri getiremiyorsanız, kurduğunuz mükemmel altyapının hiçbir anlamı kalmaz.</p><p>Bu bölümde:</p><ol><li>Veritabanlarımızı Dokploy arayüzünü kullanarak dış erişime tamamen kapatacak şekilde <strong>izole</strong> edeceğiz.</li><li>Amazon S3 standardında, kendi sunucumuzda barınan bulut depolama çözümümüz <strong>MinIO</strong>’yu kuracağız.</li><li>Dokploy’un dahili yedekleme özelliğini kullanarak veritabanlarımızı her saat başı lokal S3 kasamıza (MinIO) yedekleyeceğiz.</li><li>Sunucu dışı backup planımız için <strong>Google Drive</strong> entegrasyonu yapacak ve manuel bir otomasyon zinciriyle (Bash script + Rclone) yedekleri buraya kopyalayarak veri güvenliğini sağlayacağız.</li></ol><h3>Adım 1: Dokploy Arayüzü ile İzole Veritabanı Oluşturma</h3><p>PaaS altyapımızda veritabanlarımızı (Örneğin PostgreSQL, MySQL veya Redis) oluştururken Dokploy’un kullanıcı dostu arayüzünü kullanıyoruz. Aşağıdaki adımları takip ederek ilk veritabanı servisimizi oluşturuyoruz.</p><ol><li>Dokploy ana ekranında projenizin içine girin.</li><li>Sağ üst köşedeki <strong>“+ Create Service”</strong> butonuna tıklayın ve listeden <strong>Database</strong> seçeneğini seçin.</li><li>Açılan pencerede veritabanı tipini (Örn: PostgreSQL), sunucunuza vereceğiniz ismi (Örn: postgres-prod), veritabanı adını (Örn: my_production_db), kullanıcı adını ve şifresini ve tercih ettiğiniz postgres versiyon image adını girin (default:postgres:18).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ekrmh4rrnianEDiMLwsWAQ.png" /></figure><p>Bu işlemle birlikte veritabanınız, dış dünyadan tamamen izole bir şekilde dokploy-network ağı içerisinde çalışmaya başlar. Dokploy, siz aksini belirtmedikçe dışarıya hiçbir port açmaz ve veritabanınızı sadece kendi iç ağındaki uygulamaların erişimine sunar.</p><h3>Adım 2: Kendi S3 Depolamamız: MinIO Kurulumu</h3><p>Yedeklerimizi sunucunun kendi diskinde bir klasörde tutmak felaket senaryolarına karşı bizi korumaz. Dokploy’un dahili yedekleme mekanizmasının verileri güvenle yönetebilmesi için Amazon S3 standartlarında, kendi sunucumuzda barınan bulut depolama çözümümüz <strong>MinIO</strong>’yu kurguluyoruz.</p><p>Dokploy üzerinden “Compose” servisi oluşturarak aşağıdaki yapılandırmayla MinIO’yu ayağa kaldıralım:</p><pre>services:<br>  minio:<br>    image: minio/minio:latest<br>    container_name: minio-storage<br>    labels:<br>      - &quot;app_name=minio&quot;<br>      - &quot;traefik.enable=true&quot;<br>      # --- S3 API Yönlendirmesi (Port 9000) ---<br>      - &quot;traefik.http.routers.minio-api.rule=Host(`s3.domaininiz.com`)&quot;<br>      - &quot;traefik.http.routers.minio-api.entrypoints=websecure&quot;<br>      - &quot;traefik.http.routers.minio-api.tls.certresolver=letsencrypt&quot;<br>      - &quot;traefik.http.services.minio-api.loadbalancer.server.port=9000&quot;<br>      <br>      # --- Yönetim Paneli Yönlendirmesi (Port 9001) ---<br>      - &quot;traefik.http.routers.minio-console.rule=Host(`s3.domaininiz.com`)&quot;<br>      - &quot;traefik.http.routers.minio-console.entrypoints=websecure&quot;<br>      - &quot;traefik.http.routers.minio-console.tls.certresolver=letsencrypt&quot;<br>      - &quot;traefik.http.services.minio-console.loadbalancer.server.port=9001&quot;<br>    <br>    restart: unless-stopped<br>    command: server /data --console-address &quot;:9001&quot;<br>    environment:<br>      # Güvenliğiniz için şifreyi en az 8 karakter belirleyin!<br>      - MINIO_ROOT_USER=${MINIO_ROOT_USER}<br>      - MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}<br>      <br>      # MinIO&#39;nun kendi adreslerini bilmesi arayüzün stabil çalışması için şarttır<br>      - MINIO_SERVER_URL=https://s3.domaininiz.com<br>      - MINIO_BROWSER_REDIRECT_URL=https://s3.domaininiz.com<br>      <br>    volumes:<br>      - /mnt/data/minio:/data<br>    networks:<br>      - dokploy-network<br>    expose:<br>      - &quot;9000&quot;<br>      - &quot;9001&quot;<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;bash -c &#39;&lt;/dev/tcp/127.0.0.1/9000&#39; || exit 1&quot;]<br>      interval: 30s<br>      timeout: 5s<br>      retries: 3<br>      start_period: 20s<br>networks:<br>  dokploy-network:<br>    external: true</pre><blockquote>Burada root user ve şifresini ortam değişkeni olarak okuduğumuzdan dolayı, composeyi deploy etmeden önce<em> environment variables</em> sekmesinden bu bilgileri doldurmalıyız.</blockquote><h4><strong>Yedekleme Kasasının (Bucket) Oluşturulması</strong></h4><p>MinIO çalıştıktan sonra s3.domaininiz.com adresine gidin ve Compose dosyasında belirlediğiniz root kullanıcı adı ve şifresiyle giriş yapın. Sol menüde bulunan <strong>&quot;+ Create Bucket&quot;</strong> butonuna tıklayarak <strong>backups</strong> adında yeni bir kasa oluşturun.</p><h3>Adım 3: Hibrit Yedekleme Stratejisi (Dokploy + Backup Worker)</h3><p>Altyapımızda veritabanlarını yedeklemek hayati bir önem taşısa da, sistemimiz sadece PostgreSQL veya MySQL’den ibaret değil. Kimlik yönetimimizi sağlayan LLDAP gibi uygulamaların konfigürasyon dosyaları veya SQLite veritabanları da en az diğerleri kadar kritiktir.</p><p>Bu nedenle “Zero Trust” felsefemize uygun, sunucumuzu kirletmeyen hibrit bir yedekleme mimarisi kuruyoruz:</p><ol><li><strong>Dokploy Dahili Yedeklemesi:</strong> PostgreSQL/MySQL gibi servisleri ve Dokploy’un kendi backup yönetimini dokploy paneli üzerinden yapacağız.</li><li><strong>Kendi Backup-Worker Konteynerimiz:</strong> Dokploy’un kapsamadığı alanlar (LLDAP vb. servisler) için sadece yedekleme görevlerinden sorumlu izole bir “işçi” konteyner ayağa kaldırıp, Bash scriptleri ile otomasyon sağlayacağız.</li></ol><h4>Kısım 1: Dokploy Dahili Yedekleme Yapılandırması</h4><p>Dokploy, desteklediği veritabanları için harika ve çok pratik bir dahili yedekleme modülü sunar. Bunu MinIO kasamıza bağlamak çok kolaydır:</p><ol><li>Dokploy sol menüsünden <strong>Settings -&gt; S3 Destination</strong> sekmesine gidin. MinIO bilgilerinizi buraya girin (Endpoint: http://minio-storage:9000, Bucket: backups, Access ve Secret keyleriniz).</li><li>Projenizdeki PostgreSQL/MySQL veritabanı sayfanıza gidin ve <strong>Backups</strong> sekmesine tıklayın.</li><li><strong>“+ Create Backup”</strong> butonuna tıklayarak kuralınızı oluşturun:</li></ol><ul><li><strong>Destination:</strong> S3 olarak kaydettiğiniz MinIO hedefini seçin.</li><li><strong>Database:</strong> Yedeklemek istediğiniz database adı.</li><li><strong>Schedule:</strong> 0 */1 * * * (Her saat başı).</li><li><strong>Keep Latest:</strong> 20 (Yalnızca son 20 yedeği tut).</li></ul><blockquote>Aynı adımları <strong>Web Server</strong> sayfasında <strong>Backups</strong> sekmesinde yaparak dokploy backup joblarımızıda kurabiliriz.</blockquote><h4>Kısım 2: LLDAP ve Dosya Yedekleri İçin Bash Scripti</h4><p>LLDAP gibi servislerin /data klasörlerindeki verileri yedeklememiz gerekiyor. Bunun için sunucumuzda bir script klasörü oluşturacağız.</p><p>home/user klasörü altında backup-workerisimli klasör oluşturuyoruz. Burada scripts klasörü altında scriptlerimizi oluştacağız. LLDAP ve Grafana backuplarını her gece 3de alıp minio’ya yükleyen shell scriptleri github hesabımda bulabilirsiniz:</p><p><a href="https://github.com/MikbalYakupoglu/dokploy-backup-worker">GitHub - MikbalYakupoglu/dokploy-backup-worker</a></p><h4>Kısım 3: Backup-Worker Konteynerinin Oluşturulması</h4><p>Sunucumuzun kendi crontab dosyasını kirletmek yerine, sadece yedekleme saatinde uyanıp scriptlerimizi çalıştıran izole bir Alpine Linux konteyneri (Worker) oluşturacağız.</p><p>Dokploy üzerinden <strong>“Compose”</strong> servisi seçerek yeni bir uygulama oluşturun ve aşağıdaki kodla backup-worker isimli konteynerimizi ayağa kaldıralım:</p><pre>services:<br>  backup-worker:<br>    image: alpine:latest<br>    container_name: backup-worker<br>    restart: unless-stopped<br>    labels:<br>      - &quot;app_name=backup-worker&quot;<br>    <br>    # Konteyner başlarken paketleri kurar, cron görevlerini yazar ve crond servisini başlatır<br>    command: &gt;<br>      sh -c &quot;apk add --no-cache rclone sqlite curl zip tzdata &amp;&amp;<br>      echo &#39;0 3 * * * /scripts/job-nightly-backup.sh &gt;&gt; /logs/backup.log 2&gt;&amp;1&#39; &gt; /etc/crontabs/root &amp;&amp;<br>      echo &#39;0 4 * * * /scripts/job-cleanup-old-backups.sh &gt;&gt; /logs/cleanup.log 2&gt;&amp;1&#39; &gt;&gt; /etc/crontabs/root &amp;&amp;<br>      echo &#39;30 */3 * * * /scripts/job-cloud-sync.sh &gt;&gt; /logs/sync.log 2&gt;&amp;1&#39; &gt;&gt; /etc/crontabs/root &amp;&amp;<br>      crond -f&quot;<br>      <br>    volumes:<br>      # Kendi yazdığımız bash scriptlerinin bulunduğu klasör<br>      - /home/user/backup-worker/scripts:/scripts<br>      # Log dosyalarının sunucuda kalıcı olarak tutulacağı klasör<br>      - /home/user/backup-worker/logs:/logs<br>      <br>      # Adım 4&#39;te oluşturacağımız Rclone konfigürasyonunu içeri alıyoruz (S3 ve GDrive için)<br>      - /root/.config/rclone:/root/.config/rclone<br>      <br>      # --- YEDEKLENECEK UYGULAMA VERİLERİ (Salt Okunur - Read Only) ---<br>      # Dokploy&#39;un oluşturduğu volume&#39;lerin fiziksel yollarını bularak doğrudan bağlıyoruz<br>      - /var/lib/docker/volumes/sizin_projeniz_grafana-storage/_data:/data/grafana:ro<br>      - /var/lib/docker/volumes/sizin_projeniz_lldap_data/_data:/data/lldap:ro<br>      <br>    environment:<br>      - TZ=Europe/Istanbul<br><br>    networks:<br>      - dokploy-network<br>      <br>    healthcheck:<br>      test: [&quot;CMD&quot;, &quot;pidof&quot;, &quot;crond&quot;]<br>      interval: 30s<br>      timeout: 5s<br>      retries: 3<br>      start_period: 10s<br>networks:<br>  dokploy-network:<br>    external: true</pre><h3>Adım 4: Rclone Kurulumu ve Google Drive Entegrasyonu (Headless OAuth)</h3><p>“3–2–1 Yedekleme Kuralı” gereği verilerimizin bir kopyasını da sunucu dışına, yani <strong>Google Drive</strong>’a aktarmalıyız. Sunucular headless sistemler olduğu için, Google’ın OAuth doğrulama ekranını sunucuda açamayız. Bu yüzden yetkilendirmeyi kendi bilgisayarımızda yapıp ayar dosyasını sunucuya taşıyacağız.</p><ol><li>Kendi kişisel bilgisayarınıza (Windows/Mac) <a href="https://rclone.org/downloads/">rclone.org</a> üzerinden Rclone kurun.</li><li>Bilgisayarınızın terminalini açıp rclone config komutunu çalıştırın.</li><li>Yeni bir bağlantı (n) oluşturup adını dokploy-google-drive-backup yapın ve listeden Google Drive&#39;ı seçin. client_id gibi soruları boş geçip yetki alanını (scope) 1 (Full Access) olarak işaretleyin.</li><li>Use auto config? sorusuna y dediğinizde tarayıcınız açılacak ve Google hesabınızla giriş yapmanız istenecektir. Onayladığınızda bilgisayarınızdaki Rclone konfigürasyon dosyasına bağlantı token&#39;ı işlenecektir.</li></ol><p><strong>Lokal Ayar Dosyasının Bulunması:</strong> Bu işlemler bittikten sonra Rclone, ürettiği yetki bloğunu bilgisayarınızdaki konfigürasyon dosyasına kaydeder. Bu dosyayı genellikle şu dizinlerde bulabilirsiniz:</p><ul><li><strong>Windows:</strong> C:\Users\&lt;KullanıcıAdınız&gt;\AppData\Roaming\rclone\rclone.conf</li><li><strong>Mac / Linux:</strong> ~/.config/rclone/rclone.conf</li></ul><p>Bu dosyayı bir metin editörüyle açın ve içindeki [dokploy-google-drive-backup] ile başlayan tüm bloğu (token dahil) kopyalayın.</p><p>Şimdi bu yapılandırmayı sunucumuza taşıyoruz. Sunucunuzda /root/.config/rclone dizinini oluşturun ve içine rclone.conf adında bir dosya yaratın:</p><pre>mkdir -p /root/.config/rclone<br>nano /root/.config/rclone/rclone.conf</pre><p>Açılan dosyanın içerisine hem az önce kurduğumuz yerel MinIO kasamızın bilgilerini hem de bilgisayarınızdan kopyaladığınız Google Drive yetki bloğunu yapıştırın. Dosyanın son hali şuna benzemelidir:</p><pre>[minio_source]<br>type = s3<br>provider = Minio<br>env_auth = false<br>access_key_id = admin<br>secret_access_key = SuperGizliMinioSifresi123<br># Konteyner adı minio-storage olduğu için Docker içindeki adres böyle olmalıdır:<br>endpoint = http://minio-storage:9000<br>acl = private<br><br>[dokploy-google-drive-backup]<br>type = drive<br>scope = drive<br>token = {&quot;access_token&quot;:&quot;sizin-google-access-tokeniniz&quot;,&quot;token_type&quot;:&quot;Bearer&quot;,&quot;refresh_token&quot;:&quot;sizin-google-refresh-tokeniniz&quot;,&quot;expiry&quot;:&quot;2026-03-22T13:30:02.696008462+03:00&quot;,&quot;expires_in&quot;:3599}<br>team_drive =</pre><p>Bu konfigürasyon dosyası, 3. Adımda oluşturduğumuz backup-worker konteynerinin içine dinamik olarak bağlanacak ve bash scriptlerimizin hem lokal S3 depomuza hem de Google Drive bulutuna güvenle veri aktarmasını sağlayacaktır.</p><p>Veritabanlarımızı dış dünyadan tamamen izole ettik, kendi bulut depolama çözümümüzü (MinIO) kurduk, host işletim sistemini kirletmeyen izole işçi konteynerler ile otomasyon sağladık ve “Headless OAuth” tekniğiyle verilerimizin felaket kurtarma kopyalarını sorunsuzca Google Drive’a taşıdık. Sisteminiz artık bir sunucu çökmesine veya kullanıcı hatalarına karşı %100 hazırlıklı.</p><p>Serimizin bir sonraki bölümü olan <strong>Bölüm 8: GitHub Actions ile CI/CD Süreçleri</strong>’nde; kodumuzu GitHub’a pushladığımız anda testleri koşturan, imajları derleyen ve Dokploy üzerindeki servislerimizi sıfır kesintiyle otomatik olarak güncelleyen pipeline kuracağız.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e112bcf914c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Our Own PaaS Infrastructure (Part 6) — Part 2: Centralized Log Management (Loki, Promtail…]]></title>
            <link>https://myakupoglu.medium.com/building-our-own-paas-infrastructure-part-6-part-2-centralized-log-management-loki-promtail-be876e3c8eec?source=rss-3cfe97f9cd14------2</link>
            <guid isPermaLink="false">https://medium.com/p/be876e3c8eec</guid>
            <category><![CDATA[promtail]]></category>
            <category><![CDATA[grafana-loki]]></category>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Muhammet İkbal Yakupoglu]]></dc:creator>
            <pubDate>Tue, 09 Jun 2026 13:47:22 GMT</pubDate>
            <atom:updated>2026-06-09T13:47:22.338Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Our Own PaaS Infrastructure (Part 6) — Part 2: Centralized Log Management (Loki, Promtail &amp; Grafana)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p57Hxig-pXacN1kY8_F2tQ.png" /></figure><p>In the previous article of our series (Part 1), we started monitoring our server resources with Beszel and set up our early warning system. Now, we are moving on to the second major pillar of our monitoring architecture: <strong>Centralized Log Management.</strong></p><p>Dozens of different Docker containers (databases, APIs, web interfaces, proxies) are running in our own PaaS infrastructure. Whenever an error occurs in any application, connecting to the server via SSH and searching for logs one by one with the docker logs &lt;container_name&gt; command becomes unsustainable as the system grows. We need a lightweight structure that will aggregate logs in a central location, label them, and allow us to search through them without exhausting the server.</p><p>Instead of resource-heavy traditional logging solutions (e.g., ElasticSearch), we will use the trio of <strong>Loki</strong>, which incredibly optimizes disk and memory usage by indexing only labels; <strong>Promtail</strong>, which collects logs on the server and forwards them to Loki; and <strong>Grafana</strong>, our visualization layer where we will read this data.</p><h4>Security in Architecture: Authelia OIDC Integration</h4><p>In this part, we continue to apply our “Zero Trust” philosophy. To ensure secure access to the Grafana panel, we connect Grafana directly to Authelia as an OIDC (OpenID Connect) client.</p><p>Thanks to this modern approach, we do not need to use an extra middleware on the Traefik side; Grafana itself directly redirects the user who wants to log in to Authelia’s secure login screen. Moreover, based on the group information returned from Authelia, we can automatically assign “Admin” or “Viewer” privileges to the user within Grafana.</p><h3>Step 1: Preparation of Configuration Files</h3><p>Before proceeding with the installation, we must create two basic configuration files that Promtail and Loki will need on our server (for example, in the /home/user/grafana/ directory).</p><h4><strong>1. Promtail Configuration (</strong><strong>promtail-config.yaml)</strong></h4><p>This is the necessary configuration file for Promtail to read the logs of Docker containers, label them, and send them to Loki. By preventing the monitoring tools from sending their own logs, we prevent log pollution and resolve possible label errors.</p><pre>server:<br>  http_listen_port: 9080<br>  grpc_listen_port: 0<br><br>positions:<br>  filename: /tmp/positions.yaml<br><br>clients:<br>  - url: http://loki:3100/loki/api/v1/push<br><br>scrape_configs:<br>  - job_name: docker<br>    docker_sd_configs:<br>      - host: unix:///var/run/docker.sock<br>        refresh_interval: 5s<br>    relabel_configs:<br>      - source_labels: [&#39;__meta_docker_container_name&#39;]<br>        regex: &#39;/(.*)&#39;<br>        target_label: &#39;container&#39;</pre><h4><strong>2. Loki Configuration (</strong><strong>loki-config.yaml)</strong></h4><p>This is the file where we determine where Loki will save the logs and their retention periods.</p><blockquote><em>In upcoming parts, when we install MinIO (S3 Object Storage) in our infrastructure, we will move this setting to MinIO storage in accordance with S3 standards. For now, we are configuring it to keep the logs on the server’s own disk (filesystem).</em></blockquote><pre>auth_enabled: false<br><br>server:<br>  http_listen_port: 3100<br>  grpc_listen_port: 9096<br><br>common:<br>  path_prefix: /loki<br>  storage:<br>    filesystem:<br>      chunks_directory: /loki/chunks<br>      rules_directory: /loki/rules<br>  replication_factor: 1<br>  ring:<br>    instance_addr: 127.0.0.1<br>    kvstore:<br>      store: inmemory<br><br>schema_config:<br>  configs:<br>    - from: 2020-10-24<br>      store: boltdb-shipper<br>      object_store: filesystem<br>      schema: v11<br>      index:<br>        prefix: index_<br>        period: 24h<br><br>storage_config:<br>  boltdb_shipper:<br>    active_index_directory: /loki/index<br>    cache_location: /loki/index_cache<br>    shared_store: filesystem<br>  filesystem:<br>    directory: /loki/chunks<br><br>compactor:<br>  working_directory: /loki/boltdb-shipper-compactor<br>  shared_store: filesystem<br>  retention_enabled: true<br><br># Performance and Limit Settings<br>limits_config:<br>  retention_period: 720h # Logs are kept for 30 days<br>  reject_old_samples: true<br>  reject_old_samples_max_age: 168h<br>  allow_structured_metadata: true<br>  max_query_parallelism: 32<br>  split_queries_by_interval: 15m<br>  max_line_size: 512KB<br><br>query_scheduler:<br>  max_outstanding_requests_per_tenant: 2048<br><br>frontend:<br>  compress_responses: true</pre><h4><strong>3. Creating the Grafana Client on the Authelia Side</strong></h4><p>As a final preparation, we must add Grafana to the configuration.yml file so that Authelia can accept Grafana&#39;s OIDC requests.</p><ol><li>Hash the password you set for Grafana on your server (e.g., SecretPassword123):</li></ol><pre>docker run authelia/authelia:latest authelia crypto hash generate pbkdf2 --password &#39;SecretPassword123&#39;</pre><ol><li>Copy the resulting hash value and add this block to the identity_providers -&gt; oidc -&gt; clients list in your Authelia configuration file:</li></ol><pre>identity_providers:<br>  oidc:<br>    hmac_secret: hmac-secret<br>    clients:<br>      - client_id: grafana<br>        client_name: Grafana<br>        client_secret: &quot;$pbkdf2-sha512$310000$...&quot; # The hash you generated will go here<br>        public: false<br>        authorization_policy: one_factor<br>        require_pkce: true<br>        pkce_challenge_method: S256<br>        redirect_uris:<br>          # Adjust according to your own domain<br>          - https://grafana.yourdomain.com/login/generic_oauth<br>        scopes:<br>          - openid<br>          - profile<br>          - email<br>          - groups<br>        response_types:<br>          - code<br>        grant_types:<br>          - authorization_code</pre><p>Save the changes and restart the Authelia container. The infrastructure is now ready to accommodate Grafana.</p><h3>Step 2: Docker Compose Installation</h3><p>Now that our configuration files are ready, we can spin up the entire structure via Dokploy with a single docker-compose.yml. Pay attention to Grafana&#39;s environment variables here. We are handling the Authelia integration and role mappings entirely from here.</p><pre>services:<br>  loki:<br>    image: grafana/loki:2.9.2<br>    container_name: loki<br>    labels:<br>      - &quot;app_name=loki&quot;<br>    restart: unless-stopped<br>    expose:<br>      - &quot;3100&quot;<br>    command: <br>      -config.file=/etc/loki/local-config.yaml<br>    volumes:<br>      - /home/user/grafana/loki-config.yaml:/etc/loki/local-config.yaml<br>    networks:<br>      - dokploy-network<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;wget -q --spider http://localhost:3100/ready || exit 1&quot;]<br>      interval: 30s<br>      timeout: 5s<br>      retries: 3<br>      start_period: 20s<br><br>  promtail:<br>    image: grafana/promtail:3.0.0<br>    container_name: promtail<br>    labels:<br>      - &quot;app_name=promtail&quot;<br>    restart: unless-stopped<br>    volumes:<br>      - /home/user/grafana/promtail-config.yaml:/etc/promtail/config.yaml<br>      - /var/run/docker.sock:/var/run/docker.sock:ro<br>      - /var/lib/docker/containers:/var/lib/docker/containers:ro<br>    command: <br>      -config.file=/etc/promtail/config.yaml<br>    networks:<br>      - dokploy-network<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;test -e /etc/promtail/config.yaml || exit 1&quot;]<br>      interval: 30s<br>      timeout: 5s<br>      retries: 3<br>      start_period: 5s<br><br>  grafana:<br>    image: grafana/grafana:latest<br>    container_name: grafana-logs<br>    restart: always <br>    environment:<br>      - GF_SERVER_DOMAIN=grafana.yourdomain.com<br>      - GF_SERVER_ROOT_URL=https://grafana.yourdomain.com/<br>      <br>      # Security: Disables the default login form, redirecting directly to OIDC<br>      - GF_AUTH_DISABLE_LOGIN_FORM=true<br>      - GF_AUTH_OAUTH_AUTO_LOGIN=true<br>      # OIDC (Authelia) Settings<br>      - GF_AUTH_GENERIC_OAUTH_ENABLED=true<br>      - GF_AUTH_GENERIC_OAUTH_USE_PKCE=true<br>      - GF_AUTH_GENERIC_OAUTH_NAME=Authelia<br>      - GF_AUTH_GENERIC_OAUTH_CLIENT_ID=grafana<br>      - GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET=YourSecretPassword # The plain text password we will give to Authelia<br>      - GF_AUTH_GENERIC_OAUTH_SCOPES=openid profile email groups<br>      - GF_AUTH_GENERIC_OAUTH_AUTH_URL=https://auth.yourdomain.com/api/oidc/authorization<br>      - GF_AUTH_GENERIC_OAUTH_TOKEN_URL=https://auth.yourdomain.com/api/oidc/token<br>      - GF_AUTH_GENERIC_OAUTH_API_URL=https://auth.yourdomain.com/api/oidc/userinfo<br>      - GF_AUTH_GENERIC_OAUTH_ALLOW_SIGN_UP=true # Required for new users to be created<br>      - GF_AUTH_GENERIC_OAUTH_LOGIN_ATTRIBUTE_PATH=preferred_username<br>      - GF_AUTH_GENERIC_OAUTH_NAME_ATTRIBUTE_PATH=name<br>      - GF_AUTH_GENERIC_OAUTH_EMAIL_ATTRIBUTE_PATH=email<br>      - GF_AUTH_GENERIC_OAUTH_ROLE_ATTRIBUTE_PATH=&#39;Admin&#39; # I am assigning the default admin role (can be managed via ldap groups)<br>    volumes:<br>      - grafana-storage:/var/lib/grafana<br>    labels:<br>      - &quot;traefik.enable=true&quot;<br>      - &quot;traefik.http.routers.grafana.rule=Host(`grafana.yourdomain.com`)&quot;<br>      - &quot;traefik.http.routers.grafana.entrypoints=websecure&quot;<br>      - &quot;traefik.http.routers.grafana.tls.certresolver=letsencrypt&quot;<br>      - &quot;traefik.http.routers.grafana.service=grafana&quot;<br>      - &quot;traefik.http.services.grafana.loadbalancer.server.port=3000&quot;<br>    networks:<br>      - dokploy-network<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;curl -f http://localhost:3000/api/health || exit 1&quot;]<br>      interval: 30s<br>      timeout: 10s<br>      retries: 3<br>      start_period: 30s<br>volumes:<br>  grafana-storage:<br>networks:<br>  dokploy-network:<br>    external: true</pre><h3>Step 3: Adding Loki to Grafana and Monitoring Logs</h3><p>When you go to your Grafana address (https://grafana.yourdomain.com), the Authelia login screen will directly welcome you. After logging in, our last step is to show Grafana where to pull the logs from.</p><ol><li>Go to <strong>Connections &gt; Data Sources</strong> from the left menu in Grafana.</li><li>Click the <strong>Add data source</strong> button and select <strong>Loki</strong> from the list.</li><li>In the URL section, directly type http://loki:3100 since the applications are located in the same Docker network.</li><li>Confirm the connection by clicking the <strong>Save &amp; Test</strong> button at the bottom of the page.</li></ol><p><strong>Graph View Tip (Scattered Dots Solution):</strong> While examining Loki data in the <em>Explore</em> tab in Grafana or when you create a custom timeline panel showing log volume, you might notice that the graphs appear as scattered, disconnected dots instead of a continuous line.</p><p>To fix this, simply change the <strong>Line interpolation</strong> option under <em>Graph styles</em> in the settings menu on the right side of your panel to <strong>Linear</strong> or <strong>Smooth</strong>, and set the <strong>Connect null values</strong> option to <strong>Always</strong>. Your graph will instantly turn into a continuous and readable flow.</p><p>I am leaving some links below that I think might be useful regarding Grafana:</p><ul><li><a href="https://github.com/grafana/grafana">https://github.com/grafana/grafana</a></li><li><a href="https://play.grafana.org/dashboards/f/examples/examples">https://play.grafana.org/dashboards/f/examples/examples</a></li></ul><p>We are now monitoring our system resources with Beszel and can securely query the logs of all our Docker containers from a single center via Loki and Grafana. We have built the observability layer of our own PaaS infrastructure to professional standards.</p><p>However, as our applications run and user data accumulates, the security of our databases — the most valuable and sensitive part of the system — becomes our number one priority. Leaving production databases in the same network clutter with other applications or relying on manual backups is a huge risk.</p><p>In the next article of the series (<strong>Part 7: Database Isolation and Backup</strong>), we will discuss how to isolate our databases (PostgreSQL, MySQL, Redis, etc.), which are the heart of our applications, in our infrastructure and how to configure automated cloud backup strategies (storing backups encrypted, S3/MinIO integration, etc.) to reduce data loss to zero.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be876e3c8eec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Our Own PaaS Infrastructure (Part 6) — Part 1: Server Monitoring and Early Warning System…]]></title>
            <link>https://myakupoglu.medium.com/building-our-own-paas-infrastructure-part-6-part-1-server-monitoring-and-early-warning-system-823eb77fc4ff?source=rss-3cfe97f9cd14------2</link>
            <guid isPermaLink="false">https://medium.com/p/823eb77fc4ff</guid>
            <category><![CDATA[beszel]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[dokploy]]></category>
            <dc:creator><![CDATA[Muhammet İkbal Yakupoglu]]></dc:creator>
            <pubDate>Tue, 09 Jun 2026 13:46:23 GMT</pubDate>
            <atom:updated>2026-06-09T13:46:23.925Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Our Own PaaS Infrastructure (Part 6) — Part 1: Server Monitoring and Early Warning System (Beszel)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6afikpJ1oc-dVCeDqK_btw.png" /></figure><p>In the previous parts, we set up our server infrastructure, managed DNS with Cloudflare, configured Dokploy, and activated centralized identity management (SSO) with Authelia. Once our infrastructure is up and services start running, we need a comprehensive monitoring and log management architecture to ensure the system continues to operate healthily.</p><p>Because the topic is comprehensive and detailed, we divided Part 6 into two separate pieces. In this article (Part 1), we will install Beszel, a lightweight and modern tool that doesn’t exhaust our server resources; perform OIDC (Authelia) integration; and configure our early warning system (Telegram &amp; Mail). In the next article of the series, we will cover the Loki, Promtail, and Grafana trio to collect our application logs on a centralized screen.</p><h3>Lightweight and Modern Server Monitoring with Beszel</h3><p>Compared to traditional Prometheus and Node Exporter setups, Beszel is much lighter, uses PocketBase in the background, and consumes system resources at a minimum level.</p><p>We are spinning up Beszel as a separate service via Dokploy’s “Compose” feature. The docker-compose.yml file below contains the main Beszel application and the agent that will collect metrics.</p><pre>services:<br>  beszel:<br>    image: henrygd/beszel:latest<br>    container_name: beszel<br>    restart: unless-stopped<br>    ports:<br>      - &quot;8090:8090&quot;<br>    environment:<br>      # So the Hub knows its own address<br>      APP_URL: http://localhost:8090<br>    volumes:<br>      # We use named volumes instead of folder paths<br>      - beszel_data:/beszel_data<br>  beszel-agent:<br>    image: henrygd/beszel-agent:latest<br>    container_name: beszel-agent<br>    restart: unless-stopped<br>    # Host mode is required for the Agent to correctly read server resources (CPU, RAM, Disk)<br>    network_mode: host<br>    environment:<br>      # Since the Agent is in host mode, it reaches the Hub via localhost<br>      HUB_URL: &quot;http://127.0.0.1:8090&quot;<br>      # You must fill the KEY part with the &quot;ssh-ed25519...&quot; key you got from the Beszel panel<br>      KEY: &quot;YOUR_KEY_GOES_HERE&quot;<br>      TOKEN: &quot;YOUR_TOKEN_GOES_HERE&quot;<br>    volumes:<br>      # Volume for Agent data<br>      - beszel_agent_data:/beszel_agent_data<br>      # This is mandatory for it to read Docker statistics<br>      - /var/run/docker.sock:/var/run/docker.sock:ro<br># We define the volumes here, Docker will create them automatically<br>volumes:<br>  beszel_data:<br>  beszel_agent_data:</pre><h4>Beszel Hub and Agent Connection: Where to Get the KEY?</h4><p>The KEY variable in the compose file above is the Public Key that allows secure communication between the Hub and the Agent. We must follow these steps to get this key:</p><ol><li>First, comment out the beszel-agent section in the compose file and spin up only the beszel service.</li><li>Go to the Beszel interface (e.g., http://100.x.x.x:8090 or your routed domain) and create your first administrator account. <em>(Make sure you are connected to the VPN.)</em></li><li>After logging into the panel, click the <strong>“Add System”</strong> button.</li><li>Give your server a name and copy the Public Key value starting with ssh-ed25519... generated specifically for you in the instructions on the screen, along with the Token.</li><li>Return to your compose file in Dokploy, paste this copied value into the KEY and TOKEN environment variables in the beszel-agent service, and redeploy the entire structure (Hub and Agent together).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*jwht5nO-O5X8goTlvzBihg.png" /></figure><p>This way, when the Agent starts running, it will successfully authenticate with the Hub using the key it has and start transmitting metrics to the panel instantly.</p><h3>Beszel: Centralized Identity Management (OIDC) and PocketBase Integration</h3><p>In Part 5, we set up our centralized identity management with Authelia and LLDAP. Although Beszel has its own internal user management, it uses PocketBase as the database and authentication infrastructure in the background. In this way, we can provide a secure and centralized login (SSO) to Beszel by configuring the Authelia (OIDC) integration directly through PocketBase.</p><p>We will perform this integration in two stages: First, we will introduce Beszel to Authelia, and then we will show Authelia’s addresses to Beszel.</p><h4>1. Creating the Beszel Client on the Authelia Side</h4><p>For Authelia to accept Beszel’s authentication requests, we first need to define Beszel as an authorized client in Authelia’s configuration file.</p><p>Due to Authelia’s security standards, it does not accept client_secret values as plain text in the configuration.yml file. We need to write the hashed version of the password into the configuration.</p><p><strong>Step 1.1: Generating a Hash for the Secret</strong></p><p>Run the following Docker command on your server to hash a plain text password you specify (for example, MySecretPassword123) into the PBKDF2 format that Authelia will accept:</p><pre>docker run authelia/authelia:latest authelia crypto hash generate pbkdf2 --password &#39;MySecretPassword123&#39;</pre><p>This command will give you a complex output starting with $pbkdf2-sha512$310000$.... Copy this output.</p><p><strong>Step 1.2: Updating the configuration.yml File</strong></p><p>Open Authelia’s configuration file and add the Beszel OIDC client settings under the identity_providers section:</p><pre>identity_providers:<br>  oidc:<br>    hmac_secret: &quot;oidc_hmac_secret_that_should_be_long_and_random&quot;<br>    clients:<br>      - client_id: beszel<br>        client_name: Beszel<br>        # Write the HASHED password you got from the command output here<br>        client_secret: &quot;$pbkdf2-sha512$310000$...&quot; <br>        public: false<br>        authorization_policy: one_factor<br>        require_pkce: true<br>        pkce_challenge_method: S256<br>        redirect_uris:<br>          # This is the default OIDC redirect address of PocketBase. Adjust your domain accordingly.<br>          - https://beszel.yourdomain.com/api/oauth2-redirect<br>        scopes:<br>          - openid<br>          - email<br>          - profile<br>        response_types:<br>          - code<br>        grant_types:<br>          - authorization_code<br>        access_token_signed_response_alg: none<br>        userinfo_signed_response_alg: none<br>        token_endpoint_auth_method: client_secret_basic<br>    jwks:<br>      - key: |<br>          # Your existing rsa private key</pre><p>After saving the changes, restart the Authelia container. Now Authelia is ready to meet the requests coming from Beszel.</p><h4>2. OIDC Activation on Beszel (PocketBase)</h4><p>Now that the Authelia side is ready, we must go to Beszel and tell it how to knock on Authelia’s door. As we mentioned earlier, these settings are not in Beszel’s main interface but in the PocketBase management panel.</p><ol><li>Access the PocketBase management panel by adding /_/ to the end of your Beszel interface (e.g., <a href="https://beszel.yourdomain.com/_/).">https://beszel.yourdomain.com/_/).</a></li><li>Log in to the panel with the admin account you created in Beszel.</li><li>Go to the <strong>Settings &gt; Application</strong> tab from the left menu and turn off the “Hide collection create and edit controls” setting.</li><li>Return to the <strong>Users</strong> page and click the settings button at the top. In the opened window, first switch to the <strong>API Rules</strong> tab. To allow users who successfully log in via OIDC to be created automatically in the database, unlock the “Create rule” field at the very bottom and leave it completely empty (<em>Leave empty to grant everyone access</em>).</li><li>Then go to the <strong>Options</strong> page in the same window, and click the <strong>Add Provider</strong> button in the OAuth2 tab.</li><li>Select the <strong>OpenID Connect (oidc)</strong> option located at the very bottom of the options that appear and fill it out according to the information you created in Authelia.</li></ol><p>Define the Endpoint addresses according to your Authelia structure as follows:</p><ul><li><strong>Auth URL:</strong> <a href="https://auth.yourdomain.com/api/oidc/authorization">https://auth.yourdomain.com/api/oidc/authorization</a></li><li><strong>Token URL:</strong> <a href="https://auth.yourdomain.com/api/oidc/token">https://auth.yourdomain.com/api/oidc/token</a></li><li><strong>User API URL:</strong> <a href="https://auth.yourdomain.com/api/oidc/userinfo">https://auth.yourdomain.com/api/oidc/userinfo</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_hmm8ZoQRLlT-YxF-kzdcw.png" /><figcaption>Besel oidc settings</figcaption></figure><blockquote><strong>Warning:</strong> After integration, when you try to log in with Authelia, the login window should close as a popup and redirect to the system. If the window opens in a new tab instead of closing and you get a 404 Not Found error at the end of the process, this indicates that the redirect_uri in your Authelia configuration and the authorization callback URL expected by PocketBase do not match exactly. Make sure the URL is complete and matches exactly in the configuration file on the Authelia side.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sIbQMb7Pl3nRz-91E_WE3A.png" /></figure><p>Now when we come to the Beszel login page, we can select the Authelia option and log in with our LDAP credentials we created on LLDAP.</p><h4>3. Authorizing New Users to See Servers</h4><p>When a user logs in with OIDC, their account is successfully created in the background, but they cannot see any monitored servers on the main screen. In the Beszel architecture, for security reasons, which server resources each user can monitor must be matched manually.</p><ol><li>Log in to the PocketBase admin panel (/_/) again with admin privileges.</li><li>Open the <strong>Collections &gt; systems</strong> tab from the left menu.</li><li>A list of the servers you are monitoring (e.g., contabo) will appear. Click on the record of the server you want to grant authorization for to open the edit window.</li><li>Click on the users field located at the bottom of the opened tab.</li><li>A list of users registered in the system who just logged in will open. Select the people you want to see this server and save by clicking <strong>“Save changes”</strong>.</li></ol><h3>Early Warning System: Telegram, Email, and Thresholds</h3><p>Monitoring system resources is important, but the real issue is being informed instantly when there is an anomaly on our server while we are not in front of the screen. We will set up two different notification channels on Beszel that will warn us when the thresholds we set are exceeded or a critical service stops: Corporate Zoho Mail, whose infrastructure we prepared in Part 4, and Telegram for instant communication.</p><h4>1. Setting Up Email Notifications</h4><p>We configure the SMTP settings for Beszel to send emails again via PocketBase in the background.</p><ol><li>Log in to the PocketBase admin panel (/_/).</li><li>Click the Settings icon on the left panel and open the <strong>Mail settings</strong> menu.</li><li>First, configure the general settings to determine who the emails will be sent from.</li><li>Activate the <strong>“Use SMTP mail server (recommended)”</strong> option right below it.</li><li>We define our corporate Zoho Mail information that we created in Part 4 in the fields here:</li></ol><ul><li><strong>SMTP server host:</strong> smtp.zoho.eu (or smtp.zoho.com depending on your account)</li><li><strong>Port:</strong> 587</li><li><strong>Username:</strong> Your email address to authenticate with (e.g., info@yourdomain.com)</li><li><strong>Password:</strong> Your Zoho Mail password (or the specific app password you created for SMTP)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5MQ2EMpQWrYO6NyfvjwByA.png" /><figcaption>Beszel mail settings</figcaption></figure><p>After entering all the information, test whether the configuration is working correctly with the <strong>“Send test email”</strong> button at the bottom right.</p><h4>2. Setting Up Telegram Notifications (Beszel UI and Shoutrrr)</h4><p>Since emails can sometimes be missed, instant Telegram notifications are much more effective in emergencies. Beszel uses Shoutrrr, a popular library for these integrations. Therefore, we will do the configuration by creating a specific URL format.</p><p><strong>Step 2.1: Creating a Telegram Bot and Getting a Token</strong></p><ol><li>Type BotFather in the search bar in the Telegram app and enter the verified (blue ticked) bot.</li><li>Set a name and username for your bot by sending the /newbot command.</li><li>At the end of the process, BotFather will give you an HTTP API Token. Copy this long text (e.g., 1234567890:ABCdefGhIJKlmNoPQRstUvwxYZ) and note it down.</li><li>Search for the bot you created on Telegram, find it, and start the chat between you and the bot by saying /start. <em>(If you don&#39;t start it, the bot cannot send you messages).</em></li></ol><p><strong>Step 2.2: Finding Your Own Chat ID</strong></p><ol><li>To receive notifications, you need to know your own account number (Chat ID).</li><li>Type userinfobot or getmyid_bot in the Telegram search section and send the /start command to the bot.</li><li>The bot will tell you your ID number (e.g., 987654321). Note this down too.</li></ol><p><strong>Step 2.3: Creating the Shoutrrr URL and Adding It to Beszel</strong> The Telegram URL format for Shoutrrr is as follows: telegram://&lt;bot_token&gt;@telegram/?chats=&lt;chat_id&gt;</p><p>We follow these steps to use the URL we created:</p><ol><li>Log in to the Beszel main interface (Hub).</li><li>Go to the <strong>Settings</strong> tab from the top menu, then to the <strong>Notifications</strong> section.</li><li>Click the <strong>“+ Add URL”</strong> button under the “Webhook / Push notifications” heading.</li><li>Paste the URL starting with telegram://... that you created into this field.</li><li>Verify that the test message comes from Telegram by pressing the <strong>“Test URL”</strong> button right next to it.</li><li>If the process is successful, complete the process by pressing the <strong>“Save Settings”</strong> button at the bottom of the page.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BejpxSMFWA4094unykz6vA.png" /></figure><h4>3. Threshold and Alarm Definition</h4><p>Now that our notification channels (Mail and Webhook/Telegram) are ready, we can determine in which situations the system will warn us. Instead of “instantaneous” spikes on Beszel, setting alarms for ongoing bottlenecks is the healthiest method.</p><ol><li>On the Beszel main screen (Systems table), go to the details of the server you are monitoring (e.g., contabo).</li><li>On the graph that appears, click the Bell icon next to the metric you want to set an alarm for (CPU, Memory, Disk, or Container Status).</li><li>Determine your threshold and duration in the window that appears. For example:</li></ol><ul><li><strong>For Memory (RAM):</strong> “Warn me if usage exceeds 85% and this situation continues for 5 minutes.”</li><li><strong>For System Status:</strong> “Warn instantly if the server connection drops (goes Offline).”</li></ul><p>When these alarms we set are triggered, Beszel will communicate instantly via the Mail and Webhook (Telegram) channels we just configured.</p><p>With these steps, we have completely finished the Beszel side of our server monitoring and early warning system. Now our server resources (CPU, RAM, Disk) are secure, and in case of a possible bottleneck, the system will instantly warn us from the channels we determined.</p><p>However, our monitoring architecture is not complete yet. Just like monitoring system resources, we need to move the logs produced by our running applications to a centralized, searchable, and visualizable structure instead of connecting to the server via SSH and reading them one by one.</p><p>In the next article of the series (<strong>Part 6 — Part 2</strong>), we will build our log infrastructure by installing <strong>Loki</strong>, which optimizes disk and memory usage by indexing only labels instead of traditional logging solutions that consume high system resources, our log aggregator <strong>Promtail</strong>, and our visualization layer <strong>Grafana</strong>. See you in Part 2!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=823eb77fc4ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kendi PaaS Altyapımızı Kuruyoruz (Bölüm 6) — Part 2: Merkezi Log Yönetimi (Loki, Promtail &…]]></title>
            <link>https://myakupoglu.medium.com/kendi-paas-altyap%C4%B1m%C4%B1z%C4%B1-kuruyoruz-b%C3%B6l%C3%BCm-6-part-2-merkezi-log-y%C3%B6netimi-loki-promtail-438f3ec942e1?source=rss-3cfe97f9cd14------2</link>
            <guid isPermaLink="false">https://medium.com/p/438f3ec942e1</guid>
            <category><![CDATA[promtail]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[grafana-loki]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Muhammet İkbal Yakupoglu]]></dc:creator>
            <pubDate>Tue, 31 Mar 2026 19:30:22 GMT</pubDate>
            <atom:updated>2026-03-31T19:30:23.043Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kendi PaaS Altyapımızı Kuruyoruz (Bölüm 6) — Part 2: Merkezi Log Yönetimi (Loki, Promtail &amp; Grafana)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p57Hxig-pXacN1kY8_F2tQ.png" /></figure><p>Serimizin bir önceki yazısında (Part 1), sunucu kaynaklarımızı Beszel ile izlemeye almış ve erken uyarı sistemimizi kurmuştuk. Şimdi ise monitoring mimarimizin ikinci büyük ayağı olan <strong>Merkezi Log Yönetimi</strong>’ne geçiyoruz.</p><p>Kendi PaaS altyapımızda onlarca farklı Docker konteyneri (veritabanları, API’lar, web arayüzleri, proxy’ler) çalışıyor. Herhangi bir uygulamada hata oluştuğunda sunucuya SSH ile bağlanıp tek tek docker logs &lt;container_name&gt; komutuyla log aramak, sistem büyüdükçe sürdürülemez bir hale gelir. Bize logları merkezi bir yere toplayacak, etiketleyecek ve arama yapmamızı sağlayacak, ancak sunucuyu da yormayacak hafif bir yapı gerekiyor.</p><p>Yüksek sistem kaynağı tüketen geleneksel loglama çözümleri (Örn: ElasticSearch) yerine, sadece etiketleri indeksleyerek disk ve bellek kullanımını inanılmaz derecede optimize eden <strong>Loki</strong>, sunucudaki logları toplayıp Loki’ye ileten <strong>Promtail</strong> ve bu verileri okuyacağımız görselleştirme katmanımız <strong>Grafana</strong> üçlüsünü kullanacağız.</p><h4>Mimaride Güvenlik: Authelia OIDC Entegrasyonu</h4><p>Bu bölümde “Zero Trust” felsefemizi uygulamaya devam ediyoruz. Grafana paneline güvenli erişim sağlamak için <strong>Grafana’yı doğrudan Authelia’ya bir OIDC (OpenID Connect) istemcisi olarak</strong> bağlıyoruz.</p><p>Bu modern yaklaşım sayesinde Traefik tarafında ekstra bir middleware kullanmamıza gerek kalmıyor; giriş yapmak isteyen kullanıcıyı Grafana’nın kendisi doğrudan Authelia’nın güvenli giriş ekranına yönlendiriyor. Üstelik Authelia’dan dönen grup bilgilerine göre kullanıcıya Grafana içerisinde otomatik olarak “Admin” veya “Viewer” yetkisi atayabiliyoruz.</p><h3>Adım 1: Yapılandırma Dosyalarının Hazırlanması</h3><p>Kuruluma geçmeden önce sunucumuzda (örneğin /home/user/grafana/ dizininde) Promtail ve Loki&#39;nin ihtiyaç duyacağı iki temel yapılandırma dosyasını oluşturmalıyız.</p><h4>1. Promtail Konfigürasyonu (promtail-config.yaml)</h4><p>Promtail’in Docker konteynerlerinin loglarını okuyabilmesi ve etiketleyerek Loki’ye gönderebilmesi için gerekli ayar dosyasıdır. İzleme araçlarının kendi loglarını göndermesini engelleyerek log kirliliğini önlüyor ve olası etiket (label) hatalarını çözüyoruz.</p><pre>server:<br>  http_listen_port: 9080<br>  grpc_listen_port: 0<br><br>positions:<br>  filename: /tmp/positions.yaml<br><br>clients:<br>  - url: http://loki:3100/loki/api/v1/push<br><br>scrape_configs:<br>  - job_name: docker<br>    docker_sd_configs:<br>      - host: unix:///var/run/docker.sock<br>        refresh_interval: 5s<br>    relabel_configs:<br>      - source_labels: [&#39;__meta_docker_container_name&#39;]<br>        regex: &#39;/(.*)&#39;<br>        target_label: &#39;container&#39;</pre><h4>2. Loki Konfigürasyonu (loki-config.yaml)</h4><p>Loki’nin logları nereye kaydedeceğini ve saklama sürelerini belirlediğimiz dosyadır.</p><blockquote>İlerleyen bölümlerde altyapımıza MinIO (S3 Object Storage) kurduğumuzda bu ayarı s3 standartlarına uygun olarak minio depolamaya taşıyacağız. Şimdilik logları sunucunun kendi diskinde (filesystem) tutacak şekilde yapılandırıyoruz.</blockquote><pre>auth_enabled: false<br><br>server:<br>  http_listen_port: 3100<br>  grpc_listen_port: 9096<br><br>common:<br>  path_prefix: /loki<br>  storage:<br>    filesystem:<br>      chunks_directory: /loki/chunks<br>      rules_directory: /loki/rules<br>  replication_factor: 1<br>  ring:<br>    instance_addr: 127.0.0.1<br>    kvstore:<br>      store: inmemory<br><br>schema_config:<br>  configs:<br>    - from: 2020-10-24<br>      store: boltdb-shipper<br>      object_store: filesystem<br>      schema: v11<br>      index:<br>        prefix: index_<br>        period: 24h<br><br>storage_config:<br>  boltdb_shipper:<br>    active_index_directory: /loki/index<br>    cache_location: /loki/index_cache<br>    shared_store: filesystem<br>  filesystem:<br>    directory: /loki/chunks<br><br>compactor:<br>  working_directory: /loki/boltdb-shipper-compactor<br>  shared_store: filesystem<br>  retention_enabled: true<br><br># Performans ve Limit Ayarları<br>limits_config:<br>  retention_period: 720h # Loglar 30 gün saklanır<br>  reject_old_samples: true<br>  reject_old_samples_max_age: 168h<br>  allow_structured_metadata: true<br>  max_query_parallelism: 32<br>  split_queries_by_interval: 15m<br>  max_line_size: 512KB<br><br>query_scheduler:<br>  max_outstanding_requests_per_tenant: 2048<br><br>frontend:<br>  compress_responses: true</pre><h4>3. Authelia Tarafında Grafana İstemcisinin Oluşturulması</h4><p>Son hazırlık olarak, Grafana’nın OIDC taleplerini Authelia’nın kabul edebilmesi için configuration.yml dosyasına Grafana&#39;yı eklemeliyiz.</p><ol><li>Sunucunuzda Grafana için belirlediğiniz şifreyi (Örn:GizliSifre123) hash&#39;leyin:</li></ol><pre>docker run authelia/authelia:latest authelia crypto hash generate pbkdf2 --password &#39;GizliSifre123&#39;</pre><ol><li>Çıkan hash değerini kopyalayıp Authelia ayar dosyanızdaki identity_providers -&gt; oidc -&gt; clients listesine şu bloğu ekleyin:</li></ol><pre>identity_providers:<br>  oidc:<br>    hmac_secret: hmac-secret<br>    clients:<br>      - client_id: grafana<br>        client_name: Grafana<br>        client_secret: &quot;$pbkdf2-sha512$310000$...&quot; # Ürettiğiniz hash buraya gelecek<br>        public: false<br>        authorization_policy: one_factor<br>        require_pkce: true<br>        pkce_challenge_method: S256<br>        redirect_uris:<br>          # Kendi domaininize göre düzenleyin<br>          - https://grafana.domaininiz.com/login/generic_oauth<br>        scopes:<br>          - openid<br>          - profile<br>          - email<br>          - groups<br>        response_types:<br>          - code<br>        grant_types:<br>          - authorization_code</pre><p>Değişiklikleri kaydedip Authelia konteynerini yeniden başlatın. Altyapı artık Grafana’yı karşılamaya hazır.</p><h3>Adım 2: Docker Compose Kurulumu</h3><p>Konfigürasyon dosyalarımız hazır olduğuna göre, tüm yapıyı Dokploy üzerinden tek bir docker-compose.yml ile ayağa kaldırabiliriz. Burada Grafana&#39;nın ortam değişkenlerine dikkat edin. Authelia entegrasyonunu ve rol eşleştirmelerini tamamen buradan yapıyoruz.</p><pre>services:<br>  loki:<br>    image: grafana/loki:2.9.2<br>    container_name: loki<br>    labels:<br>      - &quot;app_name=loki&quot;<br>    restart: unless-stopped<br>    expose:<br>      - &quot;3100&quot;<br>    command: <br>      -config.file=/etc/loki/local-config.yaml<br>    volumes:<br>      - /home/user/grafana/loki-config.yaml:/etc/loki/local-config.yaml<br>    networks:<br>      - dokploy-network<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;wget -q --spider http://localhost:3100/ready || exit 1&quot;]<br>      interval: 30s<br>      timeout: 5s<br>      retries: 3<br>      start_period: 20s<br><br>  promtail:<br>    image: grafana/promtail:3.0.0<br>    container_name: promtail<br>    labels:<br>      - &quot;app_name=promtail&quot;<br>    restart: unless-stopped<br>    volumes:<br>      - /home/user/grafana/promtail-config.yaml:/etc/promtail/config.yaml<br>      - /var/run/docker.sock:/var/run/docker.sock:ro<br>      - /var/lib/docker/containers:/var/lib/docker/containers:ro<br>    command: <br>      -config.file=/etc/promtail/config.yaml<br>    networks:<br>      - dokploy-network<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;test -e /etc/promtail/config.yaml || exit 1&quot;]<br>      interval: 30s<br>      timeout: 5s<br>      retries: 3<br>      start_period: 5s<br><br>  grafana:<br>    image: grafana/grafana:latest<br>    container_name: grafana-logs<br>    restart: always <br>    environment:<br>      - GF_SERVER_DOMAIN=grafana.domaininiz.com<br>      - GF_SERVER_ROOT_URL=https://grafana.domaininiz.com/<br>      <br>      # Güvenlik: Varsayılan giriş formunu kapatıyor, direkt OIDC&#39;ye yönlendiriyoruz<br>      - GF_AUTH_DISABLE_LOGIN_FORM=true<br>      - GF_AUTH_OAUTH_AUTO_LOGIN=true<br><br>      # OIDC (Authelia) Ayarları<br>      - GF_AUTH_GENERIC_OAUTH_ENABLED=true<br>      - GF_AUTH_GENERIC_OAUTH_USE_PKCE=true<br>      - GF_AUTH_GENERIC_OAUTH_NAME=Authelia<br>      - GF_AUTH_GENERIC_OAUTH_CLIENT_ID=grafana<br>      - GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET=SizinGizliSifreniz # Authelia&#39;ya vereceğimiz düz şifre<br>      - GF_AUTH_GENERIC_OAUTH_SCOPES=openid profile email groups<br>      - GF_AUTH_GENERIC_OAUTH_AUTH_URL=https://auth.domaininiz.com/api/oidc/authorization<br>      - GF_AUTH_GENERIC_OAUTH_TOKEN_URL=https://auth.domaininiz.com/api/oidc/token<br>      - GF_AUTH_GENERIC_OAUTH_API_URL=https://auth.domaininiz.com/api/oidc/userinfo<br>      - GF_AUTH_GENERIC_OAUTH_ALLOW_SIGN_UP=true # Yeni userların oluşması için gerekli<br><br>      - GF_AUTH_GENERIC_OAUTH_LOGIN_ATTRIBUTE_PATH=preferred_username<br>      - GF_AUTH_GENERIC_OAUTH_NAME_ATTRIBUTE_PATH=name<br>      - GF_AUTH_GENERIC_OAUTH_EMAIL_ATTRIBUTE_PATH=email<br>      - GF_AUTH_GENERIC_OAUTH_ROLE_ATTRIBUTE_PATH=&#39;Admin&#39; # Default admin rolü veriyorum (ldap grupları üzerinden yönetilebilir)<br>    volumes:<br>      - grafana-storage:/var/lib/grafana<br>    labels:<br>      - &quot;traefik.enable=true&quot;<br>      - &quot;traefik.http.routers.grafana.rule=Host(`grafana.domaininiz.com`)&quot;<br>      - &quot;traefik.http.routers.grafana.entrypoints=websecure&quot;<br>      - &quot;traefik.http.routers.grafana.tls.certresolver=letsencrypt&quot;<br>      - &quot;traefik.http.routers.grafana.service=grafana&quot;<br>      - &quot;traefik.http.services.grafana.loadbalancer.server.port=3000&quot;<br>    networks:<br>      - dokploy-network<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;curl -f http://localhost:3000/api/health || exit 1&quot;]<br>      interval: 30s<br>      timeout: 10s<br>      retries: 3<br>      start_period: 30s<br><br>volumes:<br>  grafana-storage:<br><br>networks:<br>  dokploy-network:<br>    external: true</pre><h3>Adım 3: Grafana’ya Loki’yi Ekleme ve Logları İzleme</h3><p>Grafana adresinize (https://grafana.domaininiz.com) girdiğinizde doğrudan Authelia giriş ekranı sizi karşılayacaktır. Giriş yaptıktan sonra son adımımız Grafana&#39;ya logları nereden çekeceğini göstermek.</p><ol><li>Grafana sol menüsünden <strong>Connections &gt; Data Sources</strong> adımlarına gidin.</li><li><strong>Add data source</strong> butonuna tıklayıp listeden <strong>Loki</strong>’yi seçin.</li><li>URL kısmına, uygulamalar aynı Docker ağında bulunduğu için doğrudan http://loki:3100 yazın.</li><li>Sayfanın altındaki <strong>Save &amp; Test</strong> butonuna tıklayarak bağlantıyı onaylayın</li></ol><p><strong>Grafik Görünümü İpucu (Scattered Dots Çözümü):</strong> Loki verilerini Grafana’da Explore sekmesinde incelerken veya log hacmini gösteren özel bir zaman çizelgesi paneli oluşturduğunuzda, grafiklerin kesintisiz bir hat yerine dağınık, kopuk noktalar şeklinde göründüğünü fark edebilirsiniz.</p><p>Bunu düzeltmek için panelinizin sağ tarafındaki ayarlar menüsünde <strong>Graph styles</strong> altındaki <strong>Line interpolation</strong> seçeneğini Linear veya Smooth olarak değiştirip, <strong>Connect null values</strong> seçeneğini Always olarak ayarlamanız yeterlidir. Grafiğiniz anında sürekli ve okunabilir bir akışa dönüşecektir.</p><p>Aşağıda grafanayla alakalı yararlı olabileceğini düşündüğüm linkleri bırakıyorum.</p><ul><li><a href="https://github.com/grafana/grafana">https://github.com/grafana/grafana</a></li><li><a href="https://play.grafana.org/dashboards/f/examples/examples">https://play.grafana.org/dashboards/f/examples/examples</a></li></ul><p>Artık sistem kaynaklarımızı Beszel ile izliyor, tüm Docker konteynerlerimizin loglarını ise Loki ve Grafana üzerinden tek bir merkezden güvenle sorgulayabiliyoruz. Kendi PaaS altyapımızın izlenebilirlik katmanını profesyonel standartlarda inşa etmiş olduk.</p><p>Ancak uygulamalarımız çalıştıkça ve kullanıcı verileri biriktikçe, sistemin en değerli ve en hassas parçası olan <strong>veritabanlarının güvenliği</strong> bir numaralı önceliğimiz haline gelir. Production veritabanlarını diğer uygulamalarla aynı ağ karmaşasında bırakmak veya manuel yedeklemelere güvenmek büyük bir risktir.</p><p>Serinin bir sonraki yazısında (<strong>Bölüm 7: Veritabanı İzolasyonu ve Yedekleme</strong>), uygulamalarımızın kalbi olan veritabanlarımızı (PostgreSQL, MySQL, Redis vb.) altyapımızda nasıl izole edeceğimizi ve veri kaybını sıfıra indirmek için otomatik bulut yedekleme (yedeklerin şifrelenerek saklanması, S3/MinIO entegrasyonu vb.) stratejilerini nasıl yapılandıracağımızı ele alacağız.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=438f3ec942e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kendi PaaS Altyapımızı Kuruyoruz (Bölüm 6) — Part 1: Sunucu İzleme ve Erken Uyarı Sistemi (Beszel)]]></title>
            <link>https://myakupoglu.medium.com/kendi-paas-altyap%C4%B1m%C4%B1z%C4%B1-kuruyoruz-b%C3%B6l%C3%BCm-6-part-1-sunucu-i%CC%87zleme-ve-erken-uyar%C4%B1-sistemi-beszel-6c9118a12435?source=rss-3cfe97f9cd14------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c9118a12435</guid>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[beszel]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[dokploy]]></category>
            <dc:creator><![CDATA[Muhammet İkbal Yakupoglu]]></dc:creator>
            <pubDate>Tue, 31 Mar 2026 19:28:21 GMT</pubDate>
            <atom:updated>2026-03-31T19:28:21.511Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6afikpJ1oc-dVCeDqK_btw.png" /></figure><p>Önceki bölümlerde sunucu altyapımızı kurduk, Cloudflare ile DNS yönetimini sağladık, Dokploy’u yapılandırdık ve Authelia ile merkezi kimlik yönetimini (SSO) devreye aldık. Altyapımız ayağa kalkıp servisler çalışmaya başladıktan sonra, sistemin sağlıklı bir şekilde işlemeye devam ettiğinden emin olmak için kapsamlı bir izleme ve log yönetimi mimarisine ihtiyaç duyarız.</p><p>Konunun kapsamlı ve detaylı olması sebebiyle Bölüm 6’yı iki ayrı parçaya ayırdık. Bu yazımızda, sunucu kaynaklarımızı yormayan hafif ve modern bir araç olan <strong>Beszel</strong>’i kuracak; OIDC entegrasyonunu yapacak ve erken uyarı sistemimizi yapılandıracağız. Serinin bir sonraki yazısında ise uygulama loglarımızı merkezi bir ekranda toplamak için <strong>Loki, Promtail ve Grafana</strong> üçlüsünü ele alacağız.</p><h3>Beszel ile Hafif ve Modern Sunucu İzleme</h3><p>Geleneksel Prometheus ve Node Exporter kurulumlarına kıyasla çok daha hafif olan Beszel, arka planda PocketBase kullanır ve sistem kaynaklarını minimum düzeyde tüketir.</p><p>Beszel’i Dokploy’un “Compose” özelliği üzerinden ayrı bir servis olarak ayağa kaldırıyoruz. Aşağıdaki docker-compose.yml dosyası, Beszel ana uygulamasını ve metrikleri toplayacak ajanı içerir.</p><pre>services:<br>  beszel:<br>    image: henrygd/beszel:latest<br>    container_name: beszel<br>    restart: unless-stopped<br>    ports:<br>      - &quot;8090:8090&quot;<br>    environment:<br>      # Hub kendi adresini bilsin diye<br>      APP_URL: http://localhost:8090<br>    volumes:<br>      # Klasör yolu yerine isimlendirilmiş volume kullanıyoruz<br>      - beszel_data:/beszel_data<br><br>  beszel-agent:<br>    image: henrygd/beszel-agent:latest<br>    container_name: beszel-agent<br>    restart: unless-stopped<br>    # Agent&#39;ın sunucu kaynaklarını (CPU, RAM, Disk) doğru okuması için host modu şart<br>    network_mode: host<br>    environment:<br>      # Agent host modunda olduğu için Hub&#39;a localhost üzerinden ulaşır<br>      HUB_URL: &quot;http://127.0.0.1:8090&quot;<br>      # KEY kısmını Beszel panelinden aldığın &quot;ssh-ed25519...&quot; anahtarıyla doldurmalısın<br>      KEY: &quot;BURAYA_KEY_GELECEK&quot;<br>      TOKEN: &quot;BURAYA_TOKEN_GELECEK&quot;<br>    volumes:<br>      # Agent verileri için volume<br>      - beszel_agent_data:/beszel_agent_data<br>      # Docker istatistiklerini okuyabilmesi için bu zorunlu<br>      - /var/run/docker.sock:/var/run/docker.sock:ro<br><br># Volume&#39;leri burada tanımlıyoruz, Docker bunları otomatik oluşturacak<br>volumes:<br>  beszel_data:<br>  beszel_agent_data:</pre><h4>Beszel Hub ve Agent Bağlantısı: KEY Nereden Alınır?</h4><p>Yukarıdaki compose dosyasında yer alan KEY değişkeni, Hub ile Agent&#39;ın güvenli bir şekilde haberleşmesini sağlayan açık anahtardır (Public Key). Bu anahtarı almak için şu adımları izlemeliyiz:</p><ol><li>Öncelikle compose dosyasında beszel-agent kısmını yoruma alıp sadece beszel servisini ayağa kaldırın.</li><li>Beszel arayüzüne (Örn: http://100.x.x.x:8090 veya yönlendirdiğiniz domain) girerek ilk yönetici hesabınızı oluşturun. (VPN’e bağlı olduğunuzdan emin olun.)</li><li>Panele giriş yaptıktan sonra <strong>“Add System”</strong> butonuna tıklayın.</li><li>Sunucunuza bir isim verin ve ekrandaki talimatlarda size özel üretilen ssh-ed25519... ile başlayan <strong>Public Key (Genel Anahtar) </strong>değerini ve Tokeni kopyalayın.</li><li>Dokploy’daki compose dosyanıza geri dönüp, kopyaladığınız bu değeri beszel-agent servisindeki KEY ve TOKENortam değişkenine yapıştırın ve tüm yapıyı (Hub ve Agent birlikte) yeniden deploy edin.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*jwht5nO-O5X8goTlvzBihg.png" /></figure><p>Bu sayede Agent çalışmaya başladığında elindeki anahtar ile Hub’a başarıyla doğrulama yapacak ve metrikleri anlık olarak panele iletmeye başlayacaktır.</p><h3>Beszel: Merkezi Kimlik Yönetimi (OIDC) ve PocketBase Entegrasyonu</h3><p>Bölüm 5’te Authelia ve LLDAP ile merkezi kimlik yönetimimizi kurmuştuk. Beszel’in kendi içerisinde dahili bir kullanıcı yönetimi olsa da, arka planda veri tabanı ve kimlik doğrulama altyapısı olarak <strong>PocketBase</strong> kullanmaktadır. Bu sayede OIDC entegrasyonunu doğrudan PocketBase üzerinden yapılandırarak Beszel’e güvenli ve merkezi bir giriş (SSO) sağlayabiliriz.</p><p>Bu entegrasyonu iki aşamada gerçekleştireceğiz: Önce Authelia’ya Beszel’i tanıtacak, ardından Beszel’e Authelia’nın adreslerini göstereceğiz.</p><h4>1. Authelia Tarafında Beszel İstemcisinin (Client) Oluşturulması</h4><p>Beszel’in kimlik doğrulama taleplerini Authelia’nın kabul edebilmesi için öncelikle Authelia’nın yapılandırma dosyasında Beszel’i yetkili bir client olarak tanımlamamız gerekiyor.</p><p>Authelia güvenlik standartları gereği configuration.yml dosyasında client_secretdeğerlerini düz metin olarak kabul etmez. Parolanın hash’lenmiş halini konfigürasyona yazmamız gerekir.</p><p><strong>Adım 1.1: Secret İçin Hash Oluşturma</strong></p><p>Belirlediğiniz düz metin bir şifreyi (örneğin BenimGizliSifrem123) Authelia&#39;nın kabul edeceği PBKDF2 formatında hash&#39;lemek için sunucunuzda aşağıdaki Docker komutunu çalıştırın:</p><pre>docker run authelia/authelia:latest authelia crypto hash generate pbkdf2 --password &#39;BenimGizliSifrem123&#39;</pre><p>Bu komut size $pbkdf2-sha512$310000$... şeklinde başlayan karmaşık bir çıktı verecektir. Bu çıktıyı kopyalayın.</p><p><strong>Adım 1.2: configuration.yml Dosyasını Güncelleme</strong></p><p>Authelia’nın konfigürasyon dosyasını açarak identity_providers bölümünün altına Beszel OIDC istemci ayarlarını ekleyin:</p><pre>identity_providers:<br>  oidc:<br>    hmac_secret: &quot;oidc_hmac_secret_that_should_be_long_and_random&quot;<br>    clients:<br>      - client_id: beszel<br>        client_name: Beszel<br>        # Buraya komut çıktısından aldığınız HASH&#39;lenmiş şifreyi yazıyorsunuz<br>        client_secret: &quot;$pbkdf2-sha512$310000$...&quot; <br>        public: false<br>        authorization_policy: one_factor<br>        require_pkce: true<br>        pkce_challenge_method: S256<br>        redirect_uris:<br>          # PocketBase&#39;in varsayılan OIDC dönüş adresidir. Domaininizi buna göre düzenleyin.<br>          - https://beszel.domaininiz.com/api/oauth2-redirect<br>        scopes:<br>          - openid<br>          - email<br>          - profile<br>        response_types:<br>          - code<br>        grant_types:<br>          - authorization_code<br>        access_token_signed_response_alg: none<br>        userinfo_signed_response_alg: none<br>        token_endpoint_auth_method: client_secret_basic<br>    jwks:<br>      - key: |<br>          # Mevcut rsa private key&#39;iniz</pre><p>Değişiklikleri kaydettikten sonra Authelia konteynerini yeniden başlatın. Artık Authelia, Beszel’den gelecek talepleri karşılamaya hazır.</p><h4>2. Beszel (PocketBase) Üzerinde OIDC Aktivasyonu</h4><p>Authelia tarafı hazır olduğuna göre, şimdi Beszel’e gidip Authelia’nın kapısını nasıl çalacağını söylemeliyiz. Daha önce belirttiğimiz gibi bu ayarlar Beszel’in ana arayüzünde değil, PocketBase yönetim panelindedir.</p><ol><li>Beszel arayüzünüzün sonuna /_/ ekleyerek PocketBase yönetim paneline ulaşın (Örn: <a href="https://beszel.domaininiz.com/_/).">https://beszel.domaininiz.com/_/).</a></li><li>Panele Beszel’de oluşturduğunuz admin hesabıyla giriş yapın.</li><li>Sol menüden <strong>Settings &gt; Application</strong> sekmesine gidin ve <strong>Hide collection create and edit controls</strong> ayarını kapatın.</li><li>Users sayfasına dönüp yukarıdan ayarlar butonuna tıklayın. Açılan pencerede öncelikle <strong>API Rules</strong> sekmesine geçin. OIDC üzerinden başarılı giriş yapan kullanıcıların veritabanında otomatik olarak oluşturulabilmesi için en alttaki <strong>Create rule</strong> alanını kilitten çıkarıp <strong>tamamen boş bırakın</strong> <em>(Leave empty to grant everyone access)</em>.</li><li>Daha sonra aynı penceredeki <strong>Options</strong> sayfasına gelip <strong>OAuth2</strong> sekmesinde <strong>Add Provider</strong> butonuna tıklayın.</li><li>Çıkan seçeneklerden en altta bulunan <strong>OpenID Connect (oidc)</strong> seçeneğini seçin ve Authelia’da oluşturduğunuz bilgilere göre doldurun.</li></ol><p>Endpoint adreslerini Authelia yapınıza göre şu şekilde tanımlayın:</p><ul><li><strong>Auth URL:</strong> <a href="https://auth.domaininiz.com/api/oidc/authorization">https://auth.domaininiz.com/api/oidc/authorization</a></li><li><strong>Token URL:</strong> <a href="https://auth.domaininiz.com/api/oidc/token">https://auth.domaininiz.com/api/oidc/token</a></li><li><strong>User API URL:</strong> <a href="https://auth.domaininiz.com/api/oidc/userinfo">https://auth.domaininiz.com/api/oidc/userinfo</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_hmm8ZoQRLlT-YxF-kzdcw.png" /><figcaption>Besel oidc ayarları</figcaption></figure><blockquote>Entegrasyon sonrasında Authelia ile giriş yapmaya çalıştığınızda, giriş penceresinin bir popup olarak kapanıp sisteme yönlendirmesi gerekir. Eğer pencere kapanmak yerine yeni bir sekmede açılıyor ve işlemin sonunda <strong>404 Not Found</strong> hatası alıyorsanız, bu durum Authelia konfigürasyonunuzdaki redirect_uri ile PocketBase&#39;in beklediği yetkilendirme dönüş adresinin (callback URL) tam olarak eşleşmediğini gösterir. Authelia tarafındaki yapılandırma dosyasında URL&#39;in eksiksiz ve tam eşleştiğinden emin olun.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sIbQMb7Pl3nRz-91E_WE3A.png" /></figure><p>Artık beszel giriş sayfasına geldiğimizde Authelia seçeneğini seçip lldap üzerinde oluşturduğumuz ldap bilgilerimizle giriş yapabiliriz.</p><h4>3. Yeni Kullanıcıların Sunucuları Görebilmesi İçin Yetkilendirilmesi</h4><p>Bir kullanıcı OIDC ile giriş yaptığında hesabı arka planda başarıyla oluşturulur ancak ana ekranda izlenen hiçbir sunucuyu göremez. Beszel mimarisinde güvenlik gereği her kullanıcının hangi sunucu kaynaklarını izleyebileceği manuel olarak eşleştirilmelidir.</p><ol><li>PocketBase admin paneline (/_/) yönetici yetkisiyle tekrar girin.</li><li>Sol menüden <strong>Collections &gt; systems</strong> sekmesini açın.</li><li>Karşınıza izlemekte olduğunuz sunucuların bir listesi (Örn: contabo) çıkacaktır. Yetki vermek istediğiniz sunucunun kaydına tıklayarak düzenleme penceresini açın.</li><li>Açılan sekmenin alt kısmında yer alan <strong>users</strong> alanına tıklayın.</li><li>Sistemde kayıtlı olan ve az önce giriş yapmış kullanıcıların listesi açılacaktır. Bu sunucuyu görmesini istediğiniz kişileri seçip <strong>Save changes</strong> diyerek kaydedin.</li></ol><h3>Erken Uyarı Sistemi: Telegram, E-Posta ve Eşik Değerleri (Threshold)</h3><p>Sistem kaynaklarını izlemek önemlidir ancak asıl mesele, biz ekran başında değilken sunucumuzda bir anormallik olduğunda anında haberdar olabilmektir. Beszel üzerinde, belirlediğimiz eşik değerleri aşıldığında veya kritik bir servis durduğunda bizi uyaracak iki farklı bildirim kanalı kuracağız: Bölüm 4&#39;te altyapısını hazırladığımız kurumsal Zoho Mail ve anlık iletişim için Telegram.</p><h4>1. E-Posta Bildirimlerinin Kurulumu</h4><p>Beszel’in e-posta gönderebilmesi için SMTP ayarlarını yine arka plandaki PocketBase üzerinden yapıyoruz.</p><ol><li>PocketBase admin paneline (/_/) giriş yapın.</li><li>Sol paneldeki <strong>Ayarlar</strong> ikonuna tıklayıp <strong>Mail settings</strong> menüsünü açın.</li><li>Öncelikle e-postaların kimden gideceğini belirlemek için genel ayarları yapın.</li><li>Hemen altındaki <strong>“Use SMTP mail server (recommended)”</strong> seçeneğini aktif hale getirin.</li><li>Bölüm 4&#39;te oluşturduğumuz kurumsal Zoho Mail bilgilerimizi buradaki alanlara tanımlıyoruz:</li></ol><ul><li><strong>SMTP server host:</strong> smtp.zoho.eu (veya hesabınıza göre smtp.zoho.com)</li><li><strong>Port:</strong> 587</li><li><strong>Username:</strong> Doğrulama yapacağınız mail adresiniz (Örn: info@domaininiz.com)</li><li><strong>Password:</strong> Zoho Mail şifreniz (veya SMTP için oluşturduğunuz özel uygulama parolası)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5MQ2EMpQWrYO6NyfvjwByA.png" /><figcaption>Beszel mail ayarları</figcaption></figure><p>Tüm bilgileri girdikten sonra sağ alttaki <strong>“Send test email”</strong> butonu ile yapılandırmanın doğru çalışıp çalışmadığını test edin.</p><h4>2. Telegram Bildirimlerinin Kurulumu (Beszel UI ve Shoutrrr)</h4><p>E-postalar bazen gözden kaçabileceği için anlık Telegram bildirimleri acil durumlarda çok daha etkilidir. Beszel bu entegrasyonlar için popüler bir kütüphane olan <strong>Shoutrrr</strong>’ı kullanır. Bu yüzden yapılandırmayı özel bir URL formatı oluşturarak yapacağız.</p><p><strong>Adım 2.1: Telegram Botu Oluşturma ve Token Alma</strong></p><ol><li>Telegram uygulamasında arama çubuğuna BotFather yazın ve doğrulanmış (mavi tikli) bota girin.</li><li>/newbot komutunu göndererek botunuza bir isim ve kullanıcı adı belirleyin.</li><li>İşlem sonunda BotFather size bir <strong>HTTP API Token</strong> verecektir. Bu uzun metni (Örn: 1234567890:ABCdefGhIJKlmNoPQRstUvwxYZ) kopyalayıp bir kenara not edin.</li><li>Kendi oluşturduğunuz botu Telegram’da aratıp bulun ve /start diyerek botla aranızdaki sohbeti başlatın. (Siz başlatmazsanız bot size mesaj gönderemez).</li></ol><p><strong>Adım 2.2: Kendi Chat ID’nizi Öğrenme</strong></p><ol><li>Bildirimlerin size gelebilmesi için kendi hesap numaranızı (Chat ID) bilmeniz gerekir.</li><li>Telegram arama kısmına userinfobot veya getmyid_bot yazıp bota /start komutunu gönderin.</li><li>Bot size <strong>ID</strong> numaranızı (Örn: 987654321) söyleyecektir. Bunu da not alın.</li></ol><p><strong>Adım 2.3: Shoutrrr URL’sini Oluşturma ve Beszel’e Ekleme</strong></p><p>Shoutrrr için Telegram URL formatı şu şekildedir: telegram://&lt;bot_token&gt;@telegram/?chats=&lt;chat_id&gt;</p><p>Oluşturduğumuz urli kullanmak için aşağıdaki adımları izliyoruz:</p><ol><li>Beszel ana arayüzüne (Hub) giriş yapın.</li><li>Üst menüden <strong>Ayarlar (Settings)</strong> sekmesine, ardından <strong>Bildirimler (Notifications)</strong> bölümüne geçin.</li><li><strong>“Webhook / Anlık bildirimler”</strong> başlığı altındaki <strong>“+ URL Ekle”</strong> butonuna tıklayın.</li><li>Oluşturduğunuz telegram://... ile başlayan URL&#39;yi bu alana yapıştırın.</li><li>Hemen yanındaki <strong>“URL’yi Test Et”</strong> butonuna basarak Telegram’dan test mesajının geldiğini doğrulayın.</li><li>İşlem başarılıysa sayfanın en altındaki <strong>“Ayarları Kaydet”</strong> butonuna basarak işlemi tamamlayın.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BejpxSMFWA4094unykz6vA.png" /></figure><h4>3. Eşik Değeri (Threshold) ve Alarm Tanımlama</h4><p>Bildirim kanallarımız (Mail ve Webhook/Telegram) hazır olduğuna göre, artık sistemin hangi durumlarda bizi uyaracağını belirleyebiliriz. Beszel üzerinde “anlık” sıçramalar yerine, sürekli devam eden darboğazlar için alarm kurmak en sağlıklı yöntemdir.</p><ol><li>Beszel ana ekranında (Sistemler tablosunda), izlediğiniz sunucunun (Örn: contabo) detaylarına gidin.</li><li>Karşınıza çıkan grafikte, alarm kurmak istediğiniz metriğin (CPU, Memory, Disk veya Container Status) yanındaki <strong>Zil ikonuna</strong> tıklayın.</li><li>Karşınıza çıkan pencerede eşik değerinizi ve süreyi belirleyin. Örneğin:</li></ol><ul><li><strong>Memory (RAM) için:</strong> “Kullanım %85&#39;in üzerine çıkarsa ve bu durum 5 dakika boyunca devam ederse beni uyar.”</li><li><strong>Sistem Durumu (Status) için:</strong> “Sunucu bağlantısı koparsa (Offline olursa) anında uyar.”</li></ul><p>Kurduğumuz bu alarmlar tetiklendiğinde, Beszel az önce ayarladığımız Mail ve Webhook (Telegram) kanalları üzerinden anında iletişime geçecektir.</p><p>Bu adımlarla birlikte sunucu izleme ve erken uyarı sistemimizin Beszel tarafını eksiksiz bir şekilde tamamlamış olduk. Artık sunucu kaynaklarımız (CPU, RAM, Disk) güvende ve olası bir darboğazda sistem bizi anında belirlediğimiz kanallardan uyaracak.</p><p>Ancak monitoring mimarimiz henüz tamamlanmadı. Sistem kaynaklarını izlemek kadar, çalışan uygulamalarımızın ürettiği logları da tek tek sunucuya SSH ile bağlanıp okumak yerine merkezi, aranabilir ve görselleştirilebilir bir yapıya taşımamız gerekiyor.</p><p>Serinin bir sonraki yazısında (<strong>Bölüm 6 — Part 2</strong>), yüksek sistem kaynağı tüketen geleneksel loglama çözümleri yerine, sadece etiketleri indeksleyerek disk ve bellek kullanımını optimize eden <strong>Loki</strong>, log toplayıcımız <strong>Promtail</strong> ve görselleştirme katmanımız <strong>Grafana</strong>’yı kurarak log altyapımızı inşa edeceğiz. Part 2&#39;de görüşmek üzere!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c9118a12435" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Our Own PaaS Infrastructure (Part 4): Corporate Email and Spam Protection with Zoho Mail…]]></title>
            <link>https://myakupoglu.medium.com/building-our-own-paas-infrastructure-part-4-corporate-email-and-spam-protection-with-zoho-mail-649ef657d3df?source=rss-3cfe97f9cd14------2</link>
            <guid isPermaLink="false">https://medium.com/p/649ef657d3df</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[cloudflare]]></category>
            <category><![CDATA[zohomail]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Muhammet İkbal Yakupoglu]]></dc:creator>
            <pubDate>Sat, 28 Mar 2026 19:01:00 GMT</pubDate>
            <atom:updated>2026-03-28T19:01:00.785Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Our Own PaaS Infrastructure (Part 4): Corporate Email and Spam Protection with Zoho Mail (SPF, DKIM, DMARC)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XbbirepbVApJYy2YKLALQg.png" /></figure><p>In the first three parts of our series, we spun up our server, established our Zero Trust architecture, and got the heart of our PaaS environment running with Dokploy. We are now ready to host our projects on our own server. However, before deploying our projects to production, we have one more highly critical infrastructure need: Corporate Communication.</p><p>To send emails professionally via our own domain (like contact@domain.com or noreply@domain.com), send verification emails for user registrations, or receive system alerts, we need a robust mail service. Moreover, it is of vital importance that these emails do not fall into users’ “Spam” folders.</p><p>In this part, we will integrate Zoho Mail, which is both a free and highly reliable solution, into our system, and maximize the reliability of our emails with the precise DNS settings (SPF, DKIM, DMARC) we will configure via Cloudflare.</p><h4>Why Don’t We Set Up Our Own Mail Service Inside the Server?</h4><p>You might think, “Since we set up our own server, let’s spin up the mail service internally using Docker as well.” However, the email world is extremely ruthless. Emails sent from a new IP address are instantly marked as spam by major providers like Gmail or Outlook. Managing IP reputation and dealing with blacklists is a full-time and highly exhausting job.</p><p>Therefore, delegating the email sending/receiving task (especially in the beginning phase) to professional services with high IP reputation is the most logical and headache-free way. For this purpose, we will use Zoho Mail’s “Forever Free” plan.</p><h4>1. Zoho Mail Registration and Domain Verification</h4><ol><li>Go to Zoho Mail’s website (<a href="https://www.zoho.com/mail/zohomail-pricing.html">https://www.zoho.com/mail/zohomail-pricing.html</a>) and sign up by finding the “Forever Free Plan” (up to 5 users) option at the bottom of the “Pricing” page.</li><li>During registration, the system will ask if you want to use an existing domain. Here, we enter our own domain (domain.com) that we manage on Cloudflare.</li><li>Zoho will want to verify that this domain actually belongs to us. It will give us a TXT or CNAME record.</li><li>Go to the Cloudflare dashboard, switch to the “DNS” tab of the relevant domain, and add this TXT/CNAME record provided by Zoho. When you click the “Verify” button from the Zoho panel, your domain ownership will be approved.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WCKgJIbQpFvk_qyvi4o9tw.png" /><figcaption>Cloudflare TXT definition</figcaption></figure><h4>2. DNS Mapping via Cloudflare (MX, SPF, and DKIM Records)</h4><p>After verifying the domain, Zoho presents you with a bulk <strong>DNS Mapping</strong> screen to route the email traffic to its own servers and prevent your emails from falling into Spam. The records you will see on this screen are the most critical components of your corporate email infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ThQuRFdVjTPL5oJI4eg5fg.png" /></figure><p>In this step, we will transfer the table shown on that screen exactly to our Cloudflare DNS panel.</p><p><strong>Important Note:</strong> Before switching to your Cloudflare panel, if there are leftover “MX” records on your domain from before, you need to delete them to avoid conflicts.</p><h4><strong>A. MX Records (Email Routing)</strong></h4><p>Ensures incoming emails reach Zoho servers. Add these three records to Cloudflare:</p><ul><li><strong>Type:</strong> MX | <strong>Name:</strong> @ | <strong>Mail Server:</strong> mx.zoho.eu | <strong>Priority:</strong> 10</li><li><strong>Type:</strong> MX | <strong>Name:</strong> @ | <strong>Mail Server:</strong> mx2.zoho.eu | <strong>Priority:</strong> 20</li><li><strong>Type:</strong> MX | <strong>Name:</strong> @ | <strong>Mail Server:</strong> mx3.zoho.eu | <strong>Priority:</strong> 50</li></ul><h4><strong>B. SPF and DKIM Records (Spam Protection)</strong></h4><p>These are the records that prove your identity so that the emails you send (password reset, notification, etc.) are not rejected by the receiving server or thrown into the Spam folder.</p><p>Again, from the Cloudflare DNS panel, we add these two TXT records:</p><p><strong>For SPF Record:</strong></p><ul><li><strong>Type:</strong> TXT | <strong>Name:</strong> @ | <strong>Content:</strong> v=spf1 include:zoho.eu ~all</li></ul><p><strong>For DKIM Record: </strong>The long encrypted text provided by Zoho)</p><ul><li><strong>Type:</strong> TXT | <strong>Name:</strong> zmail._domainkey | <strong>Content:</strong> v=DKIM1; k=rsa; p=MIGfMA0GC... (The long encrypted text provided by Zoho)</li></ul><p>After entering these records into Cloudflare, we click the “<strong>Verify All Records</strong>” button on the Zoho panel. If all status icons turn green, congratulations! Your corporate mail infrastructure is technically ready.</p><p><em>(Note: The records above belong to European (eu) servers. If you chose a different region while registering, take into account the .com or .in extensions in the table Zoho provided you).</em></p><h4>3. SMTP Configuration and “App-Specific Password” for Our Software Projects</h4><p>We set up our corporate email account and completed the DNS settings. Now it’s time to securely connect this account to our software projects (Node.js, Java/Spring Boot, etc.). The most critical rule you need to pay attention to here is this: Y<strong>ou must never write your main Zoho password into the codes or Environment Variables of your applications.</strong></p><p>Due to security protocols, you must generate a specific password for each application via Zoho and use a key independent of your main password. Here is the step-by-step path to follow:</p><h4>3.1. Creating an App-Specific Password</h4><ol><li><strong>Log In to Your Zoho Account:</strong> Go to the Zoho Accounts page and log in with your administrator account.</li><li><strong>Go to the Security Tab:</strong> Click on the Security heading in the left menu.</li><li><strong>Find App Passwords:</strong> Find the App Passwords option on the screen that opens and click on it.</li><li><strong>Generate a New Password:</strong> Press the Generate New Password button. It will ask you to enter an application name (e.g., my-backend-app). Type the name and confirm.</li><li><strong>Copy the Password:</strong> Zoho will give you a 16-character password specific only to that application. Copy this password to a secure place (you will not see this password again).</li></ol><h4>3.2. SMTP Connection Information for Your Projects</h4><p>Now you have a secure key. You can use the following information in your application’s email sending (SMTP) settings:</p><ol><li><strong>SMTP Server:</strong> smtp.zoho.eu (For European servers)</li><li><strong>Port:</strong> 587 (TLS)</li><li><strong>Username:</strong> contact@domain.com (Your corporate email address)</li><li><strong>Password:</strong> (The 16-character App-Specific Password you just created)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*NVjEdnDeIuOQT2DzPjVokA.png" /><figcaption>Spring Boot application example</figcaption></figure><h4>🔗 Useful Links</h4><ul><li><strong>Inbox:</strong> mail.zoho.eu</li><li><strong>Account &amp; Password Management:</strong> accounts.zoho.eu</li><li><strong>Admin Panel:</strong> mailadmin.zoho.eu/</li></ul><blockquote>💡 <strong>Note:</strong> Third-party mail clients (Gmail, etc.) might be restricted on Zoho’s free plan. For the healthiest use, prefer Zoho’s web interface or mobile app.</blockquote><p>In this part, we professionally set up our communication and notification system, which is one of the most important pillars of our PaaS infrastructure. With the Zoho Mail integration, we both gained a free corporate email infrastructure and prevented our emails from getting caught in spam filters thanks to the SPF records.</p><p>In the next step, we are entering the world of “Single Sign-On” (SSO), which will allow us to use a single key for all services in our infrastructure (Dokploy, Monitoring, Database interfaces, etc.). In the next part, we will talk about the <strong>Centralized Identity Management (LLDAP &amp; Authelia)</strong> setup and configuration. See you later!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=649ef657d3df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Our Own PaaS Infrastructure (Part 5): Centralized Identity Management (LLDAP & Authelia)]]></title>
            <link>https://myakupoglu.medium.com/building-our-own-paas-infrastructure-part-5-centralized-identity-management-lldap-authelia-95dca00de55c?source=rss-3cfe97f9cd14------2</link>
            <guid isPermaLink="false">https://medium.com/p/95dca00de55c</guid>
            <category><![CDATA[lldap]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[dokploy]]></category>
            <category><![CDATA[oidc]]></category>
            <category><![CDATA[authelia]]></category>
            <dc:creator><![CDATA[Muhammet İkbal Yakupoglu]]></dc:creator>
            <pubDate>Sat, 28 Mar 2026 19:01:00 GMT</pubDate>
            <atom:updated>2026-03-28T19:01:00.682Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IJq-jwBoB4sVXu_lCi8Q-w.png" /></figure><p>In the previous parts of our series, we completed server selection, DNS management with Cloudflare, Dokploy installation, and email integration. As we spin up monitoring, management, and other tools we will use strictly internally on our infrastructure, securing these applications against the outside world becomes a top priority.</p><p>Instead of setting up separate authentication mechanisms for each internal management tool, managing the entire system from a single center (SSO — Single Sign-On) is a much more sustainable approach. In this part, we will set up a centralized identity management infrastructure using LLDAP (Lightweight LDAP) and Authelia on Dokploy.</p><h3>The LLDAP and Authelia Choice</h3><p>Resource consumption is important when managing our own infrastructure. LLDAP is an alternative that consumes significantly fewer resources than traditional OpenLDAP and is quite simple to install. Authelia, on the other hand, works seamlessly with the Traefik reverse proxy we use in the background and performs user authentication via LDAP. It intercepts traffic before it reaches our internal applications and offers additional security layers like Two-Factor Authentication (2FA). The fact that both tools are completely open-source strengthens our preference in this direction, as it ensures system transparency and avoids vendor lock-in.</p><h3>1. LLDAP Installation on Dokploy</h3><p>As a first step, we create a new Compose project from the Dokploy interface and spin up LLDAP. A basic docker-compose.yml configuration is as follows:</p><pre>services:<br>  lldap:<br>    image: lldap/lldap:stable<br>    container_name: lldap<br>    restart: unless-stopped<br>    expose:<br>      - &quot;3890&quot;<br>      - &quot;17170&quot;<br>    environment:<br>      - LLDAP_JWT_SECRET=set_a_super_jwt_token<br>      - LLDAP_LDAP_BASE_DN=dc=domain,dc=local<br>      - LLDAP_LDAP_USER_PASS=set_a_super_pass<br>      - LLDAP_LDAP_USER_EMAIL=admin@domain.local<br>      - LLDAP_SERVER_KEY_SEED=random_seed_for_keys<br>      - LLDAP_DATABASE_URL=sqlite:///data/users.db?mode=rwc<br>    volumes:<br>      - lldap_data:/data<br>    networks:<br>      - dokploy-network<br>    labels:<br>      - &quot;traefik.enable=true&quot;<br>      <br>      # --- 1. LDAPS (Port 3890) ---<br>      - &quot;traefik.tcp.routers.lldap-tcp.rule=HostSNI(`ldap.domain.com`)&quot;<br>      - &quot;traefik.tcp.routers.lldap-tcp.entrypoints=ldaps&quot;<br>      - &quot;traefik.tcp.routers.lldap-tcp.tls=true&quot;<br>      - &quot;traefik.tcp.routers.lldap-tcp.tls.certresolver=letsencrypt&quot;<br>      - &quot;traefik.tcp.services.lldap-tcp.loadbalancer.server.port=3890&quot;<br>      <br>      # --- 2. WEB PANEL (Port 17170) ---<br>      - &quot;traefik.http.routers.lldap-web.rule=Host(`lldap.domain.com`)&quot;<br>      - &quot;traefik.http.routers.lldap-web.entrypoints=websecure&quot;<br>      - &quot;traefik.http.routers.lldap-web.tls.certresolver=letsencrypt&quot;<br>      - &quot;traefik.http.services.lldap-web.loadbalancer.server.port=17170&quot;<br>      # - &quot;traefik.http.routers.lldap-web.middlewares=authelia&quot; &lt;-- We will uncomment this after Part 3.<br>volumes:<br>  lldap_data:<br>networks:<br>  dokploy-network:<br>    external: true</pre><p>The critical points we need to pay attention to in this configuration are:</p><ul><li><strong>Use of </strong><strong>expose:</strong> For security reasons, instead of exposing the application&#39;s ports directly to the server using ports, we only opened them to Dokploy&#39;s internal network (dokploy-network) using expose. All incoming traffic from the outside will be filtered through Traefik before entering.</li><li><strong>LLDAP_LDAP_BASE_DN Setting (</strong><strong>dc=domain,dc=local):</strong> This line determines the root directory (Base DN) of our LDAP tree. Using the .local extension is a secure standard emphasizing that this authentication structure is not a public system open to the internet, but a closed system valid only within our internal network. If we were building a structure that directly serves the outside world and talks to systems like Active Directory over a public domain, we might have preferred .com. For our own PaaS infrastructure, .local is the most accurate approach. We need to update the domain name according to our own company name.</li><li><strong>Traefik TCP Router Definitions (LDAPS):</strong> The LDAP communication protocol works over raw TCP, not HTTP. Therefore, we managed the traffic coming to port 3890 with traefik.tcp labels and made the connections coming to ldap.domain.com secure (LDAPS) by encrypting them with TLS using HostSNI.</li><li><strong>Traefik HTTP Router Definitions (Web Panel):</strong> Port 17170, where LLDAP’s web interface runs, handles standard web traffic. We used traefik.http routings to override Dokploy&#39;s automatic assignments and access the panel via HTTPS over lldap.domain.com.</li></ul><p>After the container is running, you can go to lldap.domain.com, log in with your admin password, and create your first users and groups for Authelia to use.</p><h3>2. Authelia Installation and Configuration</h3><p>Next up is Authelia. Authelia requires a detailed configuration file (configuration.yml) to run. Before installing Authelia via Dokploy, we must create a physical directory on our server where we will host this configuration file.</p><p>For example, we can connect to our server via SSH and create our file under the /home/user/authelia/ directory:</p><pre>mkdir -p /home/user/authelia<br>nano /home/user/authelia/configuration.yml</pre><p>We will add Authelia’s general settings into this file. However, since our topic is identity management, the most critical part in the file is the authentication_backend section, where we specify how Authelia will talk to the LLDAP we just installed:</p><pre>################################################################<br>#                   Authelia Configuration                    #<br>###############################################################<br>theme: dark<br>server:<br>  address: &#39;tcp://0.0.0.0:9091&#39;<br>  buffers:<br>    read: 4096<br>    write: 4096<br>log:<br>  level: info<br># --- 1. IDENTITY VALIDATION ---<br>identity_validation:<br>  reset_password:<br>    jwt_secret: &quot;super_secret_jwt&quot; # Enter a random and strong secret<br># --- 2. SESSION ---<br>session:<br>  name: authelia_session<br>  secret: &quot;session_secret&quot; # Enter a random and strong secret<br>  expiration: 3600 # 1 hour<br>  inactivity: 300  # 5 minutes<br>  <br>  cookies:<br>    - domain: &quot;domain.com&quot; # YOUR OWN DOMAIN<br>      authelia_url: &quot;https://auth.domain.com&quot; # YOUR OWN DOMAIN<br>      default_redirection_url: &quot;https://domain.com&quot; # YOUR OWN DOMAIN<br>  <br>  redis:<br>    host: authelia-redis<br>    port: 6379<br># --- 3. AUTHENTICATION (LLDAP) ---<br>authentication_backend:<br>  ldap:<br>    implementation: custom<br>    address: ldap://lldap:3890<br>    timeout: 5s<br>    start_tls: false<br>    user: uid=admin,ou=people,dc=letradev,dc=local<br>    password: set_a_super_pass # Your LLDAP Admin password<br>    base_dn: dc=letradev,dc=local<br>    additional_users_dn: ou=people<br>    users_filter: (&amp;({username_attribute}={input})(objectClass=person))<br>    additional_groups_dn: ou=groups<br>    groups_filter: (member={dn})<br>    <br>    attributes:<br>      display_name: displayName<br>      group_name: cn<br>      mail: mail<br>      username: uid<br># --- 4. ACCESS CONTROL ---<br>access_control:<br>  default_policy: deny<br>  rules:<br>    - domain: &quot;auth.domain.com&quot; # YOUR OWN DOMAIN<br>      policy: bypass<br>    - domain: &quot;*.domain.com&quot; # YOUR OWN DOMAIN<br>      policy: one_factor<br>  <br># --- 5. OIDC ---<br>identity_providers:<br>  oidc:<br>    hmac_secret: &quot;long_hmac_secret&quot; # A random and strong secret<br>    <br>    jwks:<br>      - key: |<br>          -----BEGIN PRIVATE KEY-----<br>          YOUR_GENERATED_PRIVATE_KEY_GOES_HERE<br>          -----END PRIVATE KEY-----<br># --- 6. STORAGE ---<br>storage:<br>  encryption_key: &quot;long_encrypt_key&quot; # A random and strong secret<br>  <br>  local:<br>    path: /config/db.sqlite3<br># --- 7. NOTIFIER (Zoho Mail Integration) ---<br>notifier:<br>  smtp:<br>    address: &quot;smtp://smtp.zoho.eu:587&quot;<br>    username: &quot;contact@domain.com&quot;<br>    password: &quot;your_zoho_app_password&quot; # The app password we created in the panel<br>    sender: &quot;Authelia &lt;contact@domain.com&gt;&quot;</pre><h4><strong>Critical Points to Consider When Editing the File:</strong></h4><ol><li><strong>Strong Passwords (Secrets):</strong> The values marked as secret and encryption_key in the file (e.g., jwt_secret, session_secret, hmac_secret) must be replaced with unique and randomly generated strong strings. You can use tools like jwtsecretkeygenerator.com for this.</li><li><strong>Domain Updates:</strong> Do not forget to replace the domain.com and auth.domain.com values in the file with your own real domain name that you will use on Traefik.</li><li><strong>Access Control:</strong> For convenience at the start, the policy: one_factor (only username and password) example is used. If you want to make your system more secure, you can update this value to two_factor to mandate OTP (Authenticator apps, etc.).</li><li><strong>Authentication (LLDAP Backend):</strong> The authentication_backend section connects Authelia to the LLDAP database we installed in Step 1. Authelia queries this database directly to authenticate users.</li><li><strong>OIDC and JWKS (JSON Web Key Set):</strong> The JWKS in the OIDC section is used by Authelia to sign (encrypt) the authorization tokens it generates while providing identity to other applications via OpenID Connect. You must enter a valid RSA Private Key in this field. To generate your own key, you can spin up a temporary (dummy) Authelia container on your server and run the following command:</li></ol><pre>docker run --rm -v $(pwd):/keys authelia/authelia:latest authelia crypto pair rsa generate --directory /keys</pre><ol><li>This command outputs the private.pem and public.pem files to your current directory. You should copy the text inside the private.pem file and paste it into the jwks -&gt; key section in the YAML file.</li><li><strong>Notifications and Zoho SMTP:</strong> In Part 4 of our series, we set up our corporate email infrastructure with Zoho Mail. For Authelia to send password reset or device verification emails, we carry the Zoho settings exactly here. Since we use the European server, the address should be smtp://smtp.zoho.eu:587. In the password section, you must enter the App-Specific Password we created earlier from the Zoho panel, not your standard email password.</li></ol><h3>3. Authelia Compose and Traefik Middleware Installation</h3><p>Our configuration file is ready. Now we switch to the Dokploy interface and create a new Compose project for Authelia. Here, besides mounting the configuration file on the server as a volume, we will also define the Traefik Middleware that we will use to protect other services:</p><pre>services:<br>  authelia:<br>    image: authelia/authelia:latest<br>    container_name: authelia<br>    restart: unless-stopped<br>    ports: <br>      - &quot;100.x.x.x:9091:9091&quot; # Tailscale server ip<br>    volumes:<br>      # We mount the config file on the server to read it inside the container<br>      - /home/user/authelia/configuration.yml:/config/configuration.yml<br>      # We mount a folder for the SQLite database and other data to be persistent<br>      - authelia_data:/config<br>    networks:<br>      - dokploy-network<br>    labels:<br>      - &quot;traefik.enable=true&quot;<br>      <br>      # --- Access to the Authelia Interface ---<br>      - &quot;traefik.http.routers.authelia.rule=Host(`auth.letradev.com`)&quot;<br>      - &quot;traefik.http.routers.authelia.entrypoints=websecure&quot;<br>      - &quot;traefik.http.routers.authelia.tls.certresolver=letsencrypt&quot;<br>      - &quot;traefik.http.services.authelia.loadbalancer.server.port=9091&quot;<br>      <br>      # --- MIDDLEWARE DEFINITION TO PROTECT OTHER SERVICES ---<br>      # These lines create a protective shield named &#39;authelia&#39;.<br>      - &quot;traefik.http.middlewares.authelia.forwardauth.address=http://authelia:9091/api/authz/forward-auth&quot;<br>      - &quot;traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true&quot;<br>      - &quot;traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email&quot;<br>   authelia-redis:<br>    image: redis:alpine<br>    container_name: authelia-redis<br>    restart: always<br>    volumes:<br>      - redis_data:/data<br>    networks:<br>      - dokploy-network<br>    healthcheck:<br>      test: [&quot;CMD&quot;, &quot;redis-cli&quot;, &quot;ping&quot;]<br>      interval: 30s<br>      timeout: 10s<br>      retries: 3<br>      start_period: 5s<br>volumes:<br>  authelia_data:<br>  redis_data:<br><br>networks:<br>  dokploy-network:<br>    external: true<br></pre><blockquote>We bind the Authelia port to our Tailscale VPN IP (for example, 100.x.x.x). This way, we will be able to redirect to Authelia via the VPN from our applications running on different servers within the VPN.</blockquote><p>The middlewares.authelia.forwardauth lines in this configuration are extremely critical. We specified to Traefik that when a request requiring authorization comes in, it must first ask Authelia&#39;s port 9091.</p><h3>4. Protecting the Services</h3><p>We installed Authelia, made it talk to LLDAP, and defined the middleware. Now, all we have to do is add this single-line label to the Compose files (or the labels section in the Dokploy interface) of the internal services we want to protect:</p><pre>- &quot;traefik.http.routers.your_service_router_name.middlewares=authelia@docker&quot;</pre><p>Now we can uncomment the middleware line we left commented out in Step 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MwI6GnFemygig4jaRrQxzg.png" /><figcaption>adding authelia middleware to lldap web</figcaption></figure><p>When this label is added, instead of forwarding the incoming requests directly to the application, Traefik will first redirect them to Authelia’s login screen. With the Authelia and LLDAP installation, we have completely closed the monitoring and management services in our system to the outside world and created a secure area accessible only by authorized users.</p><p>With these setups, using the LLDAP and Authelia duo, we have created a robust authentication layer with 2FA support, isolated by a VPN (Tailscale), where we can manage all services in our infrastructure from a single center (SSO). Every internal application we spin up on Dokploy now runs behind a secure shield against the threats of the outside world.</p><p>Now that we have built our firewall, it is time to see how the system works behind this wall. In the next post of the series, <strong>Part 6: Monitoring and Health Checks</strong>, we will examine in detail how to instantly track our server’s resource consumption (CPU, RAM, Disk), how to measure the health status of our containers, and how the system will warn us (alerting) in case of possible bottlenecks or crashes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95dca00de55c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kendi PaaS Altyapımızı Kuruyoruz (Bölüm 5): Merkezi Kimlik Yönetimi (LLDAP & Authelia)]]></title>
            <link>https://myakupoglu.medium.com/kendi-paas-altyap%C4%B1m%C4%B1z%C4%B1-kuruyoruz-b%C3%B6l%C3%BCm-5-merkezi-kimlik-y%C3%B6netimi-lldap-authelia-24da90a013a4?source=rss-3cfe97f9cd14------2</link>
            <guid isPermaLink="false">https://medium.com/p/24da90a013a4</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[lldap]]></category>
            <category><![CDATA[oidc]]></category>
            <category><![CDATA[dokploy]]></category>
            <category><![CDATA[authelia]]></category>
            <dc:creator><![CDATA[Muhammet İkbal Yakupoglu]]></dc:creator>
            <pubDate>Fri, 27 Mar 2026 18:17:28 GMT</pubDate>
            <atom:updated>2026-03-28T18:03:37.923Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IJq-jwBoB4sVXu_lCi8Q-w.png" /></figure><p><a href="https://myakupoglu.medium.com/kendi-paas-altyap%C4%B1m%C4%B1z%C4%B1-kuruyoruz-b%C3%B6l%C3%BCm-4-zoho-mail-ile-kurumsal-e-posta-ve-spam-korumas%C4%B1-spf-d5ff02e3cb73">Serimizin önceki bölümlerinde</a> sunucu seçimini, Cloudflare ile DNS yönetimini, Dokploy kurulumunu ve e-posta entegrasyonunu tamamladık. Altyapımız üzerinde monitoring, yönetim ve sadece kendi içimizde kullanacağımız diğer araçları ayağa kaldırırken, bu uygulamaların dış dünyaya karşı güvenliğini sağlamak öncelikli konulardan biri haline geliyor.</p><p>Her bir iç yönetim aracı için ayrı kimlik doğrulama mekanizmaları kurmak yerine, tüm sistemi tek bir merkezden (SSO — Single Sign-On) yönetmek çok daha sürdürülebilir bir yaklaşımdır. Bu bölümde, Dokploy üzerinde LLDAP (Lightweight LDAP) ve Authelia kullanarak merkezi bir kimlik yönetimi altyapısı kuracağız.</p><h3>LLDAP ve Authelia Tercihi</h3><p>Kendi altyapımızı yönetirken kaynak tüketimi önemlidir. LLDAP, geleneksel OpenLDAP’a göre çok daha az kaynak tüketen ve kurulumu oldukça basit olan bir alternatiftir. Authelia ise arka planda kullandığımız Traefik reverse proxy ile entegre çalışarak LDAP üzerinden kullanıcı doğrulaması yapar. İç uygulamalarımıza erişmeden önce araya girer ve İki Aşamalı Doğrulama (2FA) gibi ek güvenlik katmanları sunar. Her iki aracın da tamamen açık kaynak kodlu (open-source) olması, sistemin şeffaflığı ve üretici bağımlılığı yaratmaması açısından bu yöndeki tercihimizi güçlendirmektedir.</p><h3>1. Dokploy Üzerinde LLDAP Kurulumu</h3><p>İlk adım olarak Dokploy arayüzünden yeni bir Compose projesi oluşturup LLDAP’ı ayağa kaldırıyoruz. Temel bir docker-compose.yml yapılandırması şu şekildedir:</p><pre>services:<br>  lldap:<br>    image: lldap/lldap:stable<br>    container_name: lldap<br>    restart: unless-stopped<br>    expose:<br>      - &quot;3890&quot;<br>      - &quot;17170&quot;<br>    environment:<br>      - LLDAP_JWT_SECRET=super_jwt_token_belirleyin<br>      - LLDAP_LDAP_BASE_DN=dc=domain,dc=local<br>      - LLDAP_LDAP_USER_PASS=super_pass_belirleyin<br>      - LLDAP_LDAP_USER_EMAIL=admin@domain.local<br>      - LLDAP_SERVER_KEY_SEED=random_seed_for_keys<br>      - LLDAP_DATABASE_URL=sqlite:///data/users.db?mode=rwc<br>    volumes:<br>      - lldap_data:/data<br>    networks:<br>      - dokploy-network<br>    labels:<br>      - &quot;traefik.enable=true&quot;<br>      <br>      # --- 1. LDAPS (Port 3890) ---<br>      - &quot;traefik.tcp.routers.lldap-tcp.rule=HostSNI(`ldap.domain.com`)&quot;<br>      - &quot;traefik.tcp.routers.lldap-tcp.entrypoints=ldaps&quot;<br>      - &quot;traefik.tcp.routers.lldap-tcp.tls=true&quot;<br>      - &quot;traefik.tcp.routers.lldap-tcp.tls.certresolver=letsencrypt&quot;<br>      - &quot;traefik.tcp.services.lldap-tcp.loadbalancer.server.port=3890&quot;<br>      <br>      # --- 2. WEB PANEL (Port 17170) ---<br>      - &quot;traefik.http.routers.lldap-web.rule=Host(`lldap.domain.com`)&quot;<br>      - &quot;traefik.http.routers.lldap-web.entrypoints=websecure&quot;<br>      - &quot;traefik.http.routers.lldap-web.tls.certresolver=letsencrypt&quot;<br>      - &quot;traefik.http.services.lldap-web.loadbalancer.server.port=17170&quot;<br><br>      # - &quot;traefik.http.routers.lldap-web.middlewares=authelia&quot; &lt;-- Bu alanı 3. kısımdan sonra açacağız.<br><br>volumes:<br>  lldap_data:<br><br>networks:<br>  dokploy-network:<br>    external: true</pre><p>Bu konfigürasyonda dikkat etmemiz gereken kritik noktalar şunlardır:</p><ul><li><strong>expose Kullanımı:</strong> Güvenlik gereği uygulamanın portlarını (ports) doğrudan sunucuya açmak yerine expose kullanarak sadece Dokploy&#39;un kendi iç ağına (dokploy-network) açtık. Dışarıdan gelen tüm trafik Traefik üzerinden süzülerek içeri girecek.</li><li><strong>LLDAP_LDAP_BASE_DN Ayarı (</strong><strong>dc=domain,dc=local):</strong> Bu satır LDAP ağacımızın kök dizinini (Base DN) belirler. .local uzantısı kullanmak, bu kimlik doğrulama yapısının internete açık genel bir sistem değil, sadece iç ağımızda geçerli kapalı bir sistem olduğunu vurgulayan güvenli bir standarttır. Eğer doğrudan dış dünyaya hizmet veren ve Active Directory gibi sistemlerle public domain üzerinden konuşacak bir yapı kursaydık .com tercih edebilirdik. Kendi PaaS altyapımız için .local en doğru yaklaşımdır. Domain isminide kendi şirket adımıza göre güncellememiz gerekmektedir.</li><li><strong>Traefik TCP Router Tanımları (LDAPS):</strong> LDAP iletişim protokolü HTTP üzerinden değil, ham TCP üzerinden çalışır. Bu nedenle 3890 portuna gelen trafiği traefik.tcp etiketleriyle yönettik ve HostSNI kullanarak ldap.domain.com adresine gelen bağlantıları TLS ile şifreleyerek güvenli (LDAPS) hale getirdik.</li><li><strong>Traefik HTTP Router Tanımları (Web Panel):</strong> LLDAP’ın web arayüzünün çalıştığı 17170 portu standart web trafiğidir. Dokploy’un otomatik atamalarını ezmek ve lldap.domain.com üzerinden HTTPS ile panele erişmek için traefik.http yönlendirmelerini kullandık.</li></ul><p>Container çalıştıktan sonra lldap.domain.com adresine gidip admin şifrenizle giriş yapabilir ve Authelia&#39;nın kullanması için ilk kullanıcılarınızı ve gruplarınızı oluşturabilirsiniz.</p><h3>2. Authelia Kurulumu ve Konfigürasyonu</h3><p>Sırada Authelia var. Authelia’nın çalışabilmesi için detaylı bir yapılandırma dosyasına (configuration.yml) ihtiyacı vardır. Dokploy üzerinden Authelia&#39;yı kurmadan önce, sunucumuzda bu konfigürasyon dosyasını barındıracağımız fiziksel bir dizin oluşturmalıyız.</p><p>Örneğin, sunucunuza SSH ile bağlanıp /home/user/authelia/ dizini altında dosyamızı oluşturabiliriz:</p><pre>mkdir -p /home/user/authelia<br>nano /home/user/authelia/configuration.yml</pre><p>Bu dosyanın içerisine Authelia’nın genel ayarlarını ekleyeceğiz. Ancak konumuz kimlik yönetimi olduğu için dosyadaki en kritik kısım, Authelia’nın kimlik doğrulaması için az önce kurduğumuz LLDAP ile nasıl konuşacağını belirttiğimiz authentication_backend bölümüdür:</p><pre>###############################################################<br>#                   Authelia Configuration                    #<br>###############################################################<br><br>theme: dark<br><br>server:<br>  address: &#39;tcp://0.0.0.0:9091&#39;<br>  buffers:<br>    read: 4096<br>    write: 4096<br><br>log:<br>  level: info<br><br># --- 1. IDENTITY VALIDATION ---<br>identity_validation:<br>  reset_password:<br>    jwt_secret: &quot;super_secret_jwt&quot; # Rastgele ve güçlü bir secret girin<br><br># --- 2. SESSION ---<br>session:<br>  name: authelia_session<br>  secret: &quot;session_secret&quot; # Rastgele ve güçlü bir secret girin<br>  expiration: 3600 # 1 saat<br>  inactivity: 300  # 5 dakika<br>  <br>  cookies:<br>    - domain: &quot;domain.com&quot; # KENDİ DOMAININIZ<br>      authelia_url: &quot;https://auth.domain.com&quot; # KENDİ DOMAININIZ<br>      default_redirection_url: &quot;https://domain.com&quot; # KENDİ DOMAININIZ<br>  <br>  redis:<br>    host: authelia-redis<br>    port: 6379<br><br># --- 3. AUTHENTICATION (LLDAP) ---<br>authentication_backend:<br>  ldap:<br>    implementation: custom<br>    address: ldap://lldap:3890<br>    timeout: 5s<br>    start_tls: false<br><br>    user: uid=admin,ou=people,dc=letradev,dc=local<br>    password: super_pass_belirleyin # LLDAP Admin şifreniz<br><br>    base_dn: dc=letradev,dc=local<br>    additional_users_dn: ou=people<br>    users_filter: (&amp;({username_attribute}={input})(objectClass=person))<br>    additional_groups_dn: ou=groups<br>    groups_filter: (member={dn})<br>    <br>    attributes:<br>      display_name: displayName<br>      group_name: cn<br>      mail: mail<br>      username: uid<br><br># --- 4. ACCESS CONTROL ---<br>access_control:<br>  default_policy: deny<br>  rules:<br>    - domain: &quot;auth.domain.com&quot; # KENDİ DOMAININIZ<br>      policy: bypass<br>    - domain: &quot;*.domain.com&quot; # KENDİ DOMAININIZ<br>      policy: one_factor<br>  <br># --- 5. OIDC ---<br>identity_providers:<br>  oidc:<br>    hmac_secret: &quot;long_hmac_secret&quot; # Rastgele ve güçlü bir secret<br>    <br>    jwks:<br>      - key: |<br>          -----BEGIN PRIVATE KEY-----<br>          BURAYA_OLUSTURDUGUNUZ_PRIVATE_KEY_GELECEK<br>          -----END PRIVATE KEY-----<br><br># --- 6. STORAGE ---<br>storage:<br>  encryption_key: &quot;long_encrypt_key&quot; # Rastgele ve güçlü bir secret<br>  <br>  local:<br>    path: /config/db.sqlite3<br><br># --- 7. NOTIFIER (Zoho Mail Entegrasyonu) ---<br>notifier:<br>  smtp:<br>    address: &quot;smtp://smtp.zoho.eu:587&quot;<br>    username: &quot;iletisim@domain.com&quot;<br>    password: &quot;zoho_uygulama_sifreniz&quot; # Panelde oluşturduğumuz uygulama şifresi<br>    sender: &quot;Authelia &lt;iletisim@domain.com&gt;&quot;</pre><h4>Dosyayı Düzenlerken Dikkat Edilmesi Gereken Kritik Noktalar:</h4><ol><li><strong>Güçlü Şifreler (Secrets):</strong> Dosyada secret ve encryption_key yazan yerler (örn: jwt_secret, session_secret, hmac_secret) farklı ve rastgele oluşturulmuş güçlü metinlerle değiştirilmelidir. Bunun için <a href="https://jwtsecretkeygenerator.com/">jwtsecretkeygenerator.com</a> gibi araçları kullanabilirsiniz.</li><li><strong>Domain Güncellemeleri:</strong> Dosyadaki domain.com ve auth.domain.com değerlerini, Traefik üzerinde kullanacağınız kendi gerçek alan adınızla değiştirmeyi unutmayın.</li><li><strong>Erişim Kontrolü (Access Control):</strong> Başlangıçta kolaylık olması adına policy: one_factor (sadece kullanıcı adı ve şifre) örneği kullanılmıştır. Sisteminizi daha güvenli hale getirmek isterseniz bu değeri two_factor olarak güncelleyerek OTP (Authenticator uygulamaları vb.) zorunluluğu getirebilirsiniz.</li><li><strong>Kimlik Doğrulama (LLDAP Backend):</strong> authentication_backend bölümü, Authelia&#39;yı Adım 1&#39;de kurduğumuz LLDAP veritabanına bağlar. Kullanıcıları doğrulamak için Authelia doğrudan bu veritabanına sorgu atar.</li><li><strong>OIDC ve JWKS (JSON Web Key Set):</strong> OIDC bölümündeki JWKS, Authelia’nın diğer uygulamalara OpenID Connect üzerinden kimlik sağlarken oluşturduğu yetkilendirme token’larını imzalaması (şifrelemesi) için kullanılır. Bu alana geçerli bir RSA Private Key girmeniz gerekir. Kendi anahtarınızı oluşturmak için sunucunuzda geçici (dummy) bir Authelia container’ı ayağa kaldırıp şu komutu çalıştırabilirsiniz:</li></ol><pre>docker run --rm -v $(pwd):/keys authelia/authelia:latest authelia crypto pair rsa generate --directory /keys</pre><ol><li>Bu komut, bulunduğunuz dizine private.pem ve public.pem dosyalarını çıkartır. private.pem dosyasının içindeki metni kopyalayıp YAML dosyasındaki jwks -&gt; key bölümüne yapıştırmalısınız.</li><li><strong>Bildirimler ve Zoho SMTP:</strong> Serimizin 4. bölümünde kurumsal e-posta altyapımızı Zoho Mail ile kurmuştuk. Authelia’nın parola sıfırlama veya cihaz doğrulama e-postalarını gönderebilmesi için Zoho ayarlarını aynen buraya taşıyoruz. Avrupa sunucusunu kullandığımız için adres smtp://smtp.zoho.eu:587 olmalıdır. Şifre bölümüne ise normal e-posta şifreniz değil, Zoho panelinden daha önce oluşturduğumuz <strong>Uygulamaya Özgü Parola (App Password)</strong> girilmelidir.</li></ol><h3>3. Authelia Compose ve Traefik Middleware Kurulumu</h3><p>Konfigürasyon dosyamız hazır. Şimdi Dokploy arayüzüne geçip Authelia için yeni bir Compose projesi oluşturuyoruz. Burada sunucudaki konfigürasyon dosyasını volume olarak bağlamanın yanı sıra, diğer servisleri korumak için kullanacağımız <strong>Traefik Middleware’ini</strong> de tanımlayacağız:</p><pre>services:<br>  authelia:<br>    image: authelia/authelia:latest<br>    container_name: authelia<br>    restart: unless-stopped<br>    ports: <br>      - &quot;100.x.x.x:9091:9091&quot; # Tailscale sunucu ipsi<br>    volumes:<br>      # Sunucudaki yapılandırma dosyasını container içine okuma amaçlı bağlıyoruz<br>      - /home/user/authelia/configuration.yml:/config/configuration.yml<br>      # SQLite veritabanı ve diğer verilerin kalıcı olması için klasör bağlıyoruz<br>      - authelia_data:/config<br>    networks:<br>      - dokploy-network<br>    labels:<br>      - &quot;traefik.enable=true&quot;<br>      <br>      # --- Authelia Arayüzüne Erişim ---<br>      - &quot;traefik.http.routers.authelia.rule=Host(`auth.letradev.com`)&quot;<br>      - &quot;traefik.http.routers.authelia.entrypoints=websecure&quot;<br>      - &quot;traefik.http.routers.authelia.tls.certresolver=letsencrypt&quot;<br>      - &quot;traefik.http.services.authelia.loadbalancer.server.port=9091&quot;<br>      <br>      # --- DİĞER SERVİSLERİ KORUYACAK MIDDLEWARE TANIMI ---<br>      # Bu satırlar &#39;authelia&#39; adında bir koruma kalkanı oluşturur.<br>      - &quot;traefik.http.middlewares.authelia.forwardauth.address=http://authelia:9091/api/authz/forward-auth&quot;<br>      - &quot;traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true&quot;<br>      - &quot;traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email&quot;<br><br>  authelia-redis:<br>    image: redis:alpine<br>    container_name: authelia-redis<br>    restart: always<br>    volumes:<br>      - redis_data:/data<br>    networks:<br>      - dokploy-network<br>    healthcheck:<br>      test: [&quot;CMD&quot;, &quot;redis-cli&quot;, &quot;ping&quot;]<br>      interval: 30s<br>      timeout: 10s<br>      retries: 3<br>      start_period: 5s<br><br>volumes:<br>  authelia_data:<br>  redis_data:<br><br>networks:<br>  dokploy-network:<br>    external: true</pre><blockquote>Authelia portunu Tailscale VPN IP’mize (örneğin 100.x.x.x) bağlıyoruz. Böylelikte VPN içerisindeki farklı sunucularda çalışan uygulamalarımızdan Authelia’ya vpn aracılığıyla redirect yapabileceğiz.</blockquote><p>Bu konfigürasyondaki middlewares.authelia.forwardauth satırları son derece kritiktir. Traefik&#39;e, yetkilendirme gerektiren bir istek geldiğinde bu isteği önce Authelia&#39;nın 9091 portuna sorması gerektiğini belirtmiş olduk.</p><h3>4. Servisleri Korumaya Almak</h3><p>Authelia’yı kurup LLDAP ile konuşturduk ve middleware tanımını yaptık. Şimdi tek yapmamız gereken, korumak istediğimiz iç servislerin Compose dosyalarına (veya Dokploy arayüzündeki labels bölümüne) şu tek satırlık etiketi eklemektir:</p><pre>- &quot;traefik.http.routers.kendi_servis_router_adiniz.middlewares=authelia@docker&quot;</pre><p>Artık 1. adımda yorum satırında bıraktığımız middleware alanını açabiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MwI6GnFemygig4jaRrQxzg.png" /><figcaption>lldap web panele middleware eklenmesi</figcaption></figure><p>Bu etiket eklendiğinde, Traefik o servise gelen istekleri doğrudan uygulamaya iletmek yerine önce Authelia’nın giriş ekranına yönlendirecektir. Authelia ve LLDAP kurulumu ile birlikte sistemimizdeki izleme ve yönetim servislerini dış dünyaya tamamen kapatıp, sadece yetkilendirilmiş kullanıcıların erişebileceği güvenli bir alan oluşturmuş olduk.</p><p>Bu kurulumlarla birlikte, LLDAP ve Authelia ikilisini kullanarak altyapımızdaki tüm servisleri tek bir merkezden (SSO) yönetebileceğimiz, 2FA destekli ve VPN (Tailscale) ile izole edilmiş sağlam bir kimlik doğrulama katmanı oluşturduk. Artık Dokploy üzerinde ayağa kaldırdığımız her iç uygulama, dış dünyanın tehditlerine karşı güvenli bir kalkanın arkasında çalışıyor.</p><p>Güvenlik duvarımızı ördüğümüze göre, artık bu duvarın arkasında sistemin nasıl çalıştığını görmenin vakti geldi. Serinin bir sonraki yazısı olan <strong>Bölüm 6: İzleme ve Sağlık Kontrolleri (Monitoring)</strong>’nde, sunucumuzun kaynak tüketimini (CPU, RAM, Disk) nasıl anlık olarak takip edeceğimizi, container’larımızın sağlık durumlarını nasıl ölçeceğimizi ve olası darboğaz veya çökme durumlarında sistemin bizi nasıl uyaracağını (alerting) detaylıca inceleyeceğiz.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24da90a013a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Our Own PaaS Infrastructure (Part 3): Dokploy Setup and SSL in a Zero Trust Network…]]></title>
            <link>https://myakupoglu.medium.com/building-our-own-paas-infrastructure-part-3-dokploy-setup-and-ssl-in-a-zero-trust-network-4df6c82366d1?source=rss-3cfe97f9cd14------2</link>
            <guid isPermaLink="false">https://medium.com/p/4df6c82366d1</guid>
            <category><![CDATA[zero-trust-security]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[traefik]]></category>
            <category><![CDATA[dokploy]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Muhammet İkbal Yakupoglu]]></dc:creator>
            <pubDate>Fri, 27 Mar 2026 18:14:07 GMT</pubDate>
            <atom:updated>2026-03-27T18:14:07.591Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Our Own PaaS Infrastructure (Part 3): Dokploy Setup and SSL in a Zero Trust Network (DNS-01 Challenge)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FqTjXVoDDnUOajeY.png" /></figure><p>In the first two parts of our series, we laid the foundations of our infrastructure. We rented our server via Contabo, created a secure network closed to the outside (Zero Trust) with Tailscale, and configured our domain settings via Cloudflare.</p><p>Now comes the most exciting part: installing Dokploy, our own Heroku/Vercel alternative, and defining a valid SSL (HTTPS) certificate for our services accessible only from our own VPN network (Tailscale).</p><h4>Why Are We Using DNS-01 Challenge?</h4><p>Under normal circumstances, the HTTP-01 method is used when getting an SSL certificate (Let’s Encrypt) for a website. That is, the system reaches the server over port 80, performs a file verification, and issues the certificate. However, in our architecture, our server is closed to the outside world! We only want to access our applications from our internal network while connected to the Tailscale VPN.</p><p>Since we cannot perform SSL verification over HTTP for a server that cannot be reached from the outside, the DNS-01 Challenge comes to our rescue. In this method, instead of sending an HTTP request to the server, Let’s Encrypt verifies whether the domain really belongs to us by looking at our DNS records on Cloudflare.</p><h4>1. Dokploy Installation</h4><p>One of the best things about Dokploy is that its installation is extremely simple. We connect to our server via SSH and run the following one-line command:</p><pre>curl -sSL https://dokploy.com/install.sh | sh</pre><blockquote>The installation script spins up all the necessary Docker containers for us.</blockquote><p>After the installation is complete, we need to access the Dokploy interface. However, since port 3000 of our server is closed to the outside world due to our security steps, we will provide access via our Tailscale VPN IP. From our browser, we make our first login to the Dokploy interface with our Tailscale IP address and port (e.g., http://100.x.x.x:3000) and create our administrator account.</p><blockquote><em>Do not forget to activate the Tailscale VPN on your computer while doing this step!</em></blockquote><h4>2. Creating a Cloudflare API Token</h4><p>For Dokploy to perform the DNS-01 challenge, it needs to be able to create and delete temporary DNS records on our behalf in Cloudflare. For this, we need to get an API token from Cloudflare. To get an API token:</p><ol><li>Go to the Cloudflare dashboard.</li><li>Go to the <strong>“Profile” -&gt; “API Tokens”</strong> tab from your profile at the top right</li><li>Click <strong>“Create Token”</strong> and select the <strong>“Edit zone DNS”</strong> template.</li><li>Select your relevant domain (Zone), create the token, and copy this password to a secure place.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XrIy5mcqHLyUtU06.png" /></figure><h4>3. DNS-01 and Environment Variables Setting on Dokploy</h4><p>Now we will teach Dokploy how to talk to Cloudflare. Just entering the Cloudflare token into the system is not enough; we need to configure the Traefik router running in the background to perform DNS-01 validation instead of HTTP. This process consists of two stages:</p><p><strong>3.1. Adding an Environment Variable</strong></p><p>First, let’s define the key in the system that will establish the authorized connection with the Cloudflare API:</p><ol><li>Log in to the Dokploy panel.</li><li>Go to the <strong>Web Server</strong> tab under <strong>Settings</strong> from the left menu.</li><li>Scroll down the page a bit and click the <strong>Traefik</strong> button inside the “Web Server” card. Select the <strong>Modify Environment</strong> option from the menu that opens.</li><li>In the opened window, we need to add our Cloudflare API token for Traefik in a way the system will understand. We add the relevant variable here as a new line like CF_DNS_API_TOKEN=YOUR_CLOUDFLARE_API_TOKEN and save it.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b-wE8PA5tZI1Bp8n.png" /><figcaption>Traefik Environment Variables</figcaption></figure><blockquote>This configuration allows the Traefik router running in the background of Dokploy to communicate directly with Cloudflare and verify DNS records. This method guarantees that the system can seamlessly obtain and renew SSL certificates via Let’s Encrypt, even while running in a closed network (VPN).</blockquote><h4><strong>3.2. Editing the Traefik Configuration (traefik.yml)</strong></h4><p><strong>3.2.1 Editing the configuration via the Dokploy panel</strong></p><p>We added the Cloudflare API token; now we will change the SSL verification method by editing Traefik’s configuration file.</p><ol><li>Click on the <strong>Traefik File System</strong> tab from the left menu.</li><li>Select the traefik.yml file from the file list on the left side of the opened screen.</li><li>Find the certificatesResolvers block inside the file. Completely delete the existing httpChallenge section and update it as follows:</li></ol><pre>certificatesResolvers:<br>  letsencrypt:<br>    acme:<br>      email: &quot;your-email-address@gmail.com&quot;<br>      storage: &quot;/etc/dokploy/traefik/dynamic/acme.json&quot;<br>      dnsChallenge:<br>        provider: cloudflare<br>        resolvers:<br>          - &quot;1.1.1.1:53&quot;<br>          - &quot;1.0.0.1:53&quot;</pre><p>Save the settings and restart the system for it to run with the updated configuration (<strong>Webserver &gt; Traefik &gt; Reload</strong>).</p><p><strong>3.2.2 Editing the configuration via the server in case the panel is inaccessible</strong></p><p>Sometimes, even if you do everything right, you might suddenly lose your connection to the Dokploy panel due to an unexpected Traefik crash, a momentary glitch in the interface, or a slight alignment shift in the YAML file. The panel not opening means you have no chance left to fix the settings from the interface.</p><p>In such cases, we can put our Plan B into action and intervene in that same file directly through the server:</p><ol><li>Connect to your server via SSH from the terminal.</li><li>Open the Traefik configuration file by typing the following command into the terminal:</li></ol><pre>nano /etc/dokploy/traefik/traefik.yml</pre><ol><li>When the file opens, navigate to the certificatesResolvers section using the arrow keys on your keyboard. Carefully check the alignments according to the template above using only the &quot;Space&quot; key and correct them if necessary.</li><li>When you are done, use the following key combinations in order to save the file and exit:</li></ol><ul><li>Ctrl + O (To save)</li><li>Enter (To confirm the file name)</li><li>Ctrl + X (To exit)</li></ul><p>After this process, Docker and Traefik will read the new settings, recover, and your panel will come back in seconds. To confirm that Traefik is running smoothly, type the following command into the terminal:</p><pre>docker logs --tail 50 dokploy-traefik</pre><blockquote>This command will bring you the last 50 lines of Traefik’s log. If warning error messages like level=error are not flowing on the screen, congratulations! Everything is working perfectly, and it means the problem is successfully solved.</blockquote><h4>4. Verifying the Configuration: Assigning a Domain and SSL to the Dokploy Management Panel</h4><p>We completed all these complex configurations and made Traefik ready for the DNS-01 challenge. Now it’s time to confirm that the system works correctly from end to end. We will do our first test by assigning a domain and SSL certificate to the Dokploy management panel itself, which we have accessed directly with an IP address and port (100.x.x.x:3000) so far.</p><ol><li>Go to the Cloudflare dashboard and create an <strong>A record</strong> for the subdomain you will use for Dokploy (e.g., dokploy.domain.com). Point this record directly to your server&#39;s Tailscale IP address (100.x.x.x). <em>(Cloudflare will automatically detect that this IP belongs to a local/private network and give a &quot;DNS only — reserved IP&quot; warning.)</em></li><li>In the Dokploy panel, go to the <strong>Settings &gt; Webserver</strong> tab from the left menu.</li><li>In the <strong>Server Domain</strong> card at the very top, write the subdomain you just created in Cloudflare (e.g., dokploy.domain.com) in the <strong>Domain</strong> section.</li><li>Enter a valid email address in the <strong>Let’s Encrypt Email</strong> section.</li><li>Activate the <strong>HTTPS (Automatically provision SSL Certificate)</strong> option and click the <strong>Save</strong> button.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tWNjVOO8mJDDpVwK.png" /></figure><p>After this process, Dokploy will communicate with Let’s Encrypt and the Cloudflare API in the background to perform the DNS-01 verification. In a few seconds, when you open a new tab in your browser and go to https://dokploy.domain.com, you will be able to securely access your Dokploy panel with a valid SSL certificate as long as you are connected to the VPN.</p><p>From now on, the same logic will apply to the new applications you create on Dokploy. Opening a DNS record for your Tailscale IP via Cloudflare and assigning a domain to the relevant application from the Dokploy interface is enough for the SSL process to be completed automatically.</p><p>In this part, we built the heart of our system and solved SSL verification in a closed network, one of the most challenging parts of the Zero Trust architecture, with Cloudflare and the DNS-01 challenge. Now, our server has transformed into a professional PaaS platform that is closed to external attacks, accessible only from our VPN, and yet has fully valid HTTPS certificates. We also confirmed that the system works flawlessly with the domain we assigned to the Dokploy management panel.</p><p>In the next step, before spinning up our applications, we will establish our professional communication infrastructure. In the next part, we will talk about <strong>Zoho Mail integration</strong> and the necessary DNS configurations to send and receive corporate emails via our custom domain. See you later!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4df6c82366d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>