Gunicorn无法连接到Alpine上的袜子文件

时间:2018-08-03 02:44:40

标签: python gunicorn

关于此主题的问题很多,但没有一个对我有帮助。

我正在尝试将Gunicorn连接到ValueError: Trying to share variable rnn/multi_rnn_cell/cell_0/lstm_cell/kernel, but specified shape (128, 256) and found shape (65, 256). ,但是我继续获得/tmp/gunicorn.sock。我的operation not permitted如下:

gunicorn.conf.py

我的日志是:

import multiprocessing

# bind = '127.0.0.1:5000'
bind = 'unix:/tmp/gunicorn.sock'

backlog = 2048
preload_app = True
max_requests = 2048
max_requests_jitter = 128

workers = multiprocessing.cpu_count() * 2 + 1
worker_connections = 1000
timeout = 60
keepalive = 2

errorlog = '-'
loglevel = 'debug'
accesslog = '-'
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'


def when_ready(server):
    open('/tmp/app-initialized', 'w').close()

这看起来像是用户的权限错误,但这应该不是问题,因为[2018-08-03 02:34:40 +0000] [116] [INFO] Starting gunicorn 19.9.0 [2018-08-03 02:34:40 +0000] [116] [DEBUG] connection to /tmp/gunicorn.sock failed: [Errno 1] Operation not permitted [2018-08-03 02:34:40 +0000] [116] [ERROR] Retrying in 1 second. [2018-08-03 02:34:41 +0000] [116] [DEBUG] connection to /tmp/gunicorn.sock failed: [Errno 1] Operation not permitted [2018-08-03 02:34:41 +0000] [116] [ERROR] Retrying in 1 second. [2018-08-03 02:34:42 +0000] [116] [DEBUG] connection to /tmp/gunicorn.sock failed: [Errno 1] Operation not permitted [2018-08-03 02:34:42 +0000] [116] [ERROR] Retrying in 1 second. [2018-08-03 02:34:43 +0000] [116] [DEBUG] connection to /tmp/gunicorn.sock failed: [Errno 1] Operation not permitted [2018-08-03 02:34:43 +0000] [116] [ERROR] Retrying in 1 second. [2018-08-03 02:34:44 +0000] [116] [DEBUG] connection to /tmp/gunicorn.sock failed: [Errno 1] Operation not permitted [2018-08-03 02:34:44 +0000] [116] [ERROR] Retrying in 1 second. [2018-08-03 02:34:45 +0000] [116] [ERROR] Can't connect to /tmp/gunicorn.sock gunicorn的身份运行

root

我还尝试过以/opt/app # ps aux | grep gunicorn 123 root 0:00 grep gunicorn 创建用户和组,并通过执行addgroup -S appgroup && adduser -S appuser -G appgroup来更改/tmp/文件夹的权限(因为未创建chown appuser:appgroup /tmp/文件)。

操作系统中的内容以gunicorn.sock的身份执行,但仍然出现此错误。我应该如何通过root文件运行它?

更新

gunicorn.sock

1 个答案:

答案 0 :(得分:0)

感谢https://github.com/benoitc/gunicorn/issues/1849的人们。

要动态创建套接字,您可能必须将它们放入static void Main(string[] args) { Console.WriteLine("Creating XLSX file using EPPlus"); CreateExcelFileInEpplus(); Console.WriteLine("Success in creating XLSX file using EPPlus"); ReadExcelFileUsingAsposeCells(); Console.WriteLine("Success in reading XLSX file using EPPlus"); } static void CreateExcelFileInEpplus() { var newFile = new FileInfo("output.xlsx"); if (File.Exists(newFile.Name)) File.Delete(newFile.Name); using (ExcelPackage xlPackage = new ExcelPackage(newFile)) { xlPackage.Workbook.Worksheets.Add("Sheet1"); // do work here xlPackage.Save(); } } static void ReadExcelFileUsingAsposeCells() { Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook("output.xlsx"); Console.WriteLine(workbook.Worksheets[0].Name); } ,即/run/中,然后才能将Nginx用作反向代理并通过给定的sock文件提供服务。

但是为什么要bind='unix:/run/gunicron.sock'

根据Wikipedia

  

运行时变量数据:有关自运行系统以来的信息   上一次引导,例如当前登录的用户和正在运行的守护程序。档案   必须删除或截断该目录下的   启动过程的开始;但这在系统上不是必需的   将该目录提供为临时文件系统(tmpfs)。

有关更多信息,请参见https://unix.stackexchange.com/questions/13972/what-is-this-new-run-filesystem