Re: Gunicorn sock file is missing?

2015-03-07 Thread Kaloian

>
> Did you try to sudo to the user running gunicorn and creating the socket?

Do you mean to create the socket manually? Haven't tried that. 

The directory and all its parents are owned by the user running gunicorn 
and also have 777 permissions. I am no sure I understand what you mean by - 
"The user isn't in one of the new group cause he is logged in" . 
Is it possible the reason to be something from the virtual env since the 
directory  /webapps/my-app/run/ is inside virtual env path. 

Thanks,
Kaloian


On Friday, March 6, 2015 at 5:01:55 PM UTC+2, aRkadeFR wrote:
>
>  
> On 03/06/2015 01:30 PM, Kaloian wrote:
>  
> Hi Erik, and thanks for the help. 
>
> Well it appears to be a permission issue after all, but I really cannot 
> understand why. I tried to change the directory for the sock file from 
> /webapps/my-app/run/gunicorn.sock to /sockets/gunicorn.sock and gunicorn 
> started normally. I tried to give full permissions to /webapps/my-app/run/ 
> but still no success. I never tried to create the sock file myself and the 
> /webapps/my-app/run/ dir is empty all the time. I cannot understand what is 
> stopping gunicorn from creating the sock file in this directory. 
>  
>
> Did you try to sudo to the user running gunicorn and creating the socket?
> Some hints:
> - The user can't access the directory cause he is not allowed to index one 
> of his parent
> - The user isn't in one of the new group cause he is logged in
> - ... ?
>
> Most of the time sudo to the user is useful for me
>
>  
> Regards,
> Kaloian 
>
> On Thursday, February 26, 2015 at 10:47:41 AM UTC+2, Erik Cederstrand 
> wrote: 
>>
>>
>> > Den 26/02/2015 kl. 07.56 skrev Kaloian : 
>> > 
>> > Hi Erik, 
>> > 
>> > No it doesn't start at all, running the gunicorn_start script gives: 
>> > 
>> > [ERROR] Retrying in 1 second. 
>> > [ERROR] Retrying in 1 second. 
>> > [ERROR] Retrying in 1 second. 
>> > [ERROR] Retrying in 1 second. 
>> > [ERROR] Retrying in 1 second. 
>> > [ERROR] Can't connect to /path/to/my/gunicorn.sock 
>> > 
>> > This is why I thought that the missing sock file is failing it to 
>> start. Do you think it could be something else? 
>> > I have already tried to add the absolute path in gunicorn_start but 
>> nothing changed. 
>>
>> A UNIX socket is like a TCP connection, except it's represented as a 
>> file. gunicorn is supposed to create it on startup and destroy it on 
>> shutdown, and it shouldn't be present when gunicorn is not running. 
>>
>> Maybe you tried to create /path/to/my/gunicorn.sock yourself, and the 
>> file is now garbage? Try deleting it. Otherwise, another instance of 
>> gunicorn may be running already. Try "ps aux | grep gunicorn" or "lsof -U | 
>> grep gunicorn" if you're on Linux. Also, the user running gunicorn_start 
>> must have access to create files in /path/to/my/ 
>>
>> Erik
>
>  -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/59fe3b92-d9d7-4e03-b8f3-b0be1c355d78%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d55eb7d8-f81d-4992-b5ac-5c453a27cd80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Gunicorn sock file is missing?

2015-03-06 Thread aRkadeFR


On 03/06/2015 01:30 PM, Kaloian wrote:

Hi Erik, and thanks for the help.

Well it appears to be a permission issue after all, but I really 
cannot understand why. I tried to change the directory for the sock 
file from /webapps/my-app/run/gunicorn.sock to /sockets/gunicorn.sock 
and gunicorn started normally. I tried to give full permissions to 
/webapps/my-app/run/ but still no success. I never tried to create the 
sock file myself and the /webapps/my-app/run/ dir is empty all the 
time. I cannot understand what is stopping gunicorn from creating the 
sock file in this directory.


Did you try to sudo to the user running gunicorn and creating the socket?
Some hints:
- The user can't access the directory cause he is not allowed to index 
one of his parent

- The user isn't in one of the new group cause he is logged in
- ... ?

Most of the time sudo to the user is useful for me



Regards,
Kaloian

On Thursday, February 26, 2015 at 10:47:41 AM UTC+2, Erik Cederstrand 
wrote:



