Commit e8514eac authored by Zach van Rijn's avatar Zach van Rijn
Browse files

Remove unnecessary configuration. No longer using Apache, no longer need control files.

parent 7ee07772
Pipeline #808 canceled with stage
......@@ -6,7 +6,7 @@
:Status:
Draft
:Copyright:
© 2015-2018 Adélie Linux. CC BY-NC-SA open source license.
© 2015-2021 Adélie Linux. CC BY-NC-SA open source license.
......
<Directory /srv/www/adelie>
Require all granted
Options FollowSymLinks
</Directory>
DocumentRoot "/srv/www/adelie/www"
<VirtualHost *:80>
ServerName www.adelielinux.org
CustomLog /var/log/apache2/access.adelie.http.log combined
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/ssl/adelie.pem
SSLCertificateChainFile /etc/ssl/adelie-ca.pem
<IfModule headers_module>
Header always set Strict-Transport-Security "max-age=15768000"
</IfModule>
ServerName www.adelielinux.org
CustomLog /var/log/apache2/access.adelie.https.log combined
# New site design.
Redirect 301 /about-qa.html /about/faq.html
Redirect 301 /about.html /about/
Redirect 301 /contribute.html /community/contribute.html
Redirect 301 /team.html /about/team.html
</VirtualHost>
<VirtualHost *:80>
ServerName adelielinux.org
Redirect 301 / http://www.adelielinux.org/
CustomLog /var/log/apache2/access.adelie.http.log combined
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/ssl/adelie.pem
SSLCertificateChainFile /etc/ssl/adelie-ca.pem
ServerName adelielinux.org
Redirect 301 / https://www.adelielinux.org/
CustomLog /var/log/apache2/access.adelie.https.log combined
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/ssl/adelie.pem
SSLCertificateChainFile /etc/ssl/adelie-ca.pem
<IfModule headers_module>
Header always set Strict-Transport-Security "max-age=15768000"
Header always set Access-Control-Allow-Origin "*"
Header always set Cache-Control "max-age=31536000, immutable"
</IfModule>
DocumentRoot "/srv/www/adelie/static"
ServerName static.adelielinux.org
CustomLog /var/log/apache2/access.static.https.log combined
</VirtualHost>
<VirtualHost *:80>
<IfModule headers_module>
Header always set Access-Control-Allow-Origin "*"
Header always set Cache-Control "max-age=31536000, immutable"
</IfModule>
DocumentRoot "/srv/www/adelie/static"
ServerName static.adelielinux.org
CustomLog /var/log/apache2/access.static.http.log combined
</VirtualHost>
<Directory /srv/www/adelie/support/text>
Options Indexes
</Directory>
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/ssl/adelie.pem
SSLCertificateChainFile /etc/ssl/adelie-ca.pem
<IfModule headers_module>
Header always set Strict-Transport-Security "max-age=15768000"
Header always set Access-Control-Allow-Origin "*"
Header always set Cache-Control "max-age=86400;"
</IfModule>
DocumentRoot "/srv/www/adelie/support"
ServerName help.adelielinux.org
ServerAlias support.adelielinux.org
CustomLog /var/log/apache2/access.support.https.log combined
</VirtualHost>
<VirtualHost *:80>
<IfModule headers_module>
Header always set Access-Control-Allow-Origin "*"
Header always set Cache-Control "max-age=86400;"
</IfModule>
DocumentRoot "/srv/www/adelie/support"
ServerName help.adelielinux.org
ServerAlias support.adelielinux.org
CustomLog /var/log/apache2/access.support.http.log combined
</VirtualHost>
.qmake.stash
Makefile
main.o
site-control
Copyright (c) 2018 Adélie Linux Team.
All rights reserved.
Developed by: Adélie Linux Team
http://adelielinux.org/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal with the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject
to the following conditions:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimers.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimers in
the documentation and/or other materials provided with the distribution.
Neither the names of Adélie Linux, nor the names of its contributors, may
be used to endorse or promote products derived from this Software without
specific prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE.
=============================================
README for Adélie Linux Site Control System
=============================================
:Authors:
* **A. Wilcox**, author
* **Adélie Linux Developers and Users**, contributions
:Status:
Production
:Copyright:
© 2018 Adélie Linux Team. NCSA open source licence.
Introduction
============
This repository contains the Adélie Linux Site Control System. This software
is used to control the Adélie Linux Web server.
Changes
```````
Any changes to this repository must be reviewed before being pushed to the
master branch. For security-sensitive updates, contact the Security Team at
sec-bugs@adelielinux.org.
Contents
========
``githook.py``: GitLab hook listener
````````````````````````````````````
``githook.py`` listens for GitLab push events, and then manipulates the file
system to trigger ``site-control`` to perform the needed updates.
``main.cc``: Implementation for ``site-control``
````````````````````````````````````````````````
``site-control`` watches the file system to determine when to perform updates.
When triggered by ``githook.py``, ``site-control`` will pull changes from the
changed Git repository, and then (if necessary) rebuild the files.
Usage
=====
Run ``qmake`` (or ``qt5-qmake``) to generate a ``Makefile`` for
``site-control``. Then run ``make``.
``githook.py`` is typically run by a uWSGI process; the ini file is contained
in this directory as ``githook.ini``.
QT -= gui
CONFIG += c++11
TARGET = site-control
TEMPLATE = app
SOURCES = main.cc
[uwsgi]
chdir=/srv/www/adelie/control
module=githook:APP
master=True
pidfile=/run/lighttpd-githook.pid
vacuum=True
daemonize=/var/log/lighttpd/githook.log
http=127.0.0.1:65004
# uid= number of lighttpd
# gid= number of lighttpd
"""Tiny control server for keeping Adélie sites updated from Git.
This Web server listens on a custom port and receives two possible POST
requests from GitLab (or real-git-rcmp):
* /site_updated: site.git has been changed, update it
* /docs_updated: docs.git has been changed, update it
This Web server does not do any updating itself. It simply twiddles a file
that is being watched by another process, which does the actual heavy lifting.
"""
from flask import Flask
from pathlib import Path
APP = Flask(__name__)
"""The Flask app that we use."""
@APP.route('/site_updated', methods=('POST',))
def site_updated():
"""GitLab signal that site.git has one or more new commits."""
Path("/srv/www/adelie/.site_updated").touch()
return "OK"
@APP.route('/docs_updated', methods=('POST',))
def docs_updated():
"""GitLab signal that docs.git has one or more new commits."""
Path("/srv/www/adelie/.docs_updated").touch()
return "OK"
/*
* main.cc - implementation
* control, a collection of site control routines for
* Adélie Web Site
* Adélie Linux
*
* Copyright (c) 2018 Adélie Linux team. All rights reserved.
* License: NCSA
*/
#include <QCoreApplication>
#include <QFileSystemWatcher>
#include <QProcess>
#include <QtGlobal>
#ifndef SRV_PATH
# define SRV_PATH "/srv/www/adelie"
#endif
#define SITE_CHANGED SRV_PATH "/.site_updated"
#define DOCS_CHANGED SRV_PATH "/.docs_updated"
/*! Run `git pull --force` in the specified `dir`.
* \note This function blocks.
* \returns true if git worked, false otherwise.
*/
bool update_git(const QString &dir)
{
QProcess *process = new QProcess;
QStringList args;
bool success;
qDebug("git pull --force");
process->setWorkingDirectory(dir);
process->setProgram("/usr/bin/git");
args << "pull" << "--force";
process->setArguments(args);
process->start();
success = process->waitForFinished();
delete process;
return success;
}
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QFileSystemWatcher *watcher = new QFileSystemWatcher;
watcher->addPath(SITE_CHANGED);
watcher->addPath(DOCS_CHANGED);
QObject::connect(watcher, (void (QFileSystemWatcher:: *)(const QString&))&QFileSystemWatcher::fileChanged,
[=](const QString &path) {
if(path.compare(SITE_CHANGED) == 0) {
// site changed
qInfo("Updating site...");
if(!update_git("/srv/www/adelie")) {
qWarning("We appear to have failed to update the site.");
} else {
qInfo("Site updated.");
}
} else if(path.compare(DOCS_CHANGED) == 0) {
// docs changed
QProcess *process;
qInfo("Updating documentation...");
if(!update_git("/srv/www/docs")) {
qWarning("We appear to have failed to update docs.");
return;
}
process = new QProcess;
process->setWorkingDirectory("/srv/www/docs");
process->setProgram("/usr/bin/make");
process->start();
if(!process->waitForFinished()) {
qWarning("We appear to have failed to make new docs.");
delete process;
return;
}
delete process;
qInfo("Docs updated.");
} else {
qWarning("Unknown path was specified: ");
qWarning(path.toUtf8());
}
});
return app.exec();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment