diff --git a/ansible/playbooks/create-webhost.yml b/ansible/playbooks/create-webhost.yml index f9a4dfe10..561086a80 100644 --- a/ansible/playbooks/create-webhost.yml +++ b/ansible/playbooks/create-webhost.yml @@ -22,7 +22,6 @@ loop_control: loop_var: secret with_items: - - github_secret - cdn_api_key - cdn_api_email - cdn_api_iojs_id diff --git a/ansible/www-standalone/ansible-playbook.yaml b/ansible/www-standalone/ansible-playbook.yaml index dd3b806dc..51874b5e4 100644 --- a/ansible/www-standalone/ansible-playbook.yaml +++ b/ansible/www-standalone/ansible-playbook.yaml @@ -18,9 +18,6 @@ - include_tasks: tasks/site-setup.yaml tags: setup - - include_tasks: tasks/webhook.yaml - tags: webhook - - include_tasks: tasks/nginx.yaml tags: nginx diff --git a/ansible/www-standalone/host_vars/node-www.tmpl b/ansible/www-standalone/host_vars/node-www.tmpl index ce7577199..3f8267300 100644 --- a/ansible/www-standalone/host_vars/node-www.tmpl +++ b/ansible/www-standalone/host_vars/node-www.tmpl @@ -1,5 +1,4 @@ --- -github_secret: "INSERT SECRET FROM WEBHOOK HERE" cdn_api_key: "INSERT CLOUDFLARE API KEY" cdn_api_email: "INSERT CLOUDFLARE API EMAIL" cdn_api_iojs_id: "INSERT CLOUDFLARE API iojs.org ID" diff --git a/ansible/www-standalone/resources/config/github-webhook.json.j2 b/ansible/www-standalone/resources/config/github-webhook.json.j2 deleted file mode 100644 index 551b5ca2b..000000000 --- a/ansible/www-standalone/resources/config/github-webhook.json.j2 +++ /dev/null @@ -1,18 +0,0 @@ -{ - "port": 9999, - "path": "/webhook", - "secret": "{{ github_secret }}", - "log": "/home/nodejs/github-webhook.log", - "rules": [ - { - "event": "push", - "match": "ref == \"refs/heads/main\" && repository.full_name == \"nodejs/nodejs.org\"", - "exec": "/home/nodejs/build-site.sh nodejs" - }, - { - "event": "push", - "match": "ref == \"refs/heads/master\" && repository.full_name == \"nodejs/iojs.org\"", - "exec": "/home/nodejs/build-site.sh iojs" - } - ] -} diff --git a/ansible/www-standalone/resources/config/github-webhook.service.j2 b/ansible/www-standalone/resources/config/github-webhook.service.j2 deleted file mode 100644 index 85b7c8ea2..000000000 --- a/ansible/www-standalone/resources/config/github-webhook.service.j2 +++ /dev/null @@ -1,21 +0,0 @@ -[Unit] -Description=GitHub Webhook -Wants=network.target -After=network.target - -[Install] -WantedBy=multi-user.target - -[Service] -Type=simple -User={{ server_user }} - -Environment="USER={{ server_user }}" -Environment="SHELL=/bin/bash" -Environment="HOME=/home/{{ server_user }}" -Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - -ExecStart=/usr/bin/github-webhook --config /etc/github-webhook.json -Restart=always -RestartSec=30 -StartLimitInterval=0 diff --git a/ansible/www-standalone/resources/config/logrotate-github-webhook b/ansible/www-standalone/resources/config/logrotate-github-webhook deleted file mode 100644 index 91d898abe..000000000 --- a/ansible/www-standalone/resources/config/logrotate-github-webhook +++ /dev/null @@ -1,23 +0,0 @@ -/home/nodejs/github-webhook.log -{ - monthly - missingok - compresscmd /usr/bin/xz - uncompresscmd /usr/bin/unxz - compressext .xz - compress - notifempty - create 0644 nodejs nodejs - dateext - dateformat .%Y%m%d.%s - dateyesterday - maxsize 500M - sharedscripts - rotate 36500 - prerotate - systemctl stop github-webhook - endscript - postrotate - systemctl start github-webhook - endscript -} diff --git a/ansible/www-standalone/resources/config/nodejs.org b/ansible/www-standalone/resources/config/nodejs.org index 3ef88a351..1e7db28f9 100644 --- a/ansible/www-standalone/resources/config/nodejs.org +++ b/ansible/www-standalone/resources/config/nodejs.org @@ -291,15 +291,6 @@ server { try_files /$lang/404.html /en/404.html =404; } - # This Location directive is used to expose our Website GitHub WebHook Logs - location = /github-webhook.log { - add_header Cache-Control "private, no-store, max-age=0" always; - - alias /home/nodejs/github-webhook.log; - default_type text/plain; - access_log off; - } - # This location directive is used as the health-check/load-balancer endpoint for Cloudflare # Each Cloudflare colo sends a request here every 60s to check we're up # We use a direct response from NGINX to avoid file system load for these requests diff --git a/ansible/www-standalone/resources/scripts/build-site.sh b/ansible/www-standalone/resources/scripts/build-site.sh deleted file mode 100755 index 952a63048..000000000 --- a/ansible/www-standalone/resources/scripts/build-site.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -set -e - -site=$1 - -if [ "X$site" != "Xiojs" ] && [ "X$site" != "Xnodejs" ]; then - echo "Usage: build-site.sh < iojs | nodejs >" - exit 1 -fi - -pidof -s -o '%PPID' -x $(basename $0) > /dev/null 2>&1 && \ - echo "$(basename $0) already running" && \ - exit 1 - -clonedir=/home/www/github/${site} - -if [ ! -d "${clonedir}" ]; then - repo="${site}.org" - git clone --depth 2 https://github.com/nodejs/${repo}.git $clonedir -fi - -if [ "$site" == "nodejs" ]; then - build_cmd="npm run deploy" - rsync_from="build/" -else - build_cmd="node_modules/.bin/gulp build" - rsync_from="public/" -fi - -cd $clonedir -git reset --hard -git clean -fdx -git fetch origin -git checkout origin/main - -nodeuid=$(grep ^nodejs: /etc/passwd | awk -F: '{print $3}') -nodegid=$(grep ^nodejs: /etc/passwd | awk -F: '{print $4}') - -docker pull node:lts-bullseye -docker run \ - --rm \ - -v ${clonedir}:/website/ \ - -v /home/nodejs/.npm:/npm/ \ - node:lts-bullseye \ - bash -c " \ - apt-get update && apt-get install -y rsync && \ - addgroup nodejs --gid ${nodeuid} && \ - adduser nodejs --uid ${nodeuid} --gid ${nodegid} --gecos nodejs --disabled-password && \ - su nodejs -c ' \ - npm config set loglevel http && \ - npm config set cache /npm/ && \ - cd /website/ && \ - npm ci --omit=dev --no-audit --no-fund --ignore-scripts && \ - $build_cmd \ - ' \ - " - -rsync -avz --delete --exclude .git ${clonedir}/${rsync_from} /home/www/${site}/ - -/home/nodejs/queue-cdn-purge.sh $site build-site diff --git a/ansible/www-standalone/resources/scripts/check-build-site.sh b/ansible/www-standalone/resources/scripts/check-build-site.sh deleted file mode 100755 index e032dcea1..000000000 --- a/ansible/www-standalone/resources/scripts/check-build-site.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -site=$1 - -if [ "X$site" != "Xiojs" ] && [ "X$site" != "Xnodejs" ]; then - echo "Usage: check-build-site.sh < iojs | nodejs >" - exit 1 -fi - -indexjson=/home/dist/${site}/release/index.json -indexhtml=/home/www/${site}/en/index.html -buildsite=/home/nodejs/build-site.sh - -[ "X$site" = "Xnodejs" ] && indexhtml=/home/www/nodejs/en.html - -[ $indexjson -nt $indexhtml ] && $buildsite $site diff --git a/ansible/www-standalone/tasks/site-setup.yaml b/ansible/www-standalone/tasks/site-setup.yaml index 6db66a7ac..f39b03ad3 100644 --- a/ansible/www-standalone/tasks/site-setup.yaml +++ b/ansible/www-standalone/tasks/site-setup.yaml @@ -1,15 +1,3 @@ -- name: Site Setup | Copy build-site scripts - copy: - src: ./resources/scripts/{{ item }} - dest: /home/nodejs/{{ item }} - mode: 0700 - owner: nodejs - group: nodejs - with_items: - - build-site.sh - - check-build-site.sh - tags: setup - - name: Site Setup | Make /home/www file: path: "{{ item }}" @@ -20,7 +8,6 @@ - /home/www - /home/www/iojs - /home/www/nodejs - - /home/www/github - /home/www/coverage tags: setup @@ -68,38 +55,12 @@ group: root tags: setup -- name: Site Setup | Make /home/nodejs/.npm - file: - path: /home/nodejs/.npm - state: directory - mode: 0755 - owner: nodejs - tags: setup - -- name: Site Setup | Make /var/run/nodejs - file: - path: /var/run/nodejs - state: directory - mode: 0755 - owner: nodejs - tags: setup - -- name: Site Setup | Initial nodejs, iojs clone and update - become: yes - become_user: "nodejs" - command: "{{ item }}" - with_items: - - "/home/nodejs/build-site.sh nodejs" - - "/home/nodejs/build-site.sh iojs" - tags: setup - - name: Site Setup | Add periodic tasks to crontab lineinfile: dest: /etc/crontab line: "{{ item }}" with_items: - "*/30 * * * * dist /home/staging/tools/promote/promote_nightly.sh nodejs" - - "*/5 * * * * nodejs /home/nodejs/check-build-site.sh nodejs" - "*/5 * * * * root /home/nodejs/cdn-purge.sh" tags: setup diff --git a/ansible/www-standalone/tasks/webhook.yaml b/ansible/www-standalone/tasks/webhook.yaml deleted file mode 100644 index 09288744c..000000000 --- a/ansible/www-standalone/tasks/webhook.yaml +++ /dev/null @@ -1,33 +0,0 @@ -- name: GitHub Webhook | Install github-webhook - command: "npm install github-webhook -g" - tags: webhook - -- name: GitHub Webhook | Copy config - template: - src: ./resources/config/github-webhook.json.j2 - dest: /etc/github-webhook.json - mode: 0644 - tags: webhook - -- name: GitHub Webhook | Generate and copy init script - template: - src: ./resources/config/github-webhook.service.j2 - dest: /lib/systemd/system/github-webhook.service - tags: webhook - -- name: GitHub Webhook | Start service - service: - name: github-webhook - state: restarted - enabled: yes - tags: webhook - -- name: GitHub Webhook | Copy logrotate config - copy: - src: ./resources/config/logrotate-github-webhook - dest: /etc/logrotate.d/github-webhook - mode: 0644 - owner: root - group: root - tags: webhook -