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

Reworking-varnish-role #2354

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open

Reworking-varnish-role #2354

wants to merge 1 commit into from

Conversation

drazenCE
Copy link
Contributor

@drazenCE drazenCE commented Mar 6, 2025

No description provided.

Copy link

sonarqubecloud bot commented Mar 6, 2025

Copy link
Contributor

@nfawbert nfawbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does default memlock size need to be so big (85983232)?

Copy link
Contributor

@klausi klausi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, left some comments.

I wonder why we have to do this systemd file override. Is there a fix we could do in the upstream varnish role https://github.com/geerlingguy/ansible-role-varnish ?

Please document why we need our own systemd service and why the default setup is broken with unattended upgrades.

- name: Template varnish systemd service file
ansible.builtin.template:
src: varnish.service.j2
dest: /etc/systemd/system/varnish.service
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is also a systemd file in /lib/systemd/system/varnish.service , probably installed by the varnish package. Do we need to take care of that?

notify:
- reload systemd # handlers in https://github.com/geerlingguy/ansible-role-varnish/blob/master/handlers/main.yml
- restart varnish
- block:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why we need this block? please add a code comment.

- reload systemd # handlers in https://github.com/geerlingguy/ansible-role-varnish/blob/master/handlers/main.yml
- restart varnish
- block:
- name: Copy Varnish default VCL.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation should be 2 spaces, or is there a reason here are 4?

limit_memlock: 85983232
limit_core: infinity
tasks_max: infinity
varnish_storage: "malloc,{{ ansible_facts.memtotal_mb // 10 }}M"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should not duplicate this variable under varnish_config. It already exists as global varnish_storage from the varnish role?

@@ -17,3 +17,10 @@ varnish_config:
upstream_proxies: []
# Provide an alternative filename if you are providing a template.
template_filename: default.vcl
# Varnish systemd overrides to make varnish consistent even after upgrades
varnish_pid: /run/varnishd.pid
limit_nofile: 131072
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this also already exists as varnish_limit_nofile

@drazenCE
Copy link
Contributor Author

thanks, left some comments.

I wonder why we have to do this systemd file override. Is there a fix we could do in the upstream varnish role https://github.com/geerlingguy/ansible-role-varnish ?

Please document why we need our own systemd service and why the default setup is broken with unattended upgrades.

geerlinguy also uses systemd overrides:
https://github.com/geerlingguy/ansible-role-varnish/blob/e212840c92c4a2bdc5378b63326f9772dd386e70/tasks/main.yml#L15

We can either use the overrides setup I created, or use geerlinguy variables for system overrides

@klausi
Copy link
Contributor

klausi commented Mar 11, 2025

OK, since this vanrish_config role depends on the geerlingguy varnish role we should use the upstream variables to avoid duplication and confusion.

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

Successfully merging this pull request may close these issues.

4 participants