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

setup varnish #13

Open
diraol opened this issue Dec 11, 2016 · 6 comments
Open

setup varnish #13

diraol opened this issue Dec 11, 2016 · 6 comments

Comments

@diraol
Copy link
Member

diraol commented Dec 11, 2016

Setup varnish.

It should listen for requests on the port 6081, and only for localhost requests.

If the cache miss, then varnish should redirect it to 127.0.0.1:8080 (nginx will be listening on this port to redirect to HHVM).

@leonardofl
Copy link
Contributor

leonardofl commented Dec 31, 2016

Mostly done in 8f6fdeb.
One left concern: Varnish is listening 0.0.0.0 rather than localhost.
I tried to edit the /etc/default/varnish to change this, but according to netstat it did not work.

My attempt:
In /etc/default/varnish:

DAEMON_OPTS="-a localhost:6081 \
         -T localhost:6082 \
         -f /etc/varnish/default.vcl \
         -S /etc/varnish/secret \
         -s malloc,256m"

After the edition:

$sudo systemctl restart varnish
$ netstat -ntpl
tcp        0      0 0.0.0.0:6081            0.0.0.0:*               LISTEN      -

0.0.0.0 should be localhost or 127.0.0.1.

@leonardofl
Copy link
Contributor

Obs: moreover, after editing the file, Varnish remains accessible from the host.

@diraol
Copy link
Member Author

diraol commented Jan 11, 2017

Here is a reference that seems to present a solution to the problem you described @leonardofl . http://www.writeyourcode.com/install-configure-varnish-apache-ubuntu-16-04/

Can you take a look at this? I'll keep going with the deploy for now. =)

@diraol
Copy link
Member Author

diraol commented Jan 11, 2017

@leonardofl
Copy link
Contributor

The first link did the trick! Tks!

But there is one more issue.
You had setup the /etc/varnish/default.vcl file, but since varnish was not restarted, it was not using this file.
My change implied in restarting Varnish, but Varnish was not starting because

Jan 12 21:18:25 default-ubuntu-1604 varnishd[17566]: Error: Cannot read -f file (/etc/varnish/default.vcl): Permission denied

So because this error I commented on the recipe the lines

link "/etc/varnish/default.vcl" do
  to "#{confs_base_folder}/etc.varnish.default.vcl"
end

It seems the owner or permissions of this file or link need some adjustment.

@leonardofl
Copy link
Contributor

leonardofl commented Jan 12, 2017

PS: I tried

template "#{confs_base_folder}/etc.varnish.default.vcl" do
  mode '666'
  # owner root
  source 'etc.varnish.default.vcl.erb'
end

but it did not work =/

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

No branches or pull requests

2 participants