libero / publisher

The starting point for raising issues for Libero Publisher
MIT License
16 stars 4 forks source link

Deploy dummy-api to unstable environment #23

Closed giorgiosironi closed 5 years ago

giorgiosironi commented 6 years ago

Problem / Motivation

- WHO wants this? Developers and product managers - WHEN and WHERE do they want it? Available on a public URL accessible from any browser - WHAT do they want? Some content added to the unstable environment - WHY do they want this? To demonstrate and test features from the current milestone on many content samples ## Proposed solution Deploy a [`dummy-api`](https://github.com/libero/dummy-api) to the `unstable` environment to allow usage of test data from the corresponding `browser`. ## Tasks

Clarification needed and assumptions

Technical notes

See https://github.com/libero/libero/issues/22

User interface / Wireframes

Possible public URL: https://dummy-api.unstable.libero.pub

giorgiosironi commented 6 years ago

Renamed to reflect that we are deploying dummy-api.

thewilkybarkid commented 5 years ago

@stephenwf Would be interested to know if you have any suggestions for the container config (eg FPM optimisation). Not a blocker for this though.

giorgiosironi commented 5 years ago

Compiled a strange form (to try to free the libero namespace) at https://success.docker.com/support that is full of errors because we don't have paid support, but it seems to have successfully submitted.

giorgiosironi commented 5 years ago

Thank you for contacting Docker Support! Your request 00062637 has been submitted and a Support Engineer will be contacting you during business hours (Monday-Friday, 9:00am - 6:00pm local time).

giorgiosironi commented 5 years ago

https://github.com/libero/sample-configuration/pull/4 tries to put everything (nginx, php-fpm, multiple services) together.

giorgiosironi commented 5 years ago

Main part is done, cleanup remains:

$ curl -v http://unstable--dummy-api.libero.pub/ping
*   Trying 34.238.193.238...
* Connected to unstable--dummy-api.libero.pub (34.238.193.238) port 80 (#0)
> GET /ping HTTP/1.1
> Host: unstable--dummy-api.libero.pub
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.15.2
< Content-Type: text/plain; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Cache-Control: must-revalidate, no-store, private
< Date: Fri, 16 Nov 2018 15:48:36 GMT
< 
pong
giorgiosironi commented 5 years ago

Smoke tests unstable in https://travis-ci.com/libero/environments/builds/91686972 It's a case of waiting for the nginx port to be opened and for the fpm containers to start. We may get away with some exec commands for now, but we'll need to get to containers declaring their health state so that smoke tests (and orchestrators, monitoring, etc) can target that status, agnostically.

giorgiosironi commented 5 years ago

After trying to use timeout docker-compose with the nc inside the fpm containers and failing at it, I'd like to delegate all this looping to HEALTHCHECK.

giorgiosironi commented 5 years ago

https://github.com/libero/dummy-api/pull/11 as the next logical step, all while trying to limit duplication across repositories.

giorgiosironi commented 5 years ago

https://github.com/libero/sample-configuration/pull/6 for the shared "pod" volume setup.

giorgiosironi commented 5 years ago

A bit unrelated but spawned from this:

giorgiosironi commented 5 years ago

http://unstable.libero.pub/favicon.ico does work now, but an actual page is not there yet.

giorgiosironi commented 5 years ago

https://github.com/libero/environments/pull/12 is the latest in trying to fix the pipelines before we add data.

giorgiosironi commented 5 years ago

https://github.com/libero/sample-configuration/pull/10 will add some data.

stephenwf commented 5 years ago

@thewilkybarkid @giorgiosironi For the HEALTHCHECK in fpm, you could configure the built-in /ping endpoint, it should get you a healthy status quicker than hitting the root, which would be blocked by the PHP application itself (not blocking nginx connecting).

giorgiosironi commented 5 years ago

Interesting, the spectrum between checking more dependencies and sticking to the container is still unclear. A typical application-based /ping would load the bootstrap and provide some validation that the container volumes, environment variables, etc are configured correctly. Sometimes a database connection is opened depending on how lazy the process is. But we do not usually go all the way to check dependencies like other services in an healthcheck, so that is the limit on the other side.

giorgiosironi commented 5 years ago

https://travis-ci.com/libero/environments/builds/92517437 deployed the dummy data, but http://unstable.libero.pub/articles/42 is a 500 (edit: rather than a 404?), taking a look.

giorgiosironi commented 5 years ago
browser_fpm_1    | [26-Nov-2018 10:03:55] WARNING: [pool www] child 7 said into stderr: "[2018-11-26 10:03:55] request.INFO: Matched route "libero.content.scholarly_article.item". {"route":"libero.content.scholarly_article.item","route_parameters":{"_route":"libero.content.scholarly_article.item","_controller":"libero.content_page.controller.content.scholarly_article","id":"42"},"request_uri":"http://unstable.libero.pub/articles/42","method":"GET"} []"
browser_fpm_1    | [26-Nov-2018 10:03:55] WARNING: [pool www] child 7 said into stderr: "[2018-11-26 10:03:55] request.CRITICAL: Uncaught PHP Exception GuzzleHttp\Exception\ClientException: "Client error: `GET http://web:1080/scholarly-articles/items/42/versions/latest` resulted in a `404 Not Found` response: <?xml version="1.0" encoding="UTF-8"?> <problem xmlns="urn:ietf:rfc:7807" xml:lang="en"><status>404</status><title>Item  (truncated...) " at /app/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php line 113 {"exception":"[object] (GuzzleHttp\\Exception\\ClientException(code: 404): Client error: `GET http://web:1080/scholarly-articles/items/42/versions/latest` resulted in a `404 Not Found` response:\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<problem xmlns=\"urn:ietf:rfc:7807\" xml:lang=\"en\"><status>404</status><title>Item  (truncated...)\n at /app/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113)"} []"
browser_fpm_1    | 172.30.0.4 -  26/Nov/2018:10:03:55 +0000 "GET /index.php" 500
thewilkybarkid commented 5 years ago

There’s no error handling yet, but that’s right. Correct ID is working.

giorgiosironi commented 5 years ago

http://unstable.libero.pub/articles/article1 is the right one.

giorgiosironi commented 5 years ago

Also http://unstable.libero.pub/blog/post1