AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-79514

David's questions

Martin Hope
David
Asked: 2022-03-29 14:20:48 +0800 CST

如何将 .env 文件调用到在 K8s 服务器上的 Docker 容器中运行的 Django 项目中?

  • 0

我很可能只需要一个正确方向的提示。

我有一个使用 gunicorn 和 nginx 运行 Django 应用程序的 docker 容器。此 Django 应用程序当前正在从 .env 文件中获取其环境变量。

FROM python:alpine
EXPOSE 8000

RUN apk update
RUN apk add --no-cache git gcc musl-dev libffi-dev libxml2-dev libxslt-dev gcc swig g++
RUN apk add --no-cache jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-  dev tk-dev tcl-dev
RUN apk add --no-cache bash ffmpeg libmagic
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install --upgrade setuptools

RUN mkdir /opt/app
WORKDIR /opt/app
COPY . .
RUN python3 -m pip install /root/d12f/

RUN pip3 install -r requirements.txt
RUN pip3 install gunicorn
CMD sh -c 'gunicorn --conf python:app.gunicorn_conf app.wsgi --bind 0.0.0.0:8000 --reload --log-level info --access-logfile - --timeout 360 --error-logfile -'

当然,repo 中没有 .env 文件,因为这会带来安全风险。

Docker 映像由 github 创建并存储在私有 GitHub 包中。稍后,这个 docker 镜像被用于在 Kubernetes 上运行。

我正在尝试找到将 .env 文件放入的最佳解决方案

/opt/app/app/.env

作为本地文件。

如果可能的话,我宁愿不使用全局环境变量。

感谢您的任何建议。

django python docker kubernetes github
  • 2 个回答
  • 139 Views
Martin Hope
David
Asked: 2018-08-19 11:27:28 +0800 CST

Qmail SMTP 接收方总是延迟 66 秒

  • 0

我目前正在努力解决我的 qmail 设置中的一个问题,这似乎每次都会延迟我的 smtp 接收器 66 秒。这对于大多数远程主机来说都很好,但有些似乎达到了超时并且不传递邮件。

我正在使用 jgreylist 运行 qmail,并且延迟似乎发生在初始连接和 jgreylist 之间。

2018-08-16 08:13:18.143940500 tcpserver: status: 2/30
2018-08-16 08:13:18.144214500 tcpserver: pid 989 from 209.85.213.41
2018-08-16 08:13:18.145110500 tcpserver: ok 989    
mail.klement.com:138.201.24.116:25 mail-vk0-f41.google.com:209.85.213.41::36018
2018-08-16 08:14:24.394795500 jgreylist[989]: 209.85.213.41: OK known
2018-08-16 08:14:25.026792500 qmail-smtpd[989]: MFCHECK pass [209.85.213.41] gmail.com
2018-08-16 08:14:25.028190500 qmail-smtpd[989]: Received-SPF: pass (mail.klm.com: SPF record at _netblocks.google.com designates 209.85.213.41 as permitted sender)
2018-08-16 08:14:25.028369500 qmail-smtpd[989]: MAIL FROM:<[email protected]>
2018-08-16 08:14:25.028566500 qmail-smtpd[989]: RCPT TO:<[email protected]>
2018-08-16 08:14:25.028718500 qmail-smtpd[989]: validrcptto [209.85.213.41] trying: [email protected]
2018-08-16 08:14:25.028880500 qmail-smtpd[989]: validrcptto [209.85.213.41] found: [email protected]
2018-08-16 08:14:25.485688500 tcpserver: end 989 status 0

我在配置中没有任何延迟设置。

这是我的价值观:

JGREYLIST_NOREV=1
JGREYLIST_BY_IP=0
JGREYLIST_HOLDTIME=120
JGREYLIST_LOG=1
JGREYLIST_LOG_PID=1
JGREYLIST_LOG_SMTP=0
JGREYLIST_TIMEOUT=120
JGREYLIST_LIMIT=0

SMTPGREETING="$LOCAL NO UCE"
SMTPD_GREETDELAY=0
#GREETDELAY=5
#DROP_PRE_GREET=1
DENY_TLS=0
MFCHECK=3