> Den 26/02/2015 kl. 07.56 skrev Kaloian >:
>
> Hi Erik,
>
> No it doesn't start at all, running the gunicorn_start script
gives:
>
> [ERROR] Retrying in 1 second.
> [ERROR] Retrying in 1 second.
> [ERROR] Retrying in 1 second.
> [ERROR] Retrying in 1 second.
> [ERROR] Retrying in 1 second.
> [ERROR] Can't connect to /path/to/my/gunicorn.sock
>
> This is why I thought that the missing sock file is failing it
to start. Do you think it could be something else?
> I have already tried to add the absolute path in gunicorn_start
but nothing changed.

A UNIX socket is like a TCP connection, except it's represented as
a file. gunicorn is supposed to create it on startup and destroy
it on shutdown, and it shouldn't be present when gunicorn is not
running.

Maybe you tried to create /path/to/my/gunicorn.sock yourself, and
the file is now garbage? Try deleting it. Otherwise, another
instance of gunicorn may be running already. Try "ps aux | grep
gunicorn" or "lsof -U | grep gunicorn" if you're on Linux. Also,
the user running gunicorn_start must have access to create files
in /path/to/my/

Erik

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/59fe3b92-d9d7-4e03-b8f3-b0be1c355d78%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F9C13C.7000101%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


Re: Gunicorn sock file is missing?

2015-03-06 Thread Kaloian
Hi Erik, and thanks for the help. 

Well it appears to be a permission issue after all, but I really cannot 
understand why. I tried to change the directory for the sock file from 
/webapps/my-app/run/gunicorn.sock to /sockets/gunicorn.sock and gunicorn 
started normally. I tried to give full permissions to /webapps/my-app/run/ 
but still no success. I never tried to create the sock file myself and the 
/webapps/my-app/run/ dir is empty all the time. I cannot understand what is 
stopping gunicorn from creating the sock file in this directory. 

Regards,
Kaloian 

On Thursday, February 26, 2015 at 10:47:41 AM UTC+2, Erik Cederstrand wrote:
>
>
> > Den 26/02/2015 kl. 07.56 skrev Kaloian  >: 
> > 
> > Hi Erik, 
> > 
> > No it doesn't start at all, running the gunicorn_start script gives: 
> > 
> > [ERROR] Retrying in 1 second. 
> > [ERROR] Retrying in 1 second. 
> > [ERROR] Retrying in 1 second. 
> > [ERROR] Retrying in 1 second. 
> > [ERROR] Retrying in 1 second. 
> > [ERROR] Can't connect to /path/to/my/gunicorn.sock 
> > 
> > This is why I thought that the missing sock file is failing it to start. 
> Do you think it could be something else? 
> > I have already tried to add the absolute path in gunicorn_start but 
> nothing changed. 
>
> A UNIX socket is like a TCP connection, except it's represented as a file. 
> gunicorn is supposed to create it on startup and destroy it on shutdown, 
> and it shouldn't be present when gunicorn is not running. 
>
> Maybe you tried to create /path/to/my/gunicorn.sock yourself, and the file 
> is now garbage? Try deleting it. Otherwise, another instance of gunicorn 
> may be running already. Try "ps aux | grep gunicorn" or "lsof -U | grep 
> gunicorn" if you're on Linux. Also, the user running gunicorn_start must 
> have access to create files in /path/to/my/ 
>
> Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/59fe3b92-d9d7-4e03-b8f3-b0be1c355d78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Gunicorn sock file is missing?

2015-02-26 Thread Erik Cederstrand

> Den 26/02/2015 kl. 07.56 skrev Kaloian :
> 
> Hi Erik,
> 
> No it doesn't start at all, running the gunicorn_start script gives: 
> 
> [ERROR] Retrying in 1 second.
> [ERROR] Retrying in 1 second.
> [ERROR] Retrying in 1 second.
> [ERROR] Retrying in 1 second.
> [ERROR] Retrying in 1 second.
> [ERROR] Can't connect to /path/to/my/gunicorn.sock 
> 
> This is why I thought that the missing sock file is failing it to start. Do 
> you think it could be something else? 
> I have already tried to add the absolute path in gunicorn_start but nothing 
> changed. 

A UNIX socket is like a TCP connection, except it's represented as a file. 
gunicorn is supposed to create it on startup and destroy it on shutdown, and it 
shouldn't be present when gunicorn is not running.

Maybe you tried to create /path/to/my/gunicorn.sock yourself, and the file is 
now garbage? Try deleting it. Otherwise, another instance of gunicorn may be 
running already. Try "ps aux | grep gunicorn" or "lsof -U | grep gunicorn" if 
you're on Linux. Also, the user running gunicorn_start must have access to 
create files in /path/to/my/

Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/091316F1-9473-4A28-B237-FAA8C371E169%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Gunicorn sock file is missing?

