Hi Vincent, Thank you so much for all the help and information. I finally got it running on Azure. Adding on, I have changed the ports back to 8000:8000.
Thanks again. Regards, Lawrence On Thu, Oct 11, 2018 at 8:11 PM Vincent Meijer <[email protected]> wrote: > In your case the Azure Web App takes on the role of Nginx, so you don't > need that. > Gunicorn is already built into the Arches image (see the command in the > entrypoint.sh), which is going to talk to your Web App. > > > Regarding whitenoise, you don't need to set STATIC_ROOT, as it is already > set for you (see docker/settings_local.py). Default value is /static_root > which > is fine. > Also, don't add the 'from whitenoise import WhiteNoise' line to your > wsgi.py file, those steps are for other systems besides Django (skip > everything after 'QuickStart for other WSGI apps'). > > Tip: you can add whitenoise to your requirements.txt so you have all your > requirements in one place, preferably with a version number: > whitenoise==4.1 > Then remove it from your entrypoint.sh > > If you can't get it to work: start with the simplest set up. > You can first try to get it running locally instead of in Azure Web App. > Perhaps first with DJANGO_MODE=DEV and DJANGO_DEBUG=True (in your > docker-compose.yml) > With those settings you don't need Whitenoise (but dev mode is not safe > for production environments). > If that works, set those settings back to PROD and False and try to get > Whitenoise working. > Then if that works, move over to Web App. > > Also be sure to remove nginx from your local docker-compose.yml, since > your goal is to run Arches without it in your Web App. > > Good luck and let me know how it goes! > Vincent > > On Thursday, 11 October 2018 05:48:18 UTC+2, Lawrence Goh wrote: >> >> Hi Vincent, >> >> I found more info on gunicorn and nginx. it seems they need each other. >> >> >> https://stackoverflow.com/questions/12800862/how-to-make-django-serve-static-files-with-gunicorn >> >> What do you think? >> >> Thanks. >> >> Regards, >> Lawrence >> >> On Thu, Oct 11, 2018, 3:58 PM Lawrence Goh <[email protected]> wrote: >> >>> Hi Vincent, >>> >>> I am trying to have whitenoise in. Have you done it before? >>> >>> I have modified entrypoint.sh to include 'pip install whitenoise' after >>> the virtual environment creation. Modified settings.py to have STATIC_ROOT >>> with this 'os.path.join(ROOT_DIR, 'staticfiles') and the entry in >>> MIDDLEWARE. Plus, wsgi.py file to have 'from whitenoise import WhiteNoise'. >>> >>> Unsure if anywhere else was missed. >>> >>> Thanks. >>> >>> Regards, >>> Lawrence >>> >>> On Wed, Oct 10, 2018 at 9:09 PM Vincent Meijer <[email protected]> >>> wrote: >>> >>>> Ah, I think I know what the problem is. Didn't think of this before, >>>> but Django does not want to serve static files (css, js, images, etc) when >>>> in PROD mode (and DEBUG=False). >>>> >>>> There are two routes I can think of right now: >>>> 1. Set up White Noise to make Django serve static files ( >>>> http://whitenoise.evans.io/en/stable/) >>>> 2. Set up the Azure CDN I described above >>>> >>>> I would personally go with option 2, because for me that made a big >>>> difference in terms of performance. >>>> >>>> >>>> On Wednesday, 10 October 2018 05:04:14 UTC+2, Lawrence Goh wrote: >>>>> >>>>> Hi Vincent, >>>>> >>>>> I guess I celebrated too early. I removed the cache and now the site >>>>> on port 80 is broken as the images and JS are not downloaded. Any idea on >>>>> this? >>>>> >>>>> Thanks. >>>>> >>>>> Regards, >>>>> Lawrence >>>>> >>>>> On Wed, Oct 10, 2018 at 2:36 PM Lawrence Goh <[email protected]> >>>>> wrote: >>>>> >>>>>> Hi Vincent, >>>>>> >>>>>> Thanks a lot of the suggestion. I tried the suggestion on dumping >>>>>> nginx and changing the port number but I kept couchdb as it is though. >>>>>> It >>>>>> is working as a web app for containers using multi-container. >>>>>> >>>>>> Will put the single container approach on the pipeline :) >>>>>> >>>>>> Thanks again! >>>>>> >>>>>> Regards, >>>>>> Lawrence >>>>>> >>>>>> On Wed, Oct 10, 2018 at 12:13 AM Vincent Meijer <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> No worries, I come from a .net environment myself. >>>>>>> As for the App Service, I realized that I set up Postgres and >>>>>>> Elasticsearch separately, that is why I was able to use the Single >>>>>>> Container approach (see below for future reference). >>>>>>> >>>>>>> I just remembered I wasn't able to get the docker-compose approach >>>>>>> working in the App Service. >>>>>>> If you like to give it another try, you could remove the nginx >>>>>>> service from your docker-compose.yml. >>>>>>> Then add a port mapping on your arches service in your >>>>>>> docker-compose.yml from 80 on the host (App Service) to 8000 on the >>>>>>> container: >>>>>>> Change: >>>>>>> ports: >>>>>>> - '8000:8000' >>>>>>> To: >>>>>>> ports: >>>>>>> - '80:8000' >>>>>>> >>>>>>> Also be sure to set the DOMAIN_NAMES setting in your >>>>>>> docker-compose.yml to the address of your web app. >>>>>>> >>>>>>> Finally, you may try removing the couchdb service from your >>>>>>> docker-compose.yml, as this db is not (yet) used by arches at the moment >>>>>>> (saves some resources). >>>>>>> Be sure to *keep* the couchdb environment variables in your Arches >>>>>>> service though (their values don't matter, but they are expected to be >>>>>>> present). >>>>>>> >>>>>>> >>>>>>> Here is some background info that might be useful: >>>>>>> https://blogs.msdn.microsoft.com/appserviceteam/2018/05/07/multi-container/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> *Single Container *approach >>>>>>> For the Single Container approach you wouldn't use a compose file at >>>>>>> all, but that is assuming you run Postgres and Elasticsearch elsewhere. >>>>>>> - On the App Service blade, select Container Settings (step 1 in the >>>>>>> screenshot below). >>>>>>> - Select 'Single Container' (step 2) >>>>>>> - Configure that page, ie. select the right image etc. >>>>>>> - Go to 'Application Settings' (step 3 on screenshot) and fill out >>>>>>> all environment variables you have in your docker-compose.yml as >>>>>>> individual >>>>>>> app settings >>>>>>> >>>>>>> >>>>>>> [image: Azure App Service.png] >>>>>>> >>>>>>> >>>>>>> On Tuesday, 9 October 2018 12:26:15 UTC+2, Lawrence Goh wrote: >>>>>>>> >>>>>>>> Hi Vincent, >>>>>>>> >>>>>>>> Thanks for the reply. I am not so well verse in the web >>>>>>>> development in open source space. Last I knew something related was >>>>>>>> Apache >>>>>>>> :) Pardon my knowledge as I am from .net. Some help would be very much >>>>>>>> appreciated to implement this. >>>>>>>> >>>>>>>> Based on the docker compose file, we have these containers - >>>>>>>> arches, nginx, db, elasticsearch, couchdb and letsencrypt. The single >>>>>>>> container would be having multiple single containers excluding nginx? >>>>>>>> >>>>>>>> What would be the best approach? >>>>>>>> >>>>>>>> Thanks. >>>>>>>> >>>>>>>> Regards, >>>>>>>> Lawrence >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Tue, Oct 9, 2018, 8:46 PM Vincent Meijer <[email protected]> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> Hi Lawrence, >>>>>>>>> >>>>>>>>> The Azure App Service is meant to take over everything but the app >>>>>>>>> itself, so running it with an nginx container is not necessary. >>>>>>>>> I used the App Service for a short while and only could get it to >>>>>>>>> work when using the single container approach. >>>>>>>>> >>>>>>>>> That being said, I found the App Service to be extremely slow (and >>>>>>>>> expensive), so I am eager to hear your experiences with it. >>>>>>>>> >>>>>>>>> For me it did help to set up Azure CDN to serve static files. >>>>>>>>> Roughly: >>>>>>>>> 1. Set up an Azure Blob Storage account >>>>>>>>> 2. Configure Django to use the azure-storage package ( >>>>>>>>> https://django-storages.readthedocs.io/en/latest/backends/azure.html >>>>>>>>> -> don't do the static files steps) >>>>>>>>> 3. Set up Azure CDN with the storage account from step 1 as origin. >>>>>>>>> 4. Set `STATIC_URL` in settings.py to the CDN endpoint. >>>>>>>>> >>>>>>>>> >>>>>>>>> I hope this helps and please share your experiences with us :) >>>>>>>>> Vincent >>>>>>>>> >>>>>>>>> >>>>>>>>> On Tuesday, 9 October 2018 04:19:42 UTC+2, Lawrence Goh wrote: >>>>>>>>>> >>>>>>>>>> Hi! I am trying to set up the Arches Project on Azure using its >>>>>>>>>> Web App for Containers. But I hit a roadblock where I will get a >>>>>>>>>> '400 Bad >>>>>>>>>> Request' when browsing it. I see the Azure logs are displaying that >>>>>>>>>> the >>>>>>>>>> NGINX got called when I triggered it on a browser. Hope to get some >>>>>>>>>> help >>>>>>>>>> on this. Thanks. >>>>>>>>>> >>>>>>>>> -- >>>>>>>>> -- To post, send email to [email protected]. To >>>>>>>>> unsubscribe, send email to [email protected]. For >>>>>>>>> more information, visit >>>>>>>>> https://groups.google.com/d/forum/archesproject?hl=en >>>>>>>>> --- >>>>>>>>> You received this message because you are subscribed to the Google >>>>>>>>> Groups "Arches Project" group. >>>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>>> send an email to [email protected]. >>>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>>> >>>>>>>> -- >>>>>>> -- To post, send email to [email protected]. To >>>>>>> unsubscribe, send email to [email protected]. For >>>>>>> more information, visit >>>>>>> https://groups.google.com/d/forum/archesproject?hl=en >>>>>>> --- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "Arches Project" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to [email protected]. >>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>> >>>>>> -- >>>> -- To post, send email to [email protected]. To unsubscribe, >>>> send email to [email protected]. For more information, >>>> visit https://groups.google.com/d/forum/archesproject?hl=en >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "Arches Project" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- > -- To post, send email to [email protected]. To unsubscribe, > send email to [email protected]. For more > information, visit https://groups.google.com/d/forum/archesproject?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Arches Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- To post, send email to [email protected]. To unsubscribe, send email to [email protected]. For more information, visit https://groups.google.com/d/forum/archesproject?hl=en --- You received this message because you are subscribed to the Google Groups "Arches Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