我像这样启动 tcpserver。

tcpserver -vR -l mail.klm.com -c 30 -u 162 -g 161 -x /var/qmail/service/smtpd-receiver/tcp.cdb 128.111.xxx.xxx 25 rblsmtpd -t0 -r ix.dnsbl.manitu.net -r zen.spamhaus.org -r dnsbl.njabl.org -r bl.spamcop.net jgreylist /var/qmail/bin/qmail-smtpd

一切加快速度的东西都更受欢迎。

smtp
  • 1 个回答
  • 147 Views
Martin Hope
David
Asked: 2016-04-25 03:51:38 +0800 CST

排除一个 URL 被重定向到 HTTPS 会生成一个带有当前 NGINX 版本的循环

  • 0

我刚刚将我在 Ubuntu 上的 NGINX 服务器更新到了最新的官方版本 1.9.15。

从那时起,我使用了很长一段时间的配置停止工作。简而言之,我将所有流量重定向到 https,除了一个页面,例如 /mypage/,由于外部资源,该页面需要通过 http 访问。

这就是我的配置的样子。

server {

  listen 12.34.56.78:80;

  server_name www.myside.com;
  root /home/myside.com/public_html;
  index index.php;

  location ~ \.php$ {
    include fastcgi.conf;
    fastcgi_intercept_errors on;
    fastcgi_pass php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }

  location / {
    return 301 https://www.myside.com$request_uri;
    try_files $uri $uri/ /index.php?$args;
  }

      # but no redirect for this particular location:
  location /mypage/ {
    try_files $uri $uri/ /index.php?$args;
  }

}

server {

  listen 12.34.56.78:443 ssl http2 default_server;

  ssl on;
  ssl_certificate /etc/nginx/ssl/myside.com/cert.pem;
  ssl_certificate_key /etc/nginx/ssl/myside.com/privkey.pem;

  server_name www.myside.com myside.com;
  root /home/myside.com/public_html;
  index index.php;

  location / {
    try_files $uri $uri/ /index.php?$args;
  }

  location ~ \.php$ {
    include fastcgi.conf;
    fastcgi_intercept_errors on;
    fastcgi_pass php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }

  location /mypage/ {
    return 301 http://$server_name$request_uri;
    try_files $uri $uri/ /index.php?$args;
  }

}

不幸的是,它现在正在循环 http -> https -> http -> https 等等。

redirect nginx 301-redirect
  • 1 个回答
  • 643 Views
Martin Hope
David
Asked: 2014-11-04 13:36:24 +0800 CST

为 UCSPI SSL 获取正确的密码

  • 0

我目前正在尝试保护我的 qmail 安装和 SMTP 连接。

编译标准 UCSPI SSL 时,默认启用所有支持的密码。这会导致 POODLE、heartblead 和其他 SSL 问题。

我使用以下值设置了一个名为 CIPHERS 的环境变量。

CIPHERS=ALL:!LOW:!SSLv2:!EXP:!aNULL:!eNULL!3DES:!MD5:!EXP:!CBC:!PSK:!SRP:!DSS:!RC4

除了负责 POODLE 的 SSLv3 之外,这会禁用大多数“不太好”的东西。

我设置的第二个

CIPHERS=ALL:!LOW:!SSLv2: !SSLv3: !EXP:!aNULL:!eNULL!3DES:!MD5:!EXP:!CBC:!PSK:!SRP:!DSS:!RC4

服务器停止工作。

对于我可能应该在顶部禁用的密码,也欢迎任何建议。

openssl
  • 1 个回答
  • 262 Views
Martin Hope
David
Asked: 2013-12-17 06:36:43 +0800 CST

如何永久设置IP地址

  • 1

这听起来可能有点奇怪,但我尝试使用命令行而不是编辑器在 Ubuntu 中永久设置 IP 地址。

我的想法是提供服务器,只需输入一次 IP 地址,脚本就会处理这个问题。

我只是无法想象那里没有任何东西可以写

ifconfig eth1 10.1.1.1 netmask 255.255.255.0 up
到/etc/network/interfaces文件中。

linux
  • 2 个回答
  • 1636 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve