BLOG-65 Establish beta environment #66

Merged
squid merged 1 commits from BLOG-65_beta_environment into main 2025-07-24 02:23:45 +08:00
Owner

Description

  • Change some environment variables implementation

  • Nginx configuration:

    server {                                                                                                                                                                                                                                                     
        server_name beta.squidspirit.com;
    
        proxy_pass_request_headers on; 
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    
        location / { 
            proxy_pass http://127.0.0.1:10013/;
        }
    
        location /api/ {
            proxy_pass http://127.0.0.1:10014/;
        }
    
        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/beta.squidspirit.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/beta.squidspirit.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    }
    
    server {
        if ($host = beta.squidspirit.com) {
            return 301 https://$host$request_uri;
        } # managed by Certbot
    
        server_name beta.squidspirit.com;
        listen 80; 
        return 404; # managed by Certbot
    }
    
  • Podman kube configuration:

    apiVersion: v1                                                                                                                                                                                                                                                                           
    kind: Secret
    metadata:
      name: beta-blog-secret
    data:
      DATABASE_PASSWORD: {{BASE64_PASSWORD}}
    
    ---
    
    apiVersion: v1
    kind: Pod
    metadata:
      name: beta-blog
    spec:
      containers:
        - name: postgres
          image: docker.io/library/postgres:17-alpine
          imagePullPolicy: always
          env:
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: beta-blog-secret
                  key: DATABASE_PASSWORD
          volumeMounts:
            - name: beta-blog-postgres
              mountPath: /var/lib/postgresql/data
        - name: backend
          image: registry.squidspirit.com/squid/beta-blog-backend:latest
          imagePullPolicy: always
          env:
            - name: DATABASE_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: beta-blog-secret
                  key: DATABASE_PASSWORD
          volumeMounts:
            - name: beta-blog-localtime
              mountPath: /etc/localtime
              readonly: true
          ports:
            - hostPort: 10014
              hostIP: 127.0.0.1
              containerPort: 8080
        - name: frontend
          image: registry.squidspirit.com/squid/beta-blog-frontend:latest
          imagePullPolicy: always
          env:
            - name: PUBLIC_API_BASE_URL
              value: https://beta.squidspirit.com/api/
          volumeMounts:
            - name: beta-blog-localtime
              mountPath: /etc/localtime
              readonly: true
          ports:
            - hostPort: 10013
              hostIP: 127.0.0.1
              containerPort: 3000
      volumes:
        - name: beta-blog-localtime
          hostPath:
            path: /etc/localtime
        - name: beta-blog-postgres
          persistentVolumeClaim:
            claimName: beta-blog-postgres
    

Package Changes

No response

Screenshots

No response

Reference

Resolves #65

Checklist

  • A milestone is set
  • The related issuse has been linked to this branch
### Description - Change some environment variables implementation - Nginx configuration: ```nginx server { server_name beta.squidspirit.com; proxy_pass_request_headers on; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; location / { proxy_pass http://127.0.0.1:10013/; } location /api/ { proxy_pass http://127.0.0.1:10014/; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/beta.squidspirit.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/beta.squidspirit.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = beta.squidspirit.com) { return 301 https://$host$request_uri; } # managed by Certbot server_name beta.squidspirit.com; listen 80; return 404; # managed by Certbot } ``` - Podman kube configuration: ```yaml apiVersion: v1 kind: Secret metadata: name: beta-blog-secret data: DATABASE_PASSWORD: {{BASE64_PASSWORD}} --- apiVersion: v1 kind: Pod metadata: name: beta-blog spec: containers: - name: postgres image: docker.io/library/postgres:17-alpine imagePullPolicy: always env: - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: beta-blog-secret key: DATABASE_PASSWORD volumeMounts: - name: beta-blog-postgres mountPath: /var/lib/postgresql/data - name: backend image: registry.squidspirit.com/squid/beta-blog-backend:latest imagePullPolicy: always env: - name: DATABASE_PASSWORD valueFrom: secretKeyRef: name: beta-blog-secret key: DATABASE_PASSWORD volumeMounts: - name: beta-blog-localtime mountPath: /etc/localtime readonly: true ports: - hostPort: 10014 hostIP: 127.0.0.1 containerPort: 8080 - name: frontend image: registry.squidspirit.com/squid/beta-blog-frontend:latest imagePullPolicy: always env: - name: PUBLIC_API_BASE_URL value: https://beta.squidspirit.com/api/ volumeMounts: - name: beta-blog-localtime mountPath: /etc/localtime readonly: true ports: - hostPort: 10013 hostIP: 127.0.0.1 containerPort: 3000 volumes: - name: beta-blog-localtime hostPath: path: /etc/localtime - name: beta-blog-postgres persistentVolumeClaim: claimName: beta-blog-postgres ``` ### Package Changes _No response_ ### Screenshots _No response_ ### Reference Resolves #65 ### Checklist - [x] A milestone is set - [x] The related issuse has been linked to this branch
squid added this to the 0.2 milestone 2025-07-24 02:22:34 +08:00
squid added 1 commit 2025-07-24 02:22:34 +08:00
BLOG-65 feat: update Dockerfiles and environment configuration for database and API integration
All checks were successful
Frontend CI / build (push) Successful in 1m4s
PR Title Check / pr-title-check (pull_request) Successful in 17s
0f4033aefc
squid scheduled this pull request to auto merge when all checks succeed 2025-07-24 02:23:44 +08:00
squid merged commit 4a924c1b92 into main 2025-07-24 02:23:45 +08:00
Sign in to join this conversation.
No description provided.