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

Unable to use docker container #19

Closed
jmezzera opened this issue Jul 30, 2019 · 9 comments
Closed

Unable to use docker container #19

jmezzera opened this issue Jul 30, 2019 · 9 comments

Comments

@jmezzera
Copy link

Hi,

I'm trying to deploy authzforce-ce-server as a container using docker (Docker version 19.03.1, build 74b1e89) on a CentOS 7 machine and the problem I'm currently having is that whenever I start the container, tomcat GUI appears on the browser. Its seems like it did not download any of the authzorce sourcecode.

This happened while using Docker Hubs image (release-8.1.0) and using an image I builded myself using the Dockerfile available on this repo.

Any help would be appreciated.

@hargathor
Copy link
Member

hargathor commented Aug 1, 2019

Hello,
First of all thanks for using Authzforce.

After setting up the docker image. Did you try the domain creation request available on the documention here : domain creation

Then please proceed to the end to end testing

Paste hear the result of these requests

@jmezzera
Copy link
Author

jmezzera commented Aug 1, 2019

Hi @hargathor. Thank you very much for your response and time.

I tried both requests you ask for; and, in both cases, I get Tomcats 404 response

<!doctype html>
<html lang="en">

<head>
	<title>HTTP Status 404 – Not Found</title>
	<style type="text/css">
		h1 {
			font-family: Tahoma, Arial, sans-serif;
			color: white;
			background-color: #525D76;
			font-size: 22px;
		}

		h2 {
			font-family: Tahoma, Arial, sans-serif;
			color: white;
			background-color: #525D76;
			font-size: 16px;
		}

		h3 {
			font-family: Tahoma, Arial, sans-serif;
			color: white;
			background-color: #525D76;
			font-size: 14px;
		}

		body {
			font-family: Tahoma, Arial, sans-serif;
			color: black;
			background-color: white;
		}

		b {
			font-family: Tahoma, Arial, sans-serif;
			color: white;
			background-color: #525D76;
		}

		p {
			font-family: Tahoma, Arial, sans-serif;
			background: white;
			color: black;
			font-size: 12px;
		}

		a {
			color: black;
		}

		a.name {
			color: black;
		}

		.line {
			height: 1px;
			background-color: #525D76;
			border: none;
		}
	</style>
</head>

<body>
	<h1>HTTP Status 404 – Not Found</h1>
	<hr class="line" />
	<p><b>Type</b> Status Report</p>
	<p><b>Message</b> &#47;authzforce-ce&#47;domains</p>
	<p><b>Description</b> The origin server did not find a current representation for the target resource or is not
		willing to disclose that one exists.</p>
	<hr class="line" />
	<h3>Apache Tomcat/8.5.35</h3>
</body>

</html>

This makes me think that there is no authzforce service running, only tomcat. Do you have any idea on why this might be?

Deploying a Docker container base on the official image should be enough for running the service, right? Or is there any step I missed?

Thanks again for your help

@hargathor
Copy link
Member

Can you describe me the steps that you took to launch the container ? Do you try to deploy also a custom component or plugin in authzforce or is it the container "as is" from docker hub ?
Maybe try this way:

~ >>> docker run -d -p "8080:8080" fiware/authzforce-ce-server:release-8.1.0                                                                                                                                                                                               
~ >>> curl --verbose --show-error --write-out '\n' --request GET http://127.0.0.1:32769/authzforce-ce/domains
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying 127.0.0.1:8080...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /authzforce-ce/domains HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.65.3
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 
< Date: Thu, 01 Aug 2019 17:10:18 GMT
< Content-Type: application/xml
< Content-Length: 369
< 
* Connection #0 to host 127.0.0.1 left intact
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><resources xmlns="http://authzforce.github.io/rest-api-model/xmlns/authz/5" xmlns:ns2="http://www.w3.org/2005/Atom" xmlns:ns3="http://authzforce.github.io/core/xmlns/pdp/6.0" xmlns:ns4="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:ns5="http://authzforce.github.io/pap-dao-flat-file/xmlns/properties/3.6"/>

@jmezzera
Copy link
Author

jmezzera commented Aug 1, 2019

So,
I think I got it working. I was deploying the container with docker compose and mounting an external data volume. Maybe this was the reason it didn´t work.

I'm leaving the office now, tomorrow I'll give it a better try and, provided it works as expected, I'll close this issue

Thank you very much

@hargathor
Copy link
Member

Yes maybe the mounted volume were erasing the authzforce code which is located in /opt

@jmezzera
Copy link
Author

jmezzera commented Aug 5, 2019

The question that remains, however, is how can I get persistency in the container if mounting the volume makes the application crash.
I need to be able to restore all the configuration of the PDP if the container were to crash.

Any advice on this matter?

@hargathor
Copy link
Member

Ok I understand what you want to do. You have two options:

You want to start fresh:
You need to copy or create locally the directory architecture located in the container in /opt/authzforce-ce-server/data
Then you will be able to bind this directory within the docker container

You have existing configuration in the docker that you want to backup and then use in another container

mkdir data
docker cp <the_name_of_your_container>:/opt/authzforce-ce-server/data ./data

Then you can bind data in your container

I hope i answered your question!

@cdanger
Copy link
Member

cdanger commented Aug 9, 2019

yes indeed, after the docker cp, if you mount back the exported ./data as a volume bound to the same folder /opt/authzforce-ce-server/data, it should overwrite the previously existing content in the container. To be tested ;-)

@cdanger
Copy link
Member

cdanger commented Oct 4, 2019

Alright nil novi sub sole... closing.

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

No branches or pull requests

3 participants