Hi Ashish,

Thanks, I had pretty much figured out the static file serving already. What 
really makes it easier is setting DJANGO_DEBUG=True in the Docker Compose 
file. This, I believe, tells Django server to automatically serve static 
files which it looks for in the my_project folder's /media directory and 
/media's sub-directories. It also looks for them in other STATICFILE_DIRS 
which are identified in settings.py. I commented those out for now as not 
needed. To populate my_project/media with the needed media files, I copied 
all files from arches/app/media. Everything is working great now.

The trick for copying the my_project folder to the host machine, then 
mounting the volume, seems to have solved the issue regarding 
bind-mounting. Doing it in that order makes sense. Thanks for that tip!

This setup works for development on http://localhost:8000 but obviously 
NGINX and the collectstatic function would play a role in production. I get 
how they work.

Thanks again,

Markus

On Thursday, June 11, 2020 at 5:37:52 AM UTC-7, Ashish Gautam wrote:
>
> Hi Markus,
>
> I'm glad it worked out
>
> Regarding step 6:
>
> As mentioned in 
> https://github.com/archesproject/arches/tree/master/docker#running-in-dev-mode
> you can bypass the Nginx service and access your Arches service through  
> http://localhost:8000 
>  
> If you want to access Arches service via Nginx http://localhost , first 
> you need to collect the static files from the project so that Nginx could 
> find it:
>
> - There's a named volume defined in the docker-compose file which takes 
> cares of the communication of the static files between Arches and Nginx, in 
> order to collect static you can exec the Arches container by:
>
> [image: image.png]
>
> *docker exec -it <container id/container name> bash*
>
>  Activate the virtual environment: 
>
> *source ../ENV/bin/activate*
>
> *cd to the  custom_project folder*
>
> *python manage.py collectstatic* ( This copies tons of files to the 
> static folder specified in the )
>
> Regarding your issue:
>
> You can follow the steps mentioned in 
> https://github.com/archesproject/arches/tree/master/docker#setting-up-your-own-arches-project
>
> If the error persists then you can try this workaround :
>
> Copy <your project name> folder from the container to host:
>
> *Stop the arches containe*r
>
> *docker cp  <container id/container name>:/web_root/ <your project name>  
> <your project name> * 
>
> Now, add this line under volumes in the Docker Compose file's 'arches' 
> service ... as mentioned in Step 4 of  
> https://github.com/archesproject/arches/tree/master/docker#setting-up-your-own-arches-project
>
>     * volumes:*
>     * - ./<your project name>:/web_root/<your project name> *
>  
> Run the container again: docker-compose up arches
>
>
> Best Regards,
> Ashish
>
>
> On Wed, Jun 10, 2020 at 12:44 AM Markus S. <[email protected] 
> <javascript:>> wrote:
>
>> Hi Ashish,
>>
>> That worked, thank you!! 
>>
>> Just for reference, below are the steps I took for getting a custom 
>> Project set up on Arches v5 when using Docker. The instructions at 
>> https://github.com/archesproject/arches/tree/master/docker#setting-up-your-own-arches-project
>>  
>> were helpful but did not work for me.
>>
>>    - 1. Clone Arches v5 files from 
>>    https://github.com/archesproject/arches to your computer using Git
>>    - 2. Modify the Docker Compose file:
>>       - Under service 'arches', set the image name to something like 
>>       yourlastname/arches:5.0. This will be built in a moment.
>>       - Under service 'arches', set ARCHES_PROJECT environment variable: 
>>       environment:
>>              - ARCHES_PROJECT=my_project
>>    - Under service 'arches', set DJANGO_MODE=DEV
>>    - 3. Make two modifications to docker/entrypoint.sh:
>>       - Comment out line 221: #[[ -d ${APP_FOLDER} ]] || mkdir 
>>       ${APP_FOLDER} 
>>       - Comment out a part of line 223: arches-project create 
>>       ${ARCHES_PROJECT} #--directory ${ARCHES_PROJECT}
>>    - 4. Build the Arches image using 'docker-compose build'. You can 
>>    verify this after with 'docker image ls'.
>>    - 5. Start Arches with a custom Project with 'docker-compose up'. If 
>>    this step fails, then try 'docker-compose down -v' (warning: erases 
>> volumes 
>>    and containers), then 'docker-compose up'. Sometimes I had to run 'docker 
>>    system prune' first.
>>    - 6. Open web browser at http://localhost (served by NGINX) or 
>>    http://localhost:8000 (served by Django)
>>
>> At step 6, you may note that media files are missing from Arches. Those 
>> will need to be added to the my_project (in the container) possibly by 
>> copying from arches/app/media.
>> Then it needs to be communicated to Django or NGINX where they are so 
>> that they can be served. This is still on my to-do list.
>>
>> OPTIONAL step: Under service arches, set bind-mount 
>> ./docker/entrypoint.sh:/web_root/entrypoint.sh. For this you may also need 
>> to open up permissions to the entrypoint.sh file with command chmod (on 
>> Linux machines).
>>
>> Issues:
>>
>> If I add this line under volumes in the Docker Compose file's 'arches' 
>> service ...
>>
>>     volumes:
>>     - ./my_project:/web_root/my_project
>>
>> ... running 'docker-compose up' will result into a Django server error. I 
>> still need to figure out how to bind-mount the Project files to my dev 
>> environment.
>>
>> Markus
>>
>>
>> On Wednesday, June 3, 2020 at 11:55:07 PM UTC-7, Ashish Gautam wrote:
>>>
>>> Hi Markus,
>>>
>>> I had a similar issue earlier while running Archesv5 in Docker. I did 
>>> the following changes to create and run custom-project smoothly:
>>>
>>> 1: entrypoint.sh file inside arches/docker/ 
>>>
>>>   Entrypoint breaks while creating the custom-arches-project in the line:
>>>
>>> [image: image.png]
>>> remove line 221 and  --directory ${ARCHES_PROJECT}  from line 223. In 
>>> order to reflect these changes, you can bind mount this file inside the 
>>> container or build a new one. Note that this should run the 
>>> container without any issue only in DEV mode. If you want to run in PROD 
>>> mode then more steps are required which also depends on whether you want to 
>>> run Celery or not.
>>>  
>>> Best Regards,
>>> Ashish
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Thu, Jun 4, 2020 at 4:41 AM Markus S. <[email protected]> wrote:
>>>
>>>> I got further by changing DJANGO_MODE=PROD to DJANGO_MODE=DEV. Now 
>>>> system starts up at least. It looks broken, though. The web server returns 
>>>> a 400 error on a lot of the media files.
>>>>
>>>> Nevertheless, I am trying to do this with *v5*. The instructions at 
>>>> https://github.com/archesproject/arches/tree/master/docker#setting-up-your-own-arches-project
>>>>  
>>>> are utilizing a *v4* Docker image. Swapping that to a v5 image did no 
>>>> work.
>>>>
>>>> I will continue exploring this.
>>>>
>>>> -- 
>>>> -- 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].
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/archesproject/41ac5f46-8e0c-45e6-aad8-bff1808c72e3%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/archesproject/41ac5f46-8e0c-45e6-aad8-bff1808c72e3%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>> -- To post, send email to [email protected] <javascript:>. To 
>> unsubscribe, send email to [email protected] <javascript:>. 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/archesproject/a86d4ac7-7b52-41d6-b4aa-75dc3044b1a5o%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/archesproject/a86d4ac7-7b52-41d6-b4aa-75dc3044b1a5o%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
-- 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/archesproject/e3c9bf7f-5f31-4506-a7d5-d342c141da47o%40googlegroups.com.

Reply via email to