Islandora-Devops / isle-dc

ISLE 8 - Dockerized Islandora 8 Deployment orchestrated with docker-compose
MIT License
23 stars 60 forks source link

404 not found when using IP address #106

Open jmvezic opened 4 years ago

jmvezic commented 4 years ago

Tried this on both a local IP (192.168...) and a Digital Ocean droplet, same thing. Simply returs "404 page not found". Set up the following settings as per the README:

DRUPAL_SITE_HOST=192-168-5-20.traefik.me

Changed all the dots into hyphens as per the README in docker-compose.env.yml

Ran "make" and "docker-compose up -d". When running with default settings (localhost), it works.

fostro commented 4 years ago

Any update on this? I'm seeing the same issue, though I haven't managed to confirm it works with localhost settings instead of an IP address as it's running on a VM without a GUI.

noahwsmith commented 4 years ago

The way this is set up by default means the Drupal front end will be accessible on this domain if you have entered that IP address:

https://islandora-isle-dc-192-168-5-20.traefik.me/ not simply the domain https://192-168-5-20.traefik.me

That server appears to be off at the moment, or has network settings which block my access. Does that help?

fostro commented 4 years ago

I'm not interested in that address, this was someone else's issue I jumped on since it didn't seem to have been answered. The issue is a 404 page not found. You can see the same behavior with a real FQDN at https://islandora8-test.acg.maine.edu using demo mode.

jmvezic commented 4 years ago

@noahwsmith That URL also gives a 404 not found. Both local and remote (DigitalOcean). Maybe there's something missing in the README that makes the IP address variant work?

noahwsmith commented 4 years ago

Run docker-compose logs -f to see a log trace. Can you please post the output? You can also shell into the container (docker-compose exec drupal bash) and look around at the web root to see if it is all there correctly.

A 404 typically means that the "web" directory hasn't been compiled by Composer, or that your Drupal root bind mount is not pointed at a valid location. My guess is that something interrupted your Demo install (which happens behind the scenes in the first 10 minutes the server is turned on the first time) or you never ran one of the commands that run Drupal's site-install if you're doing a Local mode. (trying to post info that is relevant to both people commenting on this ticket)

jmvezic commented 4 years ago

Okay, finally did it. But I don't know which of these two things helped:

Instead of make and docker-compose up -d I ran them with sudo. So

sudo make

and

sudo docker-compose up -d

Also, after running "sudo make" I waited for a while before running "sudo docker-compose up -d" (even after everything was pulled). Maybe this is what @noahwsmith you meant by "which happens behind the scenes in the first 10 minutes the server is turned on the first time".

Also, once I could access (https://islandora-isle-dc-192-168-5-20.traefik.me/) the site was in maintenance mode, so I had to

sudo docker-compose exec drupal bash

go to web/sites/default and

drush state:set system.maintenance_mode 0

And now it's up and running. Regarding this, I have two-three recommendations for README:

noahwsmith commented 4 years ago

The need for sudo indicates some funky file or Docker permissioning- I don't think we want that to be the default. If others replicate this issue, we should solve it at the root so sudo isn't needed (cc @nigelgbanks ). I'll say that I recently spun up a new ISLE8 and didn't need to do any sudoing.

I'm not sure about the maintenance mode- I can't replicate that either.

I agree the docs should update regarding the access URL. Will you issue a PR to fix @jmvezic ? Thanks in advance...

jmvezic commented 4 years ago

Made a PR for README update. I will check later today or tomorrow if the same thing (sudo, maintenence mode) will repeat on DigitalOcean with a Debian 10 droplet, and make note of every command I run (and packages installed).

nigelgbanks commented 4 years ago

Might be one or more issues with sudo.

If the user is not a member of the docker group, check with groups command.

$ groups
nbanks adm cdrom sudo dip plugdev lpadmin lxd sambashare libvirt docker

If a user is not in the docker group then they are not allowed to use docker, docker-compose hence the need for sudo.

https://docs.docker.com/engine/install/linux-postinstall/

Additionally the need from sudo may also arises from files being created from inside of the Drupal container on a folder mounted on the host. Wherein the user inside of the container (either nginx uid:101 or root uid:0) writes files to the host mounted folder and the user on the host doesn't have permission to modify those files. Host mounted folders are generally problematic for this reason. There isn't a real work around for this that per say its just a property of using host mounted folders. You'll need to make sure the files in the host mounted folders can be read by the nginx user uid:101 but if you want to modify them as well you can change permissions like chmod -R a+rw folder_name which would allow you on the host to modify those files directly.

dannylamb commented 4 years ago

I bumped into that head on when I recently set up a new laptop. Things don't work right if you're not part of the docker group. One of many gotchas. We may want to link out to the postinstall docs from the README.

jmvezic commented 4 years ago

Tried doing the same thing on DigitalOcean and now it didn't work. Neither did adding the user to docker group. I always get 404 page not found. It's really baffling and seems random. Order of actions on a fresh Ubuntu 20 droplet:

noahwsmith commented 4 years ago

if you run groups you can see if adding your user to the "docker" group has worked. You have to do a full logout/login to get that to stick.

One other thought @nigelgbanks , I wonder if we need to add a non-root user to all the docker-compose exec drupal commands so they run as the "islandora" user, or whatever the default nginx user is? I've added -u islandora to those sort of commands before, when we needed the on-container process to be run by a specific user. Or does the with-contenv bit cover that?

nigelgbanks commented 4 years ago

@noahwsmith by default they will run as the root user. There is an exception in that drush has a wrapper script here which forces it to run as the nginx user. composer doesn't force the user but also has a wrapper script here it could be made to run as nginx as well.

noahwsmith commented 4 years ago

Well, we don't want the web directory owned by root, but maybe we're cleaning that up elsewhere?

jmvezic commented 4 years ago

@noahwsmith I did do a full logout/login, forgot to mention that in the list of steps, right after adding the user to docker group (after installing docker).

jmvezic commented 4 years ago

And now I tried the exact same procedure as described and it's working. I'll try to see what exactly is the problem over the weekend - is it possible that it's some sort of a timing issue on a faster system? Maybe docker finishes up some components before running others?

dannylamb commented 4 years ago

You ever figure out what was up @jmvezic ?

jmvezic commented 4 years ago

I haven't been able to reproduce it again, so it seems I do finally have a workflow that definitely works (I hope so):

DanRoller commented 3 years ago

I also got a 404 last night, but I don't know what to make of the above discussion and the documentation for DRUPAL_SITE_HOST=traefik.me in .env and IP address in docker-compose.demo.yml

My home world has Windows 10 with IP address of 192.168.1.200 and the VirtualBox/Ubuntu for which I'm trying to do ISLE using https://github.com/Islandora-Devops/isle-dc has IP address 10.0.2.15.

What is your suggestion on how to configure .env and docker-compose.demo.yml?

And then having done that, what is the URL to reach Drupal /Islandora from Ubuntu?

Or is it just broken?

Thanks

dannylamb commented 3 years ago

Sorry to hear you're having such a tough time with it @DanRoller. It is functional, but still farily new, especially Windows support. The community is currently sprinting on ISLE, and hope to improve both isle-dc and its documentation within the next two weeks. If we could resolve whatever you're running into during that process, it would be great.

The traefik.me deal is to get around having to play with your hosts file. It gives you a domain but resolves to 127.0.0.1 and comes with certs for https. Part of our sprint is to simplify the urls (the subdomains are a bit crazy), but for now, http://islandora-isle-dc.traefik.me will bring you to Drupal and your Islandora instance.

If you can manage to get it running using wsl2 on windows, that URL should work out of the box. Since you're using an ubuntu vm, you'll need add an entry for islandora-isle-dc.traefik.me in your hosts file and point it at your vm. There's a more arcane way to point traefik.me at an IP detailed in the README, but it can be a bit error prone. Usually it's easier to just edit your hosts file.

BTW, any feedback you could provide on the current instructions for windows would be greatly appreciated: https://islandora.github.io/documentation/installation/docker-compose/

DanRoller commented 3 years ago

I have been following lots of paths and getting stopped at each. I disabled WSL and when to VirtualBox/Ubuntu when ISLE was version 7 and it used port 80. Port 80 mucked with my family/development ISS that also demanded port 80. I spent more time starting and stopping various environments that looking at Islandora.

I'd go back to the WSL world (trashing VirtualBox/Ubuntu that is an incompatible VM) if I thought that the traefik.me deal, didn't demand port 80. Can you confirm that? Otherwise I have to just hang out with the Islandora videos for a few more weeks.

Thanks.

DanRoller commented 3 years ago

Restarted, went biking, used suggestion http://islandora-isle-dc.traefik.me and I'm in with admin/password

I'm confused but I getting use to it! Thanks

dannylamb commented 3 years ago

@DanRoller Glad to hear you got it working. If you've got it working I wouldn't touch it, but just FYI when you're running make, part of what it's doing is generating a docker-compose.yml file. At any point in time, if you wanna play with things like changing ports, you can edit that file. And if you mess things up, you can just regenerate it with make docker-compose.yml to get back to a working state.