Arches v5 in Docker - creating a Project

80 views
Skip to first unread message

Markus S.

unread,
Jun 2, 2020, 6:57:53 PM6/2/20
to arches...@googlegroups.com
Hi,

I have been running Arches v5 in a Docker container without an issue for a while. Next it was time to create a custom Project. I followed instructions at https://github.com/archesproject/arches/tree/master/docker#setting-up-your-own-arches-project without success: Gunicorn always fails to start, likely as a result of some other issue. To troubleshoot, I have tried the following things:
  • Remove all containers and volumes, then rebuild, then create and start the containers again
  • Build the Arches v5 base image from the official code rather than pulling it from Docker Hub
  • Double-check env vars to make sure there are no spaces or weird characters
  • Start elasticsearch and db prior to starting the other services
  • Double-check the instructions over and over
None of these helped and I cannot get Arches running with a custom Project: the arches service always fails to start.

Since I can get Arches running without a Project (leave Docker Compose file and Dockerfile as is - no modifications), I have tried bashing into the Arches container and creating a Project there using terminal command 'arches-project create my_project'. That works fine but all it does is create the project folder such as 'my_project'. But then I assume I have to switch Arches to use that folder as the application folder. How would I do that?

Thanks,

Markus


Markus S.

unread,
Jun 3, 2020, 6:56:26 PM6/3/20
to Arches Project
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.

Ashish Gautam

unread,
Jun 4, 2020, 2:55:07 AM6/4/20
to Markus S., Arches Project
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.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






--
-- To post, send email to arches...@googlegroups.com. To unsubscribe, send email to archesprojec...@googlegroups.com. 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 archesprojec...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/archesproject/41ac5f46-8e0c-45e6-aad8-bff1808c72e3%40googlegroups.com.

Markus S.

unread,
Jun 9, 2020, 2:59:21 PM6/9/20
to Arches Project
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.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. <markus....@gmail.com> 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 arches...@googlegroups.com. To unsubscribe, send email to arches...@googlegroups.com. 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 arches...@googlegroups.com.

Ashish Gautam

unread,
Jun 11, 2020, 8:37:52 AM6/11/20
to Markus S., Arches Project
Hi Markus,

I'm glad it worked out

Regarding step 6:

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.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:


If the error persists then you can try this workaround :

Copy <your project name> folder from the container to host:

Stop the arches container

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


-- To post, send email to arches...@googlegroups.com. To unsubscribe, send email to archesprojec...@googlegroups.com. 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 archesprojec...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/archesproject/a86d4ac7-7b52-41d6-b4aa-75dc3044b1a5o%40googlegroups.com.

Markus S.

unread,
Jun 11, 2020, 6:58:49 PM6/11/20
to Arches Project
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
Reply all
Reply to author
Forward
0 new messages