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

Varnish config, pemission denied. #777

Open
KDederichs opened this Issue Jul 24, 2018 · 12 comments

Comments

Projects
None yet
6 participants
@KDederichs
Copy link

KDederichs commented Jul 24, 2018

Hey, I downloaded version 2.3 of your api platform but each time I try to run it with docker I can't access the client or the admin.

The logs show cache-proxy_1 | Error: Cannot read -f file '/usr/local/etc/varnish/default.vcl' (Permission denied) cache-proxy_1 | (-? gives usage) for the varnish proxy and the h2 doesn't start cause the varnish doesn't start.

Here is the full log:

cache-proxy_1  | Error: Cannot read -f file '/usr/local/etc/varnish/default.vcl' (Permission denied)
cache-proxy_1  | (-? gives usage)
api_1          | 2018/07/24 12:28:28 [error] 9#9: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.20.0.1, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://172.20.0.5:9000", host: "localhost:8080"
api_1          | 172.20.0.1 - - [24/Jul/2018:12:28:28 +0000] "GET / HTTP/1.1" 404 27 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0" "-"
h2-proxy_1     | 2018/07/24 12:28:18 [emerg] 1#1: host not found in upstream "cache-proxy" in /etc/nginx/conf.d/default.conf:54
h2-proxy_1     | nginx: [emerg] host not found in upstream "cache-proxy" in /etc/nginx/conf.d/default.conf:54
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          | 
php_1          | Waiting for Postgres to be ready...
php_1          | db:5432 - accepting connections
php_1          | 
php_1          |  [OK] Nothing to update - your database is already in sync with the current     
php_1          |       entity metadata.                                                          
php_1          | 
php_1          | [24-Jul-2018 12:28:17] NOTICE: fpm is running, pid 1
php_1          | [24-Jul-2018 12:28:17] NOTICE: ready to handle connections
php_1          | 172.20.0.6 -  24/Jul/2018:12:28:28 +0000 "GET /index.php" 404
api_backend_docker_h2-proxy_1 exited with code 1
api_backend_docker_cache-proxy_1 exited with code 2
db_1           | LOG:  database system was shut down at 2018-07-24 12:17:57 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
admin_1        | yarn run v1.5.1
admin_1        | $ react-scripts start
admin_1        | Starting the development server...
admin_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.20.0.4: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        | 
client_1       | yarn run v1.5.1
client_1       | $ react-scripts start
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.20.0.3: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       | 

It's a fresh install of version 2.3 on Ubuntu 18.04 with Docker version 18.06.0-ce, build 0ffa825

@teohhanhui

This comment has been minimized.

Copy link
Member

teohhanhui commented Jul 24, 2018

Can you try to do:

docker-compose build
docker-compose up -d

and let us know whether that resolves the problem?

@KDederichs

This comment has been minimized.

Copy link
Author

KDederichs commented Jul 24, 2018

Stayed the same, it's still giving me

cache-proxy_1  | Error: Cannot read -f file '/usr/local/etc/varnish/default.vcl' (Permission denied)
cache-proxy_1  | (-? gives usage)
cache-proxy_1  | Error: Cannot read -f file '/usr/local/etc/varnish/default.vcl' (Permission denied)
cache-proxy_1  | (-? gives usage)
cache-proxy_1  | Error: Cannot read -f file '/usr/local/etc/varnish/default.vcl' (Permission denied)
cache-proxy_1  | (-? gives usage)
api_backend_docker_cache-proxy_1 exited with code 2

@KDederichs

This comment has been minimized.

Copy link
Author

KDederichs commented Jul 24, 2018

I added

RUN mkdir -p /usr/local/etc/varnish

before the copy directive and now it's working, not sure if that's what did it though or if something different happened cause it's been up for a while....

@teohhanhui

This comment has been minimized.

Copy link
Member

teohhanhui commented Jul 24, 2018

RUN mkdir -p /usr/local/etc/varnish

No, that's not it. But I think it's due to the lack of versioning of our pre-built Docker images.

@afuetterer

This comment has been minimized.

Copy link

afuetterer commented Aug 11, 2018

Hi, I get the same error when running api-platform 2.3.0 on Ubuntu 18.04.

$ docker-compose ps
             Name                           Command               State            Ports         
-------------------------------------------------------------------------------------------------
api-platform-230_admin_1         /bin/sh -c yarn start            Up       0.0.0.0:81->3000/tcp  
api-platform-230_api_1           nginx -g daemon off;             Up       0.0.0.0:8080->80/tcp  
api-platform-230_cache-proxy_1   docker-varnish-entrypoint  ...   Exit 2                         
api-platform-230_client_1        /bin/sh -c yarn start            Up       0.0.0.0:80->3000/tcp  
api-platform-230_db_1            docker-entrypoint.sh postgres    Up       0.0.0.0:5432->5432/tcp
api-platform-230_h2-proxy_1      nginx -g daemon off;             Exit 1                         
api-platform-230_php_1           docker-entrypoint php-fpm        Up       9000/tcp   

$ docker-compose logs -f cache-proxy
Attaching to api-platform-230_cache-proxy_1
cache-proxy_1  | Error: Cannot read -f file '/usr/local/etc/varnish/default.vcl' (Permission denied)
cache-proxy_1  | (-? gives usage)
api-platform-230_cache-proxy_1 exited with code 2

$ docker-compose logs -f h2-proxy
Attaching to api-platform-230_h2-proxy_1
h2-proxy_1     | 2018/08/11 16:23:12 [emerg] 1#1: host not found in upstream "cache-proxy" in /etc/nginx/conf.d/default.conf:54
h2-proxy_1     | nginx: [emerg] host not found in upstream "cache-proxy" in /etc/nginx/conf.d/default.conf:54
api-platform-230_h2-proxy_1 exited with code 1

@KDederichs How did you fix it exactly?

@teohhanhui teohhanhui added the question label Aug 13, 2018

@afuetterer

This comment has been minimized.

Copy link

afuetterer commented Aug 13, 2018

Hi, I think it was related to file permissions in the zipped archive. After cloning the repository it works.

@teohhanhui

This comment has been minimized.

Copy link
Member

teohhanhui commented Aug 13, 2018

@dunglas Yet another case of issue with the zip archive. We really should warn against using it.

@Robilol

This comment has been minimized.

Copy link

Robilol commented Feb 11, 2019

thanks @afuetterer

problem still persist with the zip file

@javaDeveloperKid

This comment has been minimized.

Copy link

javaDeveloperKid commented Feb 23, 2019

Same here. Had to clone repo instead of downloading zip file.

@MelvinLoos

This comment has been minimized.

Copy link

MelvinLoos commented Mar 6, 2019

Err "warn"? Isn't it pretty much the recommended approach when following the Getting Started or did I misunderstood the docs? Anyway cloning has my preference too but the docs kind of send me the other direction.

@teohhanhui

This comment has been minimized.

Copy link
Member

teohhanhui commented Mar 8, 2019

We should update the docs to say download the .tar.gz. Unfortunately, .zip files are really hit or miss when it comes to file permissions (seems like it might depend on the archiver program you use).

@MelvinLoos

This comment has been minimized.

Copy link

MelvinLoos commented Mar 8, 2019

Oh I didn't know that tar does preserve file permissions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.