Django on Synology

1,604 views
Skip to first unread message

cdavies...@gmail.com

unread,
Nov 28, 2017, 5:38:04 PM11/28/17
to modwsgi
Hi,

Following on from a GitHub Issue that I raised and subsquent conversation with the ever helpful Graham I'm here to look for help getting Django up and running on our Synology box.  

Currently my attempt to build (./configure) mod_wsgi from source results in:

checking for apxs2... no

checking for apxs... /opt/sbin/apxs

apxs:Error: /home/slug/optware/syno-i686/staging/opt/bin/apr-1-config not found!.

apxs:Error: /home/slug/optware/syno-i686/staging/opt/bin/apr-1-config not found!.

checking for gcc... gcc

checking whether the C compiler works... no

configure: error: in `/var/services/homes/daviesc/MODWSGI/mod_wsgi-develop':

configure: error: C compiler cannot create executables

See `config.log' for more details


find / -name apr-1-config
find / -name apu-1-config

returns null.

I'm currently working on getting the C Compiler happening but Graham has suggested using the Docker service.

Regards

Chris

Graham Dumpleton

unread,
Nov 28, 2017, 5:50:56 PM11/28/17
to mod...@googlegroups.com
So lack of apr-1-config/apu-1-config means that whoever has packaged Apache for the Synology NAS hasn't included the bits which would allow you to build third party Apache modules.

The better approach as I mentioned is to look at the docker service that you can install from the Synology package centre.

You then just need to create a docker image for your application and deploy it.

You could learn about docker and write your own instructions from scratch for creating a docker image, or you could use the Source-to-Image (S2I) package to do it and make your life much easier.

The S2I tool is available at:


With it installed creating a docker image can be as simple as running:

    s2i build . centos/python-35-centos7 blog

That is, take the application source code in the current directory, run it through the S2I builder centos/python-35-centos7 and out pops a docker image called 'blog'.

For this to work, the only thing I need to add to my application source code is an execute app.sh script which says how to start the web application. For example with something like:

#!/bin/bash

PORT=${PORT:-8080}

ARGS=""

ARGS="$ARGS --log-to-terminal"
ARGS="$ARGS --port $PORT"
ARGS="$ARGS --document-root htdocs"
ARGS="$ARGS --url-alias /media media"

exec python manage.py runmodwsgi $ARGS

In this case I have relied on having installed mod_wsgi from the requirements.txt file and set up Django to integrate with mod_wsgi in settings file.


I have not had to worry about creating a Dockerfile saying how to build the image as the S2I tool and builder worries about it all.

Once you have this docker image you could run it on your local docker service to test it. You could then upload it to an image registry and pull it from that back into your docker service on the Synology NAS and run it, or work out what the docker service on the NAS wants when you say to upload an image via URL or from a file, and perhaps load it into the NAS directory from your local machine and avoid using an image registry.

So that is the general suggestion based on fact that getting mod_wsgi integrated with the Synology NAS own Apache may not be trivial.

Graham

--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

cdavies...@gmail.com

unread,
Nov 29, 2017, 2:09:15 PM11/29/17
to modwsgi
Thanks Graham,

I'll take a look at your suggestion shortly.  Currently writing the application as I need to use it (locally) more urgently than I need it anywhere else!

Thanks again for all your help.

Chris

cdavies...@gmail.com

unread,
Feb 6, 2018, 1:34:46 PM2/6/18
to modwsgi
Hi Graham.

Ok a (maybe) interesting update for you.

I did have a play with Docker but didn't get very far.  I ran into issues with passing port 80 traffic from sinology through to docker to be processed.   However.....

I did have lots of success using the Virtual Machine app to create a Ubuntu Virtual machine that runs alongside DSM on its own volume and uses the second LAN port provided.

So basically I needed to rebuild the raid array into two volumes using the BTFS file system.  One has been allocated to Synolgy/DSM and all its applications.  The second volume has been given to a virtual machine.  I have been able to specify the RAM allocated etc.  I have installed Ubuntu and am able to SSH in via my machine using the second LAN port.   

Haven't yet tried installing Django etc but I consider this excellent progress both for Django but Synology as well.

Best Regards

Chris

Graham Dumpleton

unread,
Feb 6, 2018, 5:49:31 PM2/6/18
to mod...@googlegroups.com

On 7 Feb 2018, at 5:34 am, cdavies...@gmail.com wrote:

Hi Graham.

Ok a (maybe) interesting update for you.

I did have a play with Docker but didn't get very far.  I ran into issues with passing port 80 traffic from sinology through to docker to be processed.   However.....

Yeah, would expect that. They don't make it possible to put your own apps on the main port 80.

I did have lots of success using the Virtual Machine app to create a Ubuntu Virtual machine that runs alongside DSM on its own volume and uses the second LAN port provided.

So basically I needed to rebuild the raid array into two volumes using the BTFS file system.  One has been allocated to Synolgy/DSM and all its applications.  The second volume has been given to a virtual machine.  I have been able to specify the RAM allocated etc.  I have installed Ubuntu and am able to SSH in via my machine using the second LAN port.   

Will be curious how that works out. I never really understood what the VM support on the Synology was about. If you have links to good docs/tutorial about using the VM features of Synology, would love to see it.

Graham

Reply all
Reply to author
Forward
0 new messages