मेरे पास डीजेंगो ऐप है जिसे मैं पर्यवेक्षक का उपयोग करके एक डॉकर कंटेनर में यूडब्ल्यूएसजीआई के साथ चलाना चाहता हूं ।
मैं अपने ओएसएक्स फाइल सिस्टम को अपने अंदर सफलतापूर्वक माउंट करने के लिए ओएसएक्स एसओ का उपयोग कर रहा हूं boot2docker
वीएम (इसलिए मैं डॉकर के साथ वॉल्यूम माउंट कर सकता हूं run -v /source/:/destination
) मुझे उपयोग करना पड़ा है sshfs
जो मुझे लगता है कि मेरे माउंटेड फाइल सिस्टम पर कुछ अजीब अनुमतियां पैदा कर रहा है ।
मैं अपने पर दो आरोह है boot2docker
वीएम; एक जो मेरे ऐप्स कोडबेस को इंगित करता है और एक जो लगातार लॉग लिखने के लिए मेरे होस्ट पर एक मनमाना स्थान की ओर इशारा करता है
Host: /Users/username/workspace/project --- > boot2docker: /home/docker/osxHost: /containers/project --- > boot2docker: /containers/project
मैं अपना डॉकर कंटेनर शुरू करता हूं:
docker run -t -i -p 80 -v /home/docker/osx/project/www:/var/www -v /containers/project:/host image-name /bin/bash
मेरे ऐप के लिए मेरा पर्यवेक्षक कॉन्फ़िगरेशन इस तरह दिखता है:
[program:app_name]command=uwsgi --ini /var/www/wsgi/uwsgi.inidirectory=/var/wwwautostart=trueautorestart=truestdout_logfile=/host/logs/app-name.logredirect_stderr=True
मेरा usgi.ini
इस तरह दिखता है:
[uwsgi]http = :3041chdir = /var/wwwmodule = run.wsgiuid = www-datagid = 33master = Trueprocesses = 4threads = 1pidfile = /var/run/uwsgi.pidtouch-reload = /var/run/uwsgi.pidlogto = /host/logs/uwsgi.log
जब मैं सुपरवाइजर के साथ अपना ऐप चलाता हूं तो मुझे निम्नलिखित त्रुटियां मिलती हैं:
root@4237fd060a40:/var/www# supervisorctlapp_name FATAL Exited too quickly (process log may have details)supervisor> start app_name2014-06-15 10:22:16,559 INFO spawned: 'app_name' with pid 1052014-06-15 10:22:16,633 INFO exited: app_name (exit status 1; not expected)2014-06-15 10:22:17,658 INFO spawned: 'app_name' with pid 106app_name: ERROR (abnormal termination)
और यूडब्ल्यूएसजीआई लॉग में मैं देख रहा हूं:
[uWSGI] getting INI configuration from /var/www/run/uwsgi.ini*** Starting uWSGI 1.9.10 (64bit) on [Sun Jun 15 10:22:22 2014] ***compiled with version: 4.6.3 on 13 June 2014 15:25:05os: Linux-3.14.1-tinycore64 #1 SMP Mon Jun 9 16:21:23 UTC 2014nodename: 4237fd060a40machine: x86_64clock source: unixdetected number of CPU cores: 4current working directory: /var/wwwwriting pidfile to /var/run/uwsgi.piddetected binary path: /usr/local/bin/uwsgisetgid() to 33setuid() to 33chdir(): Permission denied [core/uwsgi.c line 2121]
चल रहा है id -g www-data
मुझे दिखाता है कि मेरा जीआईडी सही है और वह www-data
मौजूद है:
root@4237fd060a40:/var/www# id -g www-data33
और मेरे डॉकर कंटेनर के अंदर फ़ाइल अनुमतियां जो मैं देख रहा हूं वह इस तरह दिखती है:
root@4237fd060a40:/var/www# lltotal 76drwxr-xr-x 1 10133 10000 578 Jun 15 09:55 ./drwxr-xr-x 30 root root 4096 Jun 15 09:52 ../drwxr-xr-x 1 10133 10000 714 Jun 13 10:55 some_folder/drwxr-xr-x 1 10133 10000 1292 Jun 9 11:29 some_file.py
इसलिए क्योंकि मैं देख रहा हूँ uid
एस और gid
यहां, फ़ाइलें / फ़ोल्डर एक उपयोगकर्ता के स्वामित्व में हैं जो मौजूद नहीं है (वे मेरे होस्ट ओएसएक्स उपयोगकर्ता नाम से मेल खाते हैं uid
और gid
), और मुझे ऊपर अनुमति त्रुटियां मिल रही हैं क्योंकि www-data
उपयोगकर्ता के पास माउंटेड फाइल सिस्टम पर लिखने की पहुंच नहीं है, जिसे मैं उपयोग करके साबित कर सकता हूं su
:
root@4237fd060a40:/var/www# su www-data$ pwd/var/www$ touch test2touch: cannot touch `test2': Permission denied
अब तक समझ में आता है, लेकिन जब मैं कोशिश करता हूं और एक फ़ाइल को रूट के रूप में लिखता हूं:
root@4237fd060a40:/var/www# touch testroot@4237fd060a40:/var/www# lltotal 76...-rw-r--r-- 1 10133 10000 0 Jun 15 10:20 test
फ़ाइल लिखना ठीक काम करता है, और इसका अधिकार भी है uid
और gid
.
इसलिए, मुझे उम्मीद है कि यूडब्ल्यूएसजीआई को इसके साथ रूट के रूप में चलाया जाएगा uwsgi.ini
फ़ाइल:
[uwsgi]http = :3041chdir = /var/wwwmodule = run.wsgiuid = rootgid = 10000master = Trueprocesses = 4threads = 1pidfile = /var/run/uwsgi.pidtouch-reload = /var/run/uwsgi.pidlogto = /host/logs/uwsgi.log
या इसके साथ 10133 के रूप में uwsgi.ini
फ़ाइल:
[uwsgi]http = :3041chdir = /var/wwwmodule = run.wsgiuid = 10133gid = 10000master = Trueprocesses = 4threads = 1pidfile = /var/run/uwsgi.pidtouch-reload = /var/run/uwsgi.pidlogto = /host/logs/uwsgi.log
काम करेगा, लेकिन मुझे कोई प्यार नहीं मिल रहा है:
[uWSGI] getting INI configuration from /var/www/run/uwsgi.ini*** Starting uWSGI 1.9.10 (64bit) on [Sun Jun 15 10:30:05 2014] ***compiled with version: 4.6.3 on 13 June 2014 15:25:05os: Linux-3.14.1-tinycore64 #1 SMP Mon Jun 9 16:21:23 UTC 2014nodename: 4237fd060a40machine: x86_64clock source: unixdetected number of CPU cores: 4current working directory: /var/wwwwriting pidfile to /var/run/uwsgi.piddetected binary path: /usr/local/bin/uwsgisetgid() to 10000*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***chdir(): Permission denied [core/uwsgi.c line 2121]
और
[uWSGI] getting INI configuration from /var/www/run/uwsgi.ini*** Starting uWSGI 1.9.10 (64bit) on [Sun Jun 15 10:30:36 2014] ***compiled with version: 4.6.3 on 13 June 2014 15:25:05os: Linux-3.14.1-tinycore64 #1 SMP Mon Jun 9 16:21:23 UTC 2014nodename: 4237fd060a40machine: x86_64clock source: unixdetected number of CPU cores: 4current working directory: /var/wwwwriting pidfile to /var/run/uwsgi.piddetected binary path: /usr/local/bin/uwsgiuWSGI running as root, you can use --uid/--gid/--chroot optionssetgid() to 10000setuid() to 10133chdir(): Permission denied [core/uwsgi.c line 2121]
मुझे क्या याद आ रहा है?