aptivate / kashana

Aptivate logframe django project
GNU Affero General Public License v3.0
13 stars 15 forks source link

Deployment with Fabric fails #79

Open werzum opened 4 years ago

werzum commented 4 years ago

Hey guys,

I am trying to deploy the the Kashana App via SSH to a remote server. I followed the instructions in the documentation and created the respective configurations, however the deployment stops in its tracks pretty early with:

Fatal error: Incompatible ssh peer (no acceptable kex algorithm) Underlying exception: Incompatible ssh peer (no acceptable kex algorithm) Aborting.

I attempted to fix this by adding a respective conf file in the ssh config and by updating fabric/paramiko(both in the ve and globally) as github recommends, but it did not work for me.

Can you recommend anything else? Thanks for your help!

martinburchell commented 4 years ago

Sorry to hear that. Any clues in the output if you ssh to the server with -vv option? Are you in control of the server?

werzum commented 4 years ago

Hey, thanks for the response! I managed to fix this issue by adding only "KexAlgorithms diffie-hellman-group-exchange-sha1" to the sshd_config and restarting the SSH service.

However, I am stuck at another issue: the deployment script reported successfull deployment, but If I try to access the app via internet I get a 403-Forbidden error. The apache log shows the following; [client 79.230.165.107:56516] AH01630: client denied by server configuration: /var/django/alfie [Fri Jun 05 00:20:42.881559 2020] [wsgi:warn] [pid 20003:tid 140156737002432] (2)No such file or directory: mod_wsgi (pid=20003): Unable to stat Python home /usr/local/pythonenv/baseline. Python interpreter may not be able to be initialized correctly. Verify the supplied path and access permissions for whole of the path. [Fri Jun 05 00:20:42.881933 2020] [wsgi:warn] [pid 20004:tid 140156737002432] (2)No such file or directory: mod_wsgi (pid=20004): Unable to stat Python home /usr/local/pythonenv/baseline. Python interpreter may not be able to be initialized correctly. Verify the supplied path and access permissions for whole of the path. [Fri Jun 05 00:20:42.882332 2020] [wsgi:warn] [pid 20005:tid 140156737002432] (2)No such file or directory: mod_wsgi (pid=20005): Unable to stat Python home /usr/local/pythonenv/baseline. Python interpreter may not be able to be initialized correctly. Verify the supplied path and access permissions for whole of the path. ImportError: No module named site]

It seems that wsgi can not find the python environment, do you have any idea how to set this up correctly? The VirtualHost file for the app includes the WSGI path, as far as I can see, and WSGI should be present both in the virtual environment and global. I can post the Virtual Host file if it helps. Regargind the website permission error, I tried to fix it by chowning the /var/django/ folders for www-website(apache), but this didnt help.

Thanks for your help, I have been at the deployment for maybe seven hours and am anxious to finish it! But I also hope to make a pull request later on that updates some part of the documentation that have become outdated by now :)

martinburchell commented 4 years ago

Sorry it has taken so long to get the deployment working. We've deployed to CentOS but the world has moved on a bit since we developed Kashana.

I notice that the example apache/production.conf which I'm guessing you've copied refers to /var/django/alfie rather than /var/django/kashana (which is the case for staging.conf). Alfie is the old name for Kashana. Has the app been deployed to /var/django/alfie or /var/django/kashana ?

Any improvements to the documentation welcome!

werzum commented 4 years ago

Thanks for pointing out the Alfie part, I managed to fix this and redeployed to the server. However, the "unable to stat python home" issue persists, and apache is still complaining about "no such file or directory: mod_wsgi", even though it exists in the supplied environment. The current configuration of the virtual host configuration is the following:

` WSGIPythonHome ~/kashana-1/django/website/.ve/lib/python2.7/site-packages WSGISocketPrefix /var/run/wsgi WSGIRestrictEmbedded On

<VirtualHost *:80> ServerAdmin carers-sodis.kashana.org ServerName sodis.kashana.org

    DocumentRoot /var/www

    # Static content needed by Django
    Alias /static "/var/django/sodis.kashana/current/django/website/static/"
    <Location "/static">
            Order allow,deny
            Allow from all
            SetHandler None
    </Location>

    # Static content uploaded by users
    Alias /uploads "/var/django/sodis.kashana/current/django/website/uploads/"
    <Location "/uploads">
            Order allow,deny
            Allow from all
            SetHandler None
    </Location>

    # Django settings - AFTER the static media stuff
    WSGIScriptAlias / /var/django/sodis.kashana/current/wsgi/wsgi_handler.py
    WSGIDaemonProcess sodis processes=1 threads=5
    WSGIProcessGroup sodis
    WSGIApplicationGroup %{GLOBAL}

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    <DirectoryMatch "^/.*/\.(svn|git)/">
            Order allow,deny
            Deny from all
    </DirectoryMatch>

    # robots.txt
    #Alias /robots.txt /var/www/robots.txt

`

As you can see, I have manually set python home to the venv of the kashana app, but it still doesnt recognize it. Do you have any advice or guides for the proper installation of mod_wsgi?

martinburchell commented 4 years ago

Kashana is still on python v2.7 and that requires the python 2 version of mod_wsgi. Is your server using python v3 by any chance? Might be relevant

beeduino commented 3 years ago

Sorry it has taken so long to get the deployment working. We've deployed to CentOS but the world has moved on a bit since we developed Kashana.

How this movement can affect us in December 2020? I am going into installing Kashana to take a look.

martinburchell commented 3 years ago

@beeduino Briefly the versions of Python, Django and CentOS are no longer supported.

beeduino commented 3 years ago

@beeduino Briefly the versions of Python, Django and CentOS are no longer supported.

Thank you! I was able to run it with runserver setup under Debian, with SQLite as DB.