2015-02-25 Thread Kaloian
Hi Erik,

No it doesn't start at all, running the gunicorn_start script gives: 


*[ERROR] Retrying in 1 second.*
*[ERROR] Retrying in 1 second.*
*[ERROR] Retrying in 1 second.*
*[ERROR] Retrying in 1 second.*
*[ERROR] Retrying in 1 second.**[ERROR] Can't connect to 
/path/to/my/gunicorn.sock *

This is why I thought that the missing sock file is failing it to start. Do 
you think it could be something else? 
I have already tried to add the absolute path in gunicorn_start but nothing 
changed. 

Thanks,
Kaloian


On Wednesday, February 25, 2015 at 11:55:43 AM UTC+2, Erik Cederstrand 
wrote:
>
>
> > Den 25/02/2015 kl. 07.16 skrev Kaloian  >: 
> > 
> > I have an ansible provisioned VM based on this one 
> https://github.com/jcalazan/ansible-django-stack but for some reason 
> trying to start Gunicorn gives the following error: 
> > 
> > Can't connect to /path/to/my/gunicorn.sock 
> > 
> > [...] 
> > 
> > Can anyone point me to any direction what could be causing the missing 
> gunicorn.sock file ? 
>
> Is gunicorn even running? If not, you ned to find out why it failed to 
> start, or why it crashed. As a start, try adding the absolute path to 
> gunicorn in your gunicorn_start script instead of just "exec gunicorn". 
>
> Erik 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e326ee4c-1443-4f59-a00a-9249269caad1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Gunicorn sock file is missing?

2015-02-25 Thread Erik Cederstrand

> Den 25/02/2015 kl. 07.16 skrev Kaloian :
> 
> I have an ansible provisioned VM based on this one 
> https://github.com/jcalazan/ansible-django-stack but for some reason trying 
> to start Gunicorn gives the following error:
> 
> Can't connect to /path/to/my/gunicorn.sock
> 
> [...]
> 
> Can anyone point me to any direction what could be causing the missing 
> gunicorn.sock file ?

Is gunicorn even running? If not, you ned to find out why it failed to start, 
or why it crashed. As a start, try adding the absolute path to gunicorn in your 
gunicorn_start script instead of just "exec gunicorn".

Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/F5273312-7606-45BD-9042-0807A7F030D1%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Gunicorn sock file is missing?

2015-02-24 Thread Kaloian


I have an ansible provisioned VM based on this one 
https://github.com/jcalazan/ansible-django-stack but for some reason trying 
to start Gunicorn gives the following error:

*Can't connect to /path/to/my/gunicorn.sock *

and in nginx log file:

*connect() to unix:/path/to/my/gunicorn.sock failed (2: No such file or 
directory) while connecting to upstream*

And the socket file is really missing in the specified directory. I have 
checked the permissions of the directory and they are fine.

Here is my gunicorn_start script:


NAME="{{ application_name }}" 
DJANGODIR={{ application_path }} 
SOCKFILE={{ virtualenv_path }}/run/gunicorn.sock 
USER={{ gunicorn_user }} GROUP={{ gunicorn_group }} 
NUM_WORKERS={{ gunicorn_num_workers }} 

# Set this to 0 for unlimited requests. During development, you might want to # 
set this to 1 to automatically restart the process on each request (i.e. your # 
code will be reloaded on every request). 
MAX_REQUESTS={{ gunicorn_max_requests }} 
echo "Starting $NAME as `whoami`" 
# Activate the virtual environment. 
cd $DJANGODIR 
. ../../bin/activate 
# Set additional environment variables. 
. ../../bin/postactivate 
# Create the run directory if it doesn't exist. 
RUNDIR=$(dirname $SOCKFILE) test -d $RUNDIR || mkdir -p $RUNDIR 
# Programs meant to be run under supervisor should not daemonize themselves # 
(do not use --daemon). 
exec gunicorn \ --name $NAME \ 
--workers $NUM_WORKERS \ 
--max-requests $MAX_REQUESTS \ 
--user $USER --group $GROUP \ 
--log-level debug \ 
--bind unix:$SOCKFILE \ 
{{ application_name }}.wsgi


Can anyone point me to any direction what could be causing the missing 
gunicorn.sock file ?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f4fa6c59-9b9c-4433-831d-0f563b5dd763%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.