1

I have docker on Digital Ocean, and still trying to figure out how to work with api-platform. So I docker-compose up in api-platform-2.3.0 default page on port 80 loads up normally, but when I went to 8080, It shows bad gateway. So I looked up if everything loads properly, and it seems that there's problem with PHP.

CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS                        PORTS                                                                    NAMES
0a0c4724d2d5        api_h2-proxy                   "nginx -g 'daemon of…"   18 minutes ago      Up 18 minutes                 0.0.0.0:443-444->443-444/tcp, 80/tcp, 0.0.0.0:8443-8444->8443-8444/tcp   api_h2-proxy_1
9958631ba1b8        quay.io/api-platform/varnish   "docker-varnish-entr…"   18 minutes ago      Up 18 minutes                 0.0.0.0:8081->80/tcp                                                     api_cache-proxy_1
68de4a5058dd        quay.io/api-platform/nginx     "nginx -g 'daemon of…"   18 minutes ago      Up 18 minutes                 0.0.0.0:8080->80/tcp                                                     api_api_1
f805ffdd804d        quay.io/api-platform/php       "docker-entrypoint p…"   18 minutes ago      Exited (126) 18 minutes ago                                                                            api_php_1
b020f888b81d        postgres:9.6-alpine            "docker-entrypoint.s…"   19 minutes ago      Up 19 minutes                 0.0.0.0:5432->5432/tcp                                                   api_db_1
1f86200d43bd        quay.io/api-platform/admin     "/bin/sh -c 'yarn st…"   19 minutes ago      Up 18 minutes                 0.0.0.0:81->3000/tcp                                                     api_admin_1
6986bf74b501        quay.io/api-platform/client    "/bin/sh -c 'yarn st…"   19 minutes ago      Up 18 minutes                 0.0.0.0:80->3000/tcp                                                     api_client_1

And docker-compose up without -d flag

root@restApi:/usr/api# docker-compose up
Creating api_admin_1       ... done
Creating api_php_1         ... done
Creating api_client_1      ... done
Creating api_api_1         ... done
Creating api_php_1         ...
Creating api_cache-proxy_1 ... done
Creating api_cache-proxy_1 ...
Creating api_h2-proxy_1    ... done
Attaching to api_db_1, api_php_1, api_api_1, api_cache-proxy_1, api_admin_1, api                                                                                  _client_1, api_h2-proxy_1
db_1           | LOG:  database system was shut down at 2018-07-12 04:32:08 UTC
db_1           | LOG:  MultiXact member wraparound protections are now enabled
db_1           | LOG:  database system is ready to accept connections
db_1           | LOG:  autovacuum launcher started
php_1          | Loading composer repositories with package information
php_1          | Installing dependencies (including require-dev) from lock file
php_1          | Nothing to install or update
php_1          | Generating autoload files
php_1          | Executing script cache:clear [OK]
php_1          | Executing script assets:install [OK]
php_1          | Waiting for Postgres to be ready...
php_1          |
php_1          | /usr/local/bin/docker-entrypoint: line 22: bin/console: Permiss                                                                                   ion denied
php_1          | db:5432 - accepting connections
api_php_1 exited with code 126
cache-proxy_1  | Debug: Platform: Linux,4.4.0-130-generic,x86_64,-junix,-smalloc                                                                                   ,-sdefault,-hcritbit
cache-proxy_1  | Debug: Child (18) Started
cache-proxy_1  | Info: Child (18) said Child starts
admin_1        | yarn run v1.5.1
admin_1        | $ react-scripts start
client_1       | yarn run v1.5.1
client_1       | $ react-scripts start
admin_1        | Starting the development server...
admin_1        |
client_1       | Starting the development server...
client_1       |
client_1       | Compiled successfully!
client_1       |
client_1       | You can now view client in the browser.
client_1       |
client_1       |   Local:            http://localhost:3000/
client_1       |   On Your Network:  http://172.18.0.6:3000/
client_1       |
client_1       | Note that the development build is not optimized.
client_1       | To create a production build, use yarn build.
client_1       |
admin_1        | Compiled successfully!
admin_1        |
admin_1        | You can now view admin in the browser.
admin_1        |
admin_1        |   Local:            http://localhost:3000/
admin_1        |   On Your Network:  http://172.18.0.3:3000/
admin_1        |
admin_1        | Note that the development build is not optimized.
admin_1        | To create a production build, use yarn build.
admin_1        |
api_1          | 2018/07/12 04:35:13 [error] 5#5: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 80.9                         5.103.67, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://172.18.0.3:9000", host: "restapi.my:8080"
api_1          | 80.95.103.67 - - [12/Jul/2018:04:35:13 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) App                         leWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36" "-"
api_1          | 80.95.103.67 - - [12/Jul/2018:04:35:13 +0000] "GET /favicon.ico HTTP/1.1" 200 32038 "http://restapi.my:8080/" "Mozilla/5.                         0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36" "-"
api_1          | 2018/07/12 04:35:21 [error] 5#5: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 80.9                         5.103.67, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://172.18.0.3:9000", host: "restapi.my:8080"
api_1          | 80.95.103.67 - - [12/Jul/2018:04:35:21 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) App                         leWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36" "-"
api_1          | 2018/07/12 04:36:01 [error] 5#5: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 80.9                         5.103.67, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://172.18.0.3:9000", host: "restapi.my:8080"
api_1          | 80.95.103.67 - - [12/Jul/2018:04:36:01 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) App                         leWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36" "-"

As you can see, the php shows error 126, which I guess is not normal, I have composer and php v. 7.0.3

Thanks for any help.

p.s. I am aware of similar question on gateway 503 but mine is with clean Api-Platform and building up doesnt help.

4

1 回答 1

4

Problem was that api/bin/console was not executable as @Kévin Dunglas mentioned. Solution was easy, just chmod 755 console. And thats it.

于 2018-07-16T22:11:40.460 回答