Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplified Docker dev setup #167

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

birkland
Copy link

@birkland birkland commented Feb 14, 2020

Draft PR to demonstrate Islandora 8 in Docker, using a simplified setup containing an external Ansible variables file, and no special Docker inventory, in contrast to #124

Creates and runs two Docker containers:

  • An ansible container that, upon startup, runs ansible to install Islandora 8 to the vm container
  • A vm container that plays the role of an empty Centos 7 box upon which Islandora 8 is installed via the ansible container.

Motivation

  • Providing the start of a development environment that would allow modeling of "services deployed on separate hosts" as containers.
    • Right now, though, everything is installed to a single container whose role is analogous to the Vagrant VM. It's a start, though.
  • Because using Ansible + Vagrant + Virtualbox in Windows is possible, but impractically awkward

To Test

  • Make sure Docker is installed, as well as docker-compose (usually comes with the Docker distribution, e.g on Mac and Windows)
  • Make sure the Islandora ports are free on your machine (e.g. there isn't another Islandora running on the same ports using Vagrant)
  • Check out this PR, and in the repository's directory (claw-playbook/) do docker-compose build
  • Do docker-compose up -d
  • Watch the logs of the ansible container via docker logs -f ansible. That's the ansible output!
  • At this point, the only way to know it's done/ready is to look at the logs. So watch the logs until Ansible is finished
    • Once the Ansible stops, the container will just run infinitely tailing /dev/null. The container won't exit if it succeeds or fails. It runs infinitely because that has been helpful for me in debugging Ansible issues.
  • If Ansible succeeds, try logging into Islandora at the usual address localhost:8000, and poke around!

Tips and tricks

  • You can hop onto any container while it's running by docker exec -it /bin/bash. For example, docker exec -it vm /bin/bash
  • docker-compose stop will stop all containers, but keep state. You can later on do a docker-compose up vm just to start the Islandora "vm" container.
    • I haven't yet put the persisted state into volumes, so files/state are just written in the container. As a result, all state disappears in a poof once the containers are destroyed, e.g. via docker-compose down. docker-compose stop preserves state.

Contains an "ansible" container that bootstrapps a "vm" container with
the entire Islandora stack
@whikloj
Copy link
Member

whikloj commented Mar 25, 2020

Trying this out as the normal method is failing and I have a problem with the ansible box.

Step 6/8 : COPY entrypoint.sh /bin/
 ---> ce3d6680bac4
Step 7/8 : RUN chmod 700 /bin/entrypoint.sh
 ---> Running in 10142b8583cb
Removing intermediate container 10142b8583cb
 ---> c27c6cded545
Step 8/8 : ENTRYPOINT [ "/bin/entrypoint.sh" ]
 ---> Running in 3bb0f1944e01
Removing intermediate container 3bb0f1944e01
 ---> fa0a1fe6d348
Successfully built fa0a1fe6d348
Successfully tagged clawplaybook_ansible:latest
WARNING: Image for service ansible was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating vm ... 
Creating vm ... done
Creating ansible ... 
Creating ansible ... error

ERROR: for ansible  Cannot start service ansible: cgroups: cannot find cgroup mount destination: unknown

ERROR: for ansible  Cannot start service ansible: cgroups: cannot find cgroup mount destination: unknown
ERROR: Encountered errors while bringing up the project.

@whikloj
Copy link
Member

whikloj commented Mar 25, 2020

Ok I forgot to run docker-compose build first, so I stopped and removed all running containers.
Then I removed the images.
Then ran docker-compose build

> docker-compose build
Building vm
Step 1/10 : FROM centos:7.6.1810
 ---> f1cb7c7d58b7
Step 2/10 : ENV container docker
 ---> Running in 049a03d4df43
Removing intermediate container 049a03d4df43
 ---> 61e287a5b98d
Step 3/10 : COPY sestatus /bin/
 ---> 64d85322a382
Step 4/10 : RUN chmod 700 /bin/sestatus
 ---> Running in 38df5cc95229
ERROR: Service 'vm' failed to build: cgroups: cannot find cgroup mount destination: unknown

@@ -0,0 +1,3 @@
#!/bin/sh

echo "Current mode: permissive"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually disable SELinux or just the reporting functions?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since SELinux isn't really running in Docker containers, this just tricks Ansible into passing its "is selinux set up correctly?" test.

@whikloj
Copy link
Member

whikloj commented Mar 26, 2020

@birkland So I have been able to get this to work, but even though the tomcat8 role shows no errors it seems to fail starting up.

Offending resource: ServletContext resource [/WEB-INF/classes/spring/repository.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [file:/opt/fcrepo/configs/fcrepo-config.xml]; nested exception is java.io.FileNotFoundException: /opt/fcrepo/configs/fcrepo-config.xml (No such file or directory)

I see the files now, and I can restart the service. It seems like at the time the files are not there and the service never restarts. Ideas how to debug this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants