diff --git a/roles/fedora-web/build/files/syncStatic.cron b/roles/fedora-web/build/files/syncStatic.cron new file mode 100644 index 0000000000..bb1e3c4448 --- /dev/null +++ b/roles/fedora-web/build/files/syncStatic.cron @@ -0,0 +1,2 @@ +MAILTO=web-members@fedoraproject.org +0 * * * * apache /usr/local/bin/lock-wrapper syncStatic /usr/local/bin/syncStatic diff --git a/roles/fedora-web/build/files/syncStatic.sh b/roles/fedora-web/build/files/syncStatic.sh new file mode 100644 index 0000000000..101462588b --- /dev/null +++ b/roles/fedora-web/build/files/syncStatic.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# mmcgrath@redhat.com 09-20-2007 +# + +function build { + site="$1" + err=$( + { + cd "$site" && \ + make syncpos && \ + make && \ + rsync -qa --delete-after --delay-updates out/ "/srv/web/$site/"; \ + } 2>&1 + ) + + rc=$? + if [ $rc -ne 0 ]; then + echo "$site build failed" + echo "====================================" + echo "$err" + echo + fi + + return $rc; +} + +if [ ! -d /srv/web/fedora-web/.git ] +then + /usr/bin/git clone -q \ + git://git.fedorahosted.org/fedora-web.git \ + /srv/web/fedora-web +fi + +# Freeze the website to prepare beta changes. On release day, comment the git +# checkout line below, run this script, and use: +# sudo func proxy\* call command run "/usr/bin/rsync -a --no-owner --no-group bapp02::fedoraproject.org/* /srv/web/fedoraproject.org/" +# on puppet1 to update the website. +# +# For any other last-minute changes or fixes, make the necessary changes in the +# fedora-web repo, then run this script and the above func command. +# +# Good luck! + +cd /srv/web/fedora-web + +/usr/bin/git clean -q -fdx || exit 1 +/usr/bin/git reset -q --hard || exit 1 +/usr/bin/git checkout -q master || exit 1 + +/usr/bin/git pull -q --ff-only || exit 1 +build labs.fedoraproject.org +build arm.fedoraproject.org + +pushd mirrors.fedoraproject.org > /dev/null +rsync -qa --delete-after --delay-updates . /srv/web/mirrors.fedoraproject.org/ +popd > /dev/null + +# Make sure everything else builds from master. +/usr/bin/git clean -q -fdx || exit 1 +/usr/bin/git reset -q --hard || exit 1 +/usr/bin/git checkout -q master || exit 1 + +/usr/bin/git pull -q --ff-only || exit 1 + +build getfedora.org +build spins.fedoraproject.org +build boot.fedoraproject.org +build fedoracommunity.org +build fudcon.fedoraproject.org +build start.fedoraproject.org diff --git a/roles/fedora-web/build/files/syncStatic.stg.sh b/roles/fedora-web/build/files/syncStatic.stg.sh new file mode 100644 index 0000000000..824abd1f5a --- /dev/null +++ b/roles/fedora-web/build/files/syncStatic.stg.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# mmcgrath@redhat.com 09-20-2007 +# + +function build { + site="$1" + err=$( + { + cd "$site" && \ + make syncpos && \ + make && \ + rsync -qa --delete-after --delay-updates out/ "/srv/web/$site/"; \ + } 2>&1 + ) + + rc=$? + if [ $rc -ne 0 ]; then + echo "$site build failed" + echo "====================================" + echo "$err" + echo + fi + + return $rc; +} + +if [ ! -d /srv/web/fedora-web/.git ] +then + /usr/bin/git clone -q \ + git://git.fedorahosted.org/fedora-web.git \ + /srv/web/fedora-web +fi + +# Freeze the website to prepare beta changes. On release day, comment the git +# checkout line below, run this script, and use: +# sudo func proxy\* call command run "/usr/bin/rsync -a --no-owner --no-group bapp02::fedoraproject.org/* /srv/web/fedoraproject.org/" +# on puppet1 to update the website. +# +# For any other last-minute changes or fixes, make the necessary changes in the +# fedora-web repo, then run this script and the above func command. +# +# Good luck! + +cd /srv/web/fedora-web + +/usr/bin/git clean -q -fdx || exit 1 +/usr/bin/git reset -q --hard || exit 1 +/usr/bin/git checkout -q master || exit 1 + +/usr/bin/git pull -q --ff-only || exit 1 +build spins.fedoraproject.org +build getfedora.org +build labs.fedoraproject.org +build arm.fedoraproject.org + +pushd mirrors.fedoraproject.org > /dev/null +rsync -qa --delete-after --delay-updates . /srv/web/mirrors.fedoraproject.org/ +popd > /dev/null + +# Make sure everything else builds from master. +/usr/bin/git clean -q -fdx || exit 1 +/usr/bin/git reset -q --hard || exit 1 +/usr/bin/git checkout -q master || exit 1 + +/usr/bin/git pull -q --ff-only || exit 1 + +build boot.fedoraproject.org +build fedoracommunity.org +build fudcon.fedoraproject.org +build start.fedoraproject.org diff --git a/roles/fedora-web/build/files/syncTranslations.cron b/roles/fedora-web/build/files/syncTranslations.cron new file mode 100644 index 0000000000..d3fb7a07b6 --- /dev/null +++ b/roles/fedora-web/build/files/syncTranslations.cron @@ -0,0 +1,2 @@ +MAILTO=web-members@fedoraproject.org +0 * * * * apache /usr/local/bin/lock-wrapper syncTranslations /usr/local/bin/syncTranslations.sh | /usr/local/bin/nag-once syncTranslations 1d 2>&1 diff --git a/roles/fedora-web/build/files/syncTranslations.sh b/roles/fedora-web/build/files/syncTranslations.sh new file mode 100644 index 0000000000..1fe566f703 --- /dev/null +++ b/roles/fedora-web/build/files/syncTranslations.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# this script pull all translations from the zanata Websites project. +# It pulls every resources. + +PO_DIR=/var/tmp/po_dir +SITES="boot.fedoraproject.org \ + fedoracommunity.org \ + fedorahosted.org \ + fedoraproject.org \ + getfedora.org \ + spins.fedoraproject.org \ + labs.fedoraproject.org \ + arm.fedoraproject.org \ + start.fedoraproject.org" + +# hack for zanata-client, since it currently only is able to find +# config file in ~/.config/zanata.ini and apache's $HOME isn't a good location +export HOME=/var/lib/zanata + +[ -d $PO_DIR ] || mkdir $PO_DIR + +for site in $SITES +do + [ -d $PO_DIR/$site ] || mkdir -p $PO_DIR/$site + cp $HOME/sample.xml $PO_DIR/$site/zanata.xml + sed -i "s/@VERSION@/$site/" $PO_DIR/$site/zanata.xml + cd $PO_DIR/$site + zanata pull +done + diff --git a/roles/fedora-web/build/tasks/main.yml b/roles/fedora-web/build/tasks/main.yml index 7ce4f40bc3..b8cfb769ee 100644 --- a/roles/fedora-web/build/tasks/main.yml +++ b/roles/fedora-web/build/tasks/main.yml @@ -32,25 +32,31 @@ copy: > src=syncStatic.stg.sh dest=/usr/local/bin/syncStatic user=root group=root mode=0755 + tags: + - fedora-web - name: Copy syncStatic script (prod) when: env == "production" copy: > src=syncStatic.sh dest=/usr/local/bin/syncStatic user=root group=root mode=0755 + tags: + - fedora-web - name: Copy syncTranslations script copy: > src=syncTranslations.sh dest=/usr/local/bin/syncTranslations.sh user=root group=root mode=0755 + tags: + - fedora-web -# TODO: Cron jobs - -## Install the cron job -#- name: Install the easyfix cronjob -# copy: > -# src=easyfix.cron dest=/etc/cron.d/easyfix.cron -# owner=root group=root mode=0644 -# tags: -# - files -# - easyfix +- name: Install the syncStatic and syncTranslations cronjobs + copy: > + src={{item}}.cron dest=/etc/cron.d/{{item}}.cron + owner=root group=root mode=0644 + with_items: + - syncStatic + - syncTranslations + tags: + - fedora-web + - cron