International-Data-Spaces-Association / omejdn-daps

Open Source implementation of the Dynamic Attribute Provisioning Service based on http://github.com/Fraunhofer-AISEC/omejdn-server
Apache License 2.0
5 stars 10 forks source link

No servings in docker #27

Closed FlorianWege-IESE closed 1 year ago

FlorianWege-IESE commented 2 years ago

The Problem

My Setup

Microsoft Windows 10 Enterprise Version 10.0.19044 Build 19044 ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt] Docker version 20.10.7, build f0df350 OpenSSL 1.1.1e 17 Mar 2020

What I have done up front

Cloned the repository. Executed git submodule update --init --remote. Executed docker-compose up

What I expected to happen

http://localhost:80 serves the UI. http://localhost:80/auth does not respond with 404. http://localhost:80/.well-known/oauth-authorization-server/auth does not respond with 404. http://localhost:80/auth/token does not respond with 404. http://localhost:80/auth/jwks.json does not respond with 404.

What actually happened

http://localhost:80 showed the default nginx page:

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com.

Thank you for using nginx.

The other urls were respond to with 404 and the default nginx error page.

logs:

WARNING: The PWD variable is not set. Defaulting to a blank string. Recreating daps_nginx_1 ... done Recreating daps_omejdn-ui_1 ... done Recreating daps_omejdn-server_1 ... done Attaching to daps_omejdn-ui_1, daps_nginx_1, daps_omejdn-server_1 nginx_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration nginx_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh nginx_1 | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf nginx_1 | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh omejdn-ui_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration omejdn-ui_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ omejdn-ui_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh omejdn-server_1 | Starting Omejdn version 1.7.0 omejdn-server_1 | ========================================= omejdn-ui_1 | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf omejdn-ui_1 | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf omejdn-ui_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh nginx_1 | /docker-entrypoint.sh: Configuration complete; ready for start up omejdn-ui_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh omejdn-ui_1 | /docker-entrypoint.sh: Configuration complete; ready for start up nginx_1 | 2022/09/12 17:10:51 [notice] 1#1: using the "epoll" event method nginx_1 | 2022/09/12 17:10:51 [notice] 1#1: nginx/1.23.1 nginx_1 | 2022/09/12 17:10:51 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) nginx_1 | 2022/09/12 17:10:51 [notice] 1#1: OS: Linux 5.10.102.1-microsoft-standard-WSL2 nginx_1 | 2022/09/12 17:10:51 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 nginx_1 | 2022/09/12 17:10:51 [notice] 1#1: start worker processes nginx_1 | 2022/09/12 17:10:51 [notice] 1#1: start worker process 33 nginx_1 | 2022/09/12 17:10:51 [notice] 1#1: start worker process 34 nginx_1 | 2022/09/12 17:10:51 [notice] 1#1: start worker process 35 nginx_1 | 2022/09/12 17:10:51 [notice] 1#1: start worker process 36 omejdn-server_1 | 2022-09-12 17:10:52 +0000 Thin web server (v1.8.1 codename Infinite Smoothie) omejdn-server_1 | 2022-09-12 17:10:52 +0000 Maximum connections set to 1024 omejdn-server_1 | 2022-09-12 17:10:52 +0000 Listening on 0.0.0.0:4567, CTRL+C to stop

The quest of trying to solve it

What were the results of searching for the error on the internet?

I have not found anything on it. I have browsed through the issues of this repository.

What is your best guess as to what might have happened?

No idea. After it did not work with the default configuration, I have gone through the config files a bit but there seemed to be no additional base path set or anything contradictory. The logs do not look erroneous but also do not say that something would be served on port 80. I have also tried the steps in https://github.com/eclipse-dataspaceconnector/DataSpaceConnector/tree/main/launchers/ids-connector#setting-up-a-local-daps-instance with the same result. But there it says that there should be a log line omejdn-server_1 | == Sinatra (v2.1.0) has taken the stage on 4567 for development with backup from Thin, which does not appear, but it does not seem to be up to date as the docker-compose file is named differently, too.

bellebaum commented 1 year ago

Hey :) Here's what I think is happening: Your system does not seem to maintain the PWD environment variable, as stated by the logs:

WARNING: The PWD variable is not set. Defaulting to a blank string.

This means that docker cannot correctly mount any volumes using this variable (see compose.yml). So when NginX tries to convert the templates for its configuration, it does not find any templates and continues to use the default configuration.

Unfortunately I am not very experienced at working with Windows, but fixing this should involve setting the environment variable to your current folder or inserting it in compose.yml directly (whereever you see ${PWD}).

spetrac commented 1 year ago

I stumbled upon the same problem and this issue helped my to find a solution.

As explained here https://stackoverflow.com/a/41948354, there is no need to use PWD at all. (You can find information on relative files in docker compose here: https://docs.docker.com.xy2401.com/compose/compose-file/compose-file-v1/)

All I had to do is replace the PWD with a . and everything worked. Defining the variable PWD at the top of the .env file worked as well:

PWD="."
COMPOSE_PROJECT_NAME="daps"
...

I think it would be helpful to change it in the projects .env file as well to help others avoid this problem.

FlorianWege-IESE commented 1 year ago

Yes, that's what it was. Now it works, thanks.

Wouldn't $PWD as the current working directory also be inaccurate here? The file paths in the compose.yml are seemingly relative to the compose.yml. You could start docker-compose from another directory with the -f parameter. Another reply in that Stack Overflow thread talks about the difference of the PWD variable vs .: https://stackoverflow.com/questions/41948232/docker-compose-wont-find-pwd-environment-variable/41948354#comment113879072_41948354

bellebaum commented 1 year ago

@FlorianWege-IESE Yes, you are right. I originally did it that way because my docker compose installation was not accepting the dot for some reason. I think it is time to change that again