This repository has been archived by the owner on May 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Paas 1164 fix onAfterClone's haproxy behaviour #126
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
laurentfufu
reviewed
Aug 31, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe wrong but for what I understand, don't like this part sorry :(
actions:
resetHaproxyBackends:
- cmd[bl]: |-
sed -ie "/$server.*:80 check cookie/d" /etc/haproxy/haproxy.cfg.d/10-jahia.cfg
- forEach(nodes.cp):
cmd[${this}]: |-
echo " server ${env.appid}-${@i.id} ${@i.intIP}:80 check cookie s${@i.id}" >> /etc/haproxy/haproxy.cfg.d/10-jahia.cfg
- cmd[bl]: |-
sed -ie 's/^.*server.*:80 check cookie.*$/\ server ${env.appid}-${nodes.proc.first.id} ${nodes.proc.first.intIP}:80 check cookie s${nodes.proc.first.id}/' /etc/haproxy/haproxy.cfg.d/11-proc.cfg
sed -ie 's/^.*use_backend proc if { cook(JSESSIONID),lower -m beg.*$/\ use_backend proc if { cook(JSESSIONID),lower -m beg s${nodes.proc.first.id} }/' /etc/haproxy/haproxy.cfg.d/00-global.cfg
sudo service haproxy reload
user: haproxy
sed lines are too long and not visual at all to me.
IMHO, something like this will be smoother to read and understand:
actions:
resetHaproxyBackends:
- cmd[bl]: |-
sed -e "/$server.*:80 check cookie/d" \
-e '/^.*use_backend proc if { cook(JSESSIONID),lower -m beg.*$/d' \
-i /etc/haproxy/haproxy.cfg.d/{00-global,10-jahia,11-proc}.cfg
echo " server ${env.appid}-${nodes.proc.first.id} ${nodes.proc.first.intIP}:80 check cookie s${nodes.proc.first.id}" \
>> /etc/haproxy/haproxy.cfg.d/11-proc.cfg
echo " use_backend proc if { cook(JSESSIONID),lower -m beg s${nodes.proc.first.id} }" \
>> /etc/haproxy/haproxy.cfg.d/00-global.cfg
- forEach(nodes.cp):
cmd[${this}]: |-
echo " server ${env.appid}-${@i.id} ${@i.intIP}:80 check cookie s${@i.id}" >> /etc/haproxy/haproxy.cfg.d/10-jahia.cfg
sudo service haproxy reload
user: haproxy
I tried to make these lines more readable. actions:
resetHaproxyBackends:
- cmd[bl]: |-
sed -e "/$server.*:80 check cookie/d" \
-i /etc/haproxy/haproxy.cfg.d/{10-jahia,11-proc}.cfg
echo " server ${env.appid}-${nodes.proc.first.id} ${nodes.proc.first.intIP}:80 check cookie s${nodes.proc.first.id}" \
>> /etc/haproxy/haproxy.cfg.d/11-proc.cfg
sed -e 's/cook(JSESSIONID),lower -m beg s.*/cook(JSESSIONID),lower -m beg s${nodes.proc.first.id} }/' \
-i /etc/haproxy/haproxy.cfg.d/00-global.cfg
- forEach(nodes.cp):
cmd[${this}]: |-
echo " server ${env.appid}-${@i.id} ${@i.intIP}:80 check cookie s${@i.id}" >> /etc/haproxy/haproxy.cfg.d/10-jahia.cfg
sudo service haproxy reload
user: haproxy |
laurentfufu
approved these changes
Sep 1, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
JIRA issue: https://jira.jahia.org/browse/PAAS-1164
Short description: onAfterClone event now refresh the proc node haproxy backend.