0594415f43352b3ef81a458516a1377f90b700f8
By:
moni

Droplet created from a snapshot not working

October 27, 2014 3.1k views

I have created a droplet from a snapshot of earlier working droplet(its a django app). When I open up the IP address in the browser it just doesn't work. I don't understand whats wrong. Any help?

4 comments
  • What happens exactly when you open the page in a browser? Do you get connection refused or an error message or just a blank page?

  • I think the problem is with IP address. 104.131.181.48 is my newly allotted IP and that of sanpshot was 104.131.72.215. When I ssh into my droplet it still shows 104.131.72.215

  • Are you sure that it has the old IP? That should not be happening. Did you used ifconfig to check the IP?

  • You can see that for yourself, I have provided the IP address. Its says connection was rejected.

2 Answers

You should contact the Support, they are fast and verry helpfull!

It's not entirely clear from your question, but when you say that you SSH into the server and it still shows your old IP address, do you just mean in this message:

Thank you for using DigitalOcean's Django Application. 
We have created a default Django application that can be seen from http://xxx.xxx.xx.xxx/ 
------------------------------------------------------------------------------------- 
You can use the following SFTP credentials to upload your files (using FileZilla/WinSCP/Rsync): 
Host: xxx.xxx.xx.xxx
User: django

------------------------------------------------------------------------------------- 
Nginx listens on public IP (xxx.xxx.xx.xxx) port 80 and forwards requests to Gunicorn on port 9000 
Nginx access log is in /var/log/nginx/access.log and error log is in /var/log/nginx/error.log 
Gunicorn is started using an Upstart script located at /etc/init/gunicorn.conf 
To restart your Django project, run : sudo service gunicorn restart

If so, that should be a problem. That file is created when you launch a new Django "one-click application." That is just your initial information. If you create a snapshot, that file is not updated. There is no way for it to know the new IP.

You problem is going to lay somewhere else most likely. Are you seeing any errors in /var/log/nginx/error.log ?

  • Yes, it shows the previous IP. Here is what it shows:

    Thank you for using DigitalOcean's Django Application. 
    We have created a default Django application that can be seen from http://104.131.72.215/ 
    ------------------------------------------------------------------------------------- 
    You can use the following SFTP credentials to upload your files (using FileZilla/WinSCP/Rsync): 
    Host: 104.131.72.215 
    User: django
    
    ------------------------------------------------------------------------------------- 
    Nginx listens on public IP (104.131.72.215) port 80 and forwards requests to Gunicorn on port 9000 
    Nginx access log is in /var/log/nginx/access.log and error log is in /var/log/nginx/error.log 
    Gunicorn is started using an Upstart script located at /etc/init/gunicorn.conf 
    To restart your Django project, run : sudo service gunicorn restart
    

    But, my new IP is http://104.131.181.48/ .

  • Right, that's just a text file that is created when the droplet first booted. Your snapshot copies all of the files from the original droplet exactly. So that's why the old information is there, but that file is only used to display that information not anything system critical. If visiting http://104.131.181.48/ doesn't show anything, then you probably have a problem somewhere else. Is there anything in /var/log/nginx/error.log ?

  • /var/log/nginx/error.log contains below lines:

    2014/10/27 09:40:05 [emerg] 971#0: unknown directive "base" in /etc/nginx/sites-enabled/django:10 
    2014/10/27 09:45:05 [emerg] 945#0: unknown directive "base" in /etc/nginx/sites-enabled/django:10 
    

    Contents of file /etc/nginx/sites-enabled/django, last line is one with error :

    upstream app_server { 
    server 127.0.0.1:9000 fail_timeout=0; 
    }
    
    server { 
    listen 80 default_server; 
    listen [::]:80 default_server ipv6only=on;
    
    root /usr/share/nginx/html; 
    base base.html base.htm;
    

    I hads changed this line from 'index index.html index.htm;' to 'base base.html base.htm;', but it worked just fine in the previous droplet. I have changed it back to default but still its not working.

  • The index directive "sets the default file to serve if a directory is requested by the client" (Nginx doc link). You can specify that file to have a different name, but the line still needs to start with index So you want something like:

       root /usr/share/nginx/html;
       index base.html base.htm;
    
  • Ok. I have changed it back to above line. Also, I had opened up support ticket regarding the same and from there I got to know that nginx was not running. I started it with "service nginx start" and now everything is working fine. Thanks for the help :)

Have another answer? Share your knowledge.