Skip to content
Open
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
4 changes: 4 additions & 0 deletions ansible/combined-mirror/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ certbot_cron_enabled: true
certbot_cron_schedule:
minute: 0
hour: 3

# /healthcheck endpoint (required by cl-mirrors mirrorservice)
healthcheck_file: /var/www/healthcheck.html
healthcheck_source_name: swng.cloudlinux.com
6 changes: 6 additions & 0 deletions ansible/combined-mirror/nginx-https.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ server {
autoindex on;
}

# Required by cl-mirrors mirrorservice (health-check)
location = /healthcheck {
alias {{ healthcheck_file }};
default_type text/html;
}

# SWNG repositories
location /swng/ {
alias {{ swng_mirror_path }}/;
Expand Down
6 changes: 6 additions & 0 deletions ansible/combined-mirror/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ server {
autoindex on;
}

# Required by cl-mirrors mirrorservice (health-check)
location = /healthcheck {
alias {{ healthcheck_file }};
default_type text/html;
}

# SWNG repositories
location /swng/ {
alias {{ swng_mirror_path }}/;
Expand Down
20 changes: 20 additions & 0 deletions ansible/combined-mirror/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,26 @@
debug:
msg: "{{ timer_status.stdout_lines }}"

- name: Install /healthcheck update script (required by cl-mirrors mirrorservice)
ansible.builtin.copy:
src: update-healthcheck.sh
dest: /usr/local/bin/update-healthcheck.sh
mode: '0755'

- name: Ensure /healthcheck file directory exists
ansible.builtin.file:
path: "{{ healthcheck_file | dirname }}"
state: directory
mode: '0755'

- name: Generate initial /healthcheck so it is available before first sync completes
ansible.builtin.command:
cmd: /usr/local/bin/update-healthcheck.sh "{{ healthcheck_source_name }}" PENDING
args:
creates: "{{ healthcheck_file }}"
environment:
HEALTHCHECK_FILE: "{{ healthcheck_file }}"

- name: Install Nginx
package:
name: nginx
Expand Down
1 change: 1 addition & 0 deletions ansible/combined-mirror/swng-mirror.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/rsync -av --delete {{ swng_rsync_source }} {{ swng_mirror_path }}/
ExecStartPost=/usr/local/bin/update-healthcheck.sh "{{ healthcheck_source_name }}" OK
StandardOutput=append:{{ swng_sync_log }}
StandardError=append:{{ swng_sync_log }}
23 changes: 23 additions & 0 deletions ansible/combined-mirror/update-healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Updates the /healthcheck endpoint timestamp so the CloudLinux cl-mirrors
# mirrorservice can verify this mirror is fresh.
# Called by the sync service unit's ExecStartPost after a successful run.
#
# Required by: https://repo.cloudlinux.com/cloudlinux/mirrorlists/cl-mirrors
# Format: line "<name> | Status: OK | YYYY/MM/DD HH:MM:SS" with timestamp <= 12h old.

set -eu

SOURCE_NAME="${1:-swng.cloudlinux.com}"
STATUS="${2:-OK}"
HEALTHCHECK_FILE="${HEALTHCHECK_FILE:-/var/www/healthcheck.html}"
NOW=$(date -u '+%Y/%m/%d %H:%M:%S')

mkdir -p "$(dirname "$HEALTHCHECK_FILE")"
cat > "$HEALTHCHECK_FILE" <<HTML
<html><body>
<strong>Last healthcheck update:</strong> $NOW UTC<br />
<h3>Sync status</h3>
$SOURCE_NAME | Status: $STATUS | $NOW <br />
</body></html>
HTML
4 changes: 4 additions & 0 deletions ansible/complete-swng-rsync/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ certbot_cron_schedule:
minute: 0
hour: 3


# /healthcheck endpoint (required by cl-mirrors mirrorservice)
healthcheck_file: /var/www/healthcheck.html
healthcheck_source_name: swng.cloudlinux.com
6 changes: 6 additions & 0 deletions ansible/complete-swng-rsync/nginx-https.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ server {
access_log /var/log/nginx/swng-mirror-https-access.log;
error_log /var/log/nginx/swng-mirror-https-error.log;

# Required by cl-mirrors mirrorservice (health-check)
location = /healthcheck {
alias {{ healthcheck_file }};
default_type text/html;
}

# SWNG repositories
location / {
try_files $uri $uri/ =404;
Expand Down
12 changes: 12 additions & 0 deletions ansible/complete-swng-rsync/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ server {
root {{ certbot_webroot | default('/var/www/mirrors/acme') }};
}

# Required by cl-mirrors mirrorservice (health-check)
location = /healthcheck {
alias {{ healthcheck_file }};
default_type text/html;
}

# Normalize SWNG path (no trailing slash)
location = /swng {
return 301 https://$server_name/swng/;
Expand Down Expand Up @@ -37,6 +43,12 @@ server {
access_log /var/log/nginx/swng-mirror-access.log;
error_log /var/log/nginx/swng-mirror-error.log;

# Required by cl-mirrors mirrorservice (health-check)
location = /healthcheck {
alias {{ healthcheck_file }};
default_type text/html;
}

# SWNG repositories
location / {
try_files $uri $uri/ =404;
Expand Down
20 changes: 20 additions & 0 deletions ansible/complete-swng-rsync/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,26 @@
debug:
msg: "{{ timer_status.stdout_lines }}"

- name: Install /healthcheck update script (required by cl-mirrors mirrorservice)
ansible.builtin.copy:
src: update-healthcheck.sh
dest: /usr/local/bin/update-healthcheck.sh
mode: '0755'

- name: Ensure /healthcheck file directory exists
ansible.builtin.file:
path: "{{ healthcheck_file | dirname }}"
state: directory
mode: '0755'

- name: Generate initial /healthcheck so it is available before first sync completes
ansible.builtin.command:
cmd: /usr/local/bin/update-healthcheck.sh "{{ healthcheck_source_name }}" PENDING
args:
creates: "{{ healthcheck_file }}"
environment:
HEALTHCHECK_FILE: "{{ healthcheck_file }}"

- name: Install Nginx
package:
name: nginx
Expand Down
1 change: 1 addition & 0 deletions ansible/complete-swng-rsync/swng-mirror.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/rsync -av --delete {{ rsync_source }} {{ swng_mirror_path }}/
ExecStartPost=/usr/local/bin/update-healthcheck.sh "{{ healthcheck_source_name }}" OK
StandardOutput=append:{{ sync_log_file }}
StandardError=append:{{ sync_log_file }}
23 changes: 23 additions & 0 deletions ansible/complete-swng-rsync/update-healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Updates the /healthcheck endpoint timestamp so the CloudLinux cl-mirrors
# mirrorservice can verify this mirror is fresh.
# Called by the sync service unit's ExecStartPost after a successful run.
#
# Required by: https://repo.cloudlinux.com/cloudlinux/mirrorlists/cl-mirrors
# Format: line "<name> | Status: OK | YYYY/MM/DD HH:MM:SS" with timestamp <= 12h old.

set -eu

SOURCE_NAME="${1:-swng.cloudlinux.com}"
STATUS="${2:-OK}"
HEALTHCHECK_FILE="${HEALTHCHECK_FILE:-/var/www/healthcheck.html}"
NOW=$(date -u '+%Y/%m/%d %H:%M:%S')

mkdir -p "$(dirname "$HEALTHCHECK_FILE")"
cat > "$HEALTHCHECK_FILE" <<HTML
<html><body>
<strong>Last healthcheck update:</strong> $NOW UTC<br />
<h3>Sync status</h3>
$SOURCE_NAME | Status: $STATUS | $NOW <br />
</body></html>
HTML
4 changes: 4 additions & 0 deletions ansible/specific-version-rsync(Recomended)/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ certbot_cron_enabled: true
certbot_cron_schedule:
minute: 0
hour: 3

# /healthcheck endpoint (required by cl-mirrors mirrorservice)
healthcheck_file: /var/www/healthcheck.html
healthcheck_source_name: swng.cloudlinux.com
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ server {
error_log /var/log/nginx/swng-{{ cloudlinux_version }}-mirror-https-error.log;

# SWNG CloudLinux repositories
# Required by cl-mirrors mirrorservice (health-check)
location = /healthcheck {
alias {{ healthcheck_file }};
default_type text/html;
}

location / {
try_files $uri $uri/ =404;
}
Expand Down
6 changes: 6 additions & 0 deletions ansible/specific-version-rsync(Recomended)/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ server {
root {{ certbot_webroot | default('/var/www/mirrors/acme') }};
}

# Required by cl-mirrors mirrorservice (health-check)
location = /healthcheck {
alias {{ healthcheck_file }};
default_type text/html;
}

# Normalize SWNG path (no trailing slash)
location = /swng {
return 301 https://$server_name/swng/;
Expand Down
20 changes: 20 additions & 0 deletions ansible/specific-version-rsync(Recomended)/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,26 @@
debug:
msg: "{{ timer_status.stdout_lines }}"

- name: Install /healthcheck update script (required by cl-mirrors mirrorservice)
ansible.builtin.copy:
src: update-healthcheck.sh
dest: /usr/local/bin/update-healthcheck.sh
mode: '0755'

- name: Ensure /healthcheck file directory exists
ansible.builtin.file:
path: "{{ healthcheck_file | dirname }}"
state: directory
mode: '0755'

- name: Generate initial /healthcheck so it is available before first sync completes
ansible.builtin.command:
cmd: /usr/local/bin/update-healthcheck.sh "{{ healthcheck_source_name }}" PENDING
args:
creates: "{{ healthcheck_file }}"
environment:
HEALTHCHECK_FILE: "{{ healthcheck_file }}"

- name: Install Nginx
package:
name: nginx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/rsync -av --delete {{ rsync_source }} {{ swng_mirror_path }}/
ExecStartPost=/usr/local/bin/update-healthcheck.sh "{{ healthcheck_source_name }}" OK
StandardOutput=append:{{ sync_log_file }}
StandardError=append:{{ sync_log_file }}
23 changes: 23 additions & 0 deletions ansible/specific-version-rsync(Recomended)/update-healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Updates the /healthcheck endpoint timestamp so the CloudLinux cl-mirrors
# mirrorservice can verify this mirror is fresh.
# Called by the sync service unit's ExecStartPost after a successful run.
#
# Required by: https://repo.cloudlinux.com/cloudlinux/mirrorlists/cl-mirrors
# Format: line "<name> | Status: OK | YYYY/MM/DD HH:MM:SS" with timestamp <= 12h old.

set -eu

SOURCE_NAME="${1:-swng.cloudlinux.com}"
STATUS="${2:-OK}"
HEALTHCHECK_FILE="${HEALTHCHECK_FILE:-/var/www/healthcheck.html}"
NOW=$(date -u '+%Y/%m/%d %H:%M:%S')

mkdir -p "$(dirname "$HEALTHCHECK_FILE")"
cat > "$HEALTHCHECK_FILE" <<HTML
<html><body>
<strong>Last healthcheck update:</strong> $NOW UTC<br />
<h3>Sync status</h3>
$SOURCE_NAME | Status: $STATUS | $NOW <br />
</body></html>
HTML
4 changes: 4 additions & 0 deletions ansible/yum-reposync/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ swng_repos:
# baseurl: https://upstream.cloudlinux.com/swng/8/x86_64/
# module_platform_id: platform:el8
# enabled: true

# /healthcheck endpoint (required by cl-mirrors mirrorservice)
healthcheck_file: /var/www/healthcheck.html
healthcheck_source_name: swng.cloudlinux.com
6 changes: 6 additions & 0 deletions ansible/yum-reposync/nginx-https.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ server {
access_log /var/log/nginx/swng-reposync-mirror-https-access.log;
error_log /var/log/nginx/swng-reposync-mirror-https-error.log;

# Required by cl-mirrors mirrorservice (health-check)
location = /healthcheck {
alias {{ healthcheck_file }};
default_type text/html;
}

# SWNG repositories
location / {
try_files $uri $uri/ =404;
Expand Down
6 changes: 6 additions & 0 deletions ansible/yum-reposync/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ server {
access_log /var/log/nginx/swng-reposync-mirror-access.log;
error_log /var/log/nginx/swng-reposync-mirror-error.log;

# Required by cl-mirrors mirrorservice (health-check)
location = /healthcheck {
alias {{ healthcheck_file }};
default_type text/html;
}

# SWNG repositories
location / {
try_files $uri $uri/ =404;
Expand Down
20 changes: 20 additions & 0 deletions ansible/yum-reposync/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,26 @@
debug:
msg: "{{ timer_status.stdout_lines }}"

- name: Install /healthcheck update script (required by cl-mirrors mirrorservice)
ansible.builtin.copy:
src: update-healthcheck.sh
dest: /usr/local/bin/update-healthcheck.sh
mode: '0755'

- name: Ensure /healthcheck file directory exists
ansible.builtin.file:
path: "{{ healthcheck_file | dirname }}"
state: directory
mode: '0755'

- name: Generate initial /healthcheck so it is available before first sync completes
ansible.builtin.command:
cmd: /usr/local/bin/update-healthcheck.sh "{{ healthcheck_source_name }}" PENDING
args:
creates: "{{ healthcheck_file }}"
environment:
HEALTHCHECK_FILE: "{{ healthcheck_file }}"

- name: Install Nginx
package:
name: nginx
Expand Down
1 change: 1 addition & 0 deletions ansible/yum-reposync/swng-reposync.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ ExecStart=/usr/bin/reposync -p {{ swng_mirror_path }}/ --repo {{ repo.name }}
ExecStartPost=/usr/bin/createrepo {{ swng_mirror_path }}/{{ repo.name }}/
{% endif %}
{% endfor %}
ExecStartPost=/usr/local/bin/update-healthcheck.sh "{{ healthcheck_source_name }}" OK
StandardOutput=append:{{ sync_log_file }}
StandardError=append:{{ sync_log_file }}
23 changes: 23 additions & 0 deletions ansible/yum-reposync/update-healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Updates the /healthcheck endpoint timestamp so the CloudLinux cl-mirrors
# mirrorservice can verify this mirror is fresh.
# Called by the sync service unit's ExecStartPost after a successful run.
#
# Required by: https://repo.cloudlinux.com/cloudlinux/mirrorlists/cl-mirrors
# Format: line "<name> | Status: OK | YYYY/MM/DD HH:MM:SS" with timestamp <= 12h old.

set -eu

SOURCE_NAME="${1:-swng.cloudlinux.com}"
STATUS="${2:-OK}"
HEALTHCHECK_FILE="${HEALTHCHECK_FILE:-/var/www/healthcheck.html}"
NOW=$(date -u '+%Y/%m/%d %H:%M:%S')

mkdir -p "$(dirname "$HEALTHCHECK_FILE")"
cat > "$HEALTHCHECK_FILE" <<HTML
<html><body>
<strong>Last healthcheck update:</strong> $NOW UTC<br />
<h3>Sync status</h3>
$SOURCE_NAME | Status: $STATUS | $NOW <br />
</body></html>
HTML