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

Wfluxor findings #120

Merged
merged 7 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions provision-contest/ansible/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,11 @@
recurse: true
owner: domjudge
group: domjudge

- name: Grant www-data permissions to user homedir (needed for web browser)
acl:
path: "/home/domjudge"
entity: www-data
etype: user
permissions: rwx
state: present
2 changes: 1 addition & 1 deletion provision-contest/ansible/domserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
use_ssh_args: true
notify: Clear application cache

- name: Grant www-data permisions to image folders
- name: Grant www-data permissions to image folders
acl:
path: "{{ DJ_DIR }}/webapp/public/images/{{ item }}"
entity: www-data
Expand Down
2 changes: 1 addition & 1 deletion provision-contest/ansible/group_vars/all/all.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ HOSTS:
domjudge-laptop: 10.3.3.200
pc2: 10.3.3.241

TIMEZONE: "Asia/Dhaka"
TIMEZONE: "Europe/Amsterdam"

PHP_FPM_MAX_CHILDREN: 400
PHP_FPM_MAX_REQUESTS: 500
Expand Down
1 change: 1 addition & 0 deletions provision-contest/ansible/roles/cds/files/cds.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Description=CDS
User=domjudge
Restart=always
ExecStart=/home/domjudge/cds/wlp/bin/server run cds
Environment=JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
TimeoutStopSec=20s
[Install]
WantedBy=multi-user.target
36 changes: 3 additions & 33 deletions provision-contest/ansible/roles/clusterssh/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,10 @@
pkg:
- clusterssh

- name: Create clusterssh 'all' config group
- name: Create clusterssh clusters file
become: true
become_user: domjudge
lineinfile:
template:
src: clusters.j2
dest: /home/domjudge/.clusterssh/clusters
regexp: '^all'
line: "all {{ groups['all'] | join(' ') }}"
create: true
mode: 0644

- name: Create clusterssh config groups
become: true
become_user: domjudge
lineinfile:
dest: /home/domjudge/.clusterssh/clusters
regexp: '^{{ item }}s'
line: "{{ item }}s {{ groups[item] | join(' ') }}"
create: true
mode: 0644
loop:
- domserver
- emergency
- judgehost
- admin
- cds
- grafana
- scoreboard
- mgmt

- name: Create clusterssh config groups
become: true
become_user: domjudge
lineinfile:
dest: /home/domjudge/.clusterssh/clusters
regexp: '^all-domservers'
line: "all-domservers {{ (groups['domserver'] + groups['emergency']) | join(' ') }}"
mode: 0644
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% for group in groups %}
{% if groups[group] %}
{{ group | replace('emergency', 'emergencie') }}{% if group != 'all' %}s{% endif %} {{ groups[group] | join(' ') }}
{% endif %}
{% endfor %}
2 changes: 2 additions & 0 deletions provision-contest/ansible/roles/hosts/templates/hosts.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

{% if DOMSERVER_IP is defined %}
{{ DOMSERVER_IP }} domjudge domserver
{% endif %}
{% for item in groups['all'] %}
{% if hostvars[item].ansible_host is defined %}
{{ hostvars[item].ansible_host }} {{ item }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
vrrp_instance lb_ipv4 {
state MASTER
interface {{ ansible_facts['default_ipv4']['interface'] }}
interface {{ KEEPALIVED_INTERFACE|default(ansible_facts['default_ipv4']['interface']) }}
use_vmac
virtual_router_id 32
priority {{KEEPALIVED_PRIORITY}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
regexp: '^bind-address\s*='
replace: '#bind-address ='

- name: Set the replication interface variable
set_fact:
replication_interface: "{{ REPLICATION_INTERFACE|default(ansible_default_ipv4.interface) }}"

- name: Set the variable for the IP address of the replication interface
set_fact:
replication_interface_ip_address: "{{ vars['ansible_' + replication_interface]['ipv4']['address'] }}"

- name: Add mysql config snippet for replication
template:
src: mysql.replication.cnf.j2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ log-bin = /var/log/mysql/mysql-bin.log
binlog_do_db = domjudge

# Host specific replication configuration
server_id = {{ ansible_default_ipv4.address | ipaddr('int') }}
server_id = {{ replication_interface_ip_address | ipaddr('int') }}
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ service mysql start

echo "Starting replication locally..."
mysql -e "
CHANGE MASTER TO MASTER_HOST='{{ SERVER_IP_PREFIX }}.${PRIMARY_SERVER_ID}',
CHANGE MASTER TO MASTER_HOST='${PRIMARY}',
MASTER_USER='replication',
MASTER_PASSWORD='{{ REPLICATION_PASSWORD }}',
MASTER_LOG_FILE='${PRIMARY_BINLOG}',
Expand Down Expand Up @@ -217,7 +217,7 @@ OUR_LOGPOS=$(get_field 'Position' "$OUR_STATUS")
if [ "$SETUP_MASTER_MASTER" -eq 1 ]; then
echo "Starting replication on $PRIMARY..."
ssh "$PRIMARY" "mysql -e '
CHANGE MASTER TO MASTER_HOST=\"{{ SERVER_IP_PREFIX }}.${OUR_SERVER_ID}\",
CHANGE MASTER TO MASTER_HOST=\"{{ replication_interface_ip_address }}\",
MASTER_USER=\"replication\",
MASTER_PASSWORD=\"{{ REPLICATION_PASSWORD }}\",
MASTER_LOG_FILE=\"${OUR_BINLOG}\",
Expand Down
Loading