Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:gap-system/GapWWW into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
schnellecom committed Mar 14, 2024
2 parents 467ca38 + f2e0f4b commit 6eb62fa
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 191 deletions.
48 changes: 0 additions & 48 deletions Doc/Bib/MSC/msc.html

This file was deleted.

33 changes: 0 additions & 33 deletions Doc/Bib/Year/year.html

This file was deleted.

2 changes: 1 addition & 1 deletion Doc/Bib/bib.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Bibliography
layout: core
parent: Documentation
has_children: true
has_children: false
---

<p>
Expand Down
73 changes: 0 additions & 73 deletions Doc/Bib/statistics.html

This file was deleted.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ feel you have need to directly access the server via SSH, contact him.
- `www-gap-systems``www.gap-system.org`
- `www-gap-docs``docs.gap-system.org`
- `www-gap-files``files.gap-system.org`
- SSH hostname: `www-admin12.rz.rptu.de`
- Login:
- `www-gap-dev``dev.gap-system.org`

Please consult `etc/README.server.md` for more information.

Expand Down
50 changes: 25 additions & 25 deletions etc/README.server.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ To ensure the required software is installed on the server, run this

The server can be reached via SSH:

ssh www-gap-systems@www-admin11.uni-kl.de
ssh www-gap-dev@www-admin12.rz.rptu.de

The website is update from a git clone of the website repository at

/srv/www/www-gap-systems/data/GapWWW
/srv/www/www-gap-dev/data/GapWWW

This clone is owned by user `www-gap-systems` and group `www-gap-systems`. If anything goes
This clone is owned by user `www-gap-dev` and group `www-gap-dev`. If anything goes
wrong with these permissions, they can be fixed via

chown -R www-gap-systems:www-gap-systems /srv/www/www-gap-systems/data/GapWWW
chown -R www-gap-dev:www-gap-dev /srv/www/www-gap-dev/data/GapWWW

## Automatic updates via webhook

Expand All @@ -33,7 +33,7 @@ repository, GitHub activates a webhook we provide via `webhook.php` at
<https://www.gap-system.org/webhook.php>.

The crucial bit is at the end of this .php file, where an empty file
`/srv/www/www-gap-systems/data/gap-website.trigger` is created. This is detected by a
`/srv/www/www-gap-dev/data/gap-website.trigger` is created. This is detected by a
systemd unit `~/.config/systemd/user/gap-website.path` (a copy of this file is
in the `etc` directory of the website repository).

Expand All @@ -43,7 +43,7 @@ This then triggers `~/.config/systemd/user/gap-website.service`
This finally executes `etc/update.sh`, which runs jekyll.


For authentication, we set a secret token in `/srv/www/www-gap-systems/data/webhook.secret`
For authentication, we set a secret token in `/srv/www/www-gap-dev/data/webhook.secret`
which looks like this:

SetEnv GITHUB_WEBHOOK_SECRET "MY_SECRET"
Expand All @@ -66,7 +66,7 @@ This prints a log with extra info. However, it might also say "service not
found". In that case, make sure that `gap-website.service` and
`gap-website.path` are installed and enabled:

cp /srv/www/www-gap-systems/data/GapWWW/etc/gap-website.* ~/.config/systemd/user
cp /srv/www/www-gap-dev/data/GapWWW/etc/gap-website.* ~/.config/systemd/user
systemctl --user enable gap-website.service gap-website.path

Also helpful is to study the log for the relevant systemd units
Expand All @@ -78,12 +78,12 @@ clone) are broken file permissions which can impede further operations, such
as git pulling updates or jekyll updating the website. To fix these, run the
following as root:

chown -R www-gap-systems:www-gap-systems /srv/www/www-gap-systems/data/GapWWW
chown -R www-gap-systems:www-gap-systems /srv/www/www-gap-systems/data/http
chown -R www-gap-dev:www-gap-dev /srv/www/www-gap-dev/data/GapWWW
chown -R www-gap-dev:www-gap-dev /srv/www/www-gap-dev/data/http

touch /srv/www/www-gap-systems/data/gap-website.trigger
chown www-gap-systems:www-gap-systems /srv/www/www-gap-systems/data/gap-website.trigger
chmod 0664 /srv/www/www-gap-systems/data/gap-website.trigger
touch /srv/www/www-gap-dev/data/gap-website.trigger
chown www-gap-dev:www-gap-dev /srv/www/www-gap-dev/data/gap-website.trigger
chmod 0664 /srv/www/www-gap-dev/data/gap-website.trigger


## Initial setup / what if the server VM is upgraded
Expand All @@ -99,35 +99,35 @@ following as root:

## Further steps as `root`

1. Set up a user `www-gap-systems` in group `www-gap-systems`
1. Set up a user `www-gap-dev` in group `www-gap-dev`

2. Set up an Apache2 site with data in `/srv/www/www-gap-systems/data/http/` (or modify the units
here for alternate locations); ensure `www-gap-systems` owns it, i.e.
2. Set up an Apache2 site with data in `/srv/www/www-gap-dev/data/http/` (or modify the units
here for alternate locations); ensure `www-gap-dev` owns it, i.e.

chown -R www-gap-systems:www-gap-systems /srv/www/www-gap-systems/data/http
chown -R www-gap-dev:www-gap-dev /srv/www/www-gap-dev/data/http

In the config for that site, make sure to set `GITHUB_WEBHOOK_SECRET` as described
elsewhere in this file, and enable PHP.
Of course also set up SSL/TLS and a scheme to update the certificates.

3. Activate systemd user units:

loginctl enable-linger www-gap-systems
loginctl enable-linger www-gap-dev

## Further steps as `www-gap-systems`
## Further steps as `www-gap-dev`

As `www-gap-systems:www-gap-systems` (`sudo -u www-gap-systems -g www-gap-systems bash`):
As `www-gap-dev:www-gap-dev` (`sudo -u www-gap-dev -g www-gap-dev bash`):

In the `www-gap-systems` home directory add a clone of the `GapWWW` git repository, i.e.,
in `/srv/www/www-gap-systems/data/GapWWW` (otherwise adjust `gap-website.service`). Also do
In the `www-gap-dev` home directory add a clone of the `GapWWW` git repository, i.e.,
in `/srv/www/www-gap-dev/data/GapWWW` (otherwise adjust `gap-website.service`). Also do

touch /srv/www/www-gap-systems/data/gap-website.trigger
chown www-gap-systems:www-gap-systems /srv/www/www-gap-systems/data/gap-website.trigger
chmod 0644 /srv/www/www-gap-systems/data/gap-website.trigger
touch /srv/www/www-gap-dev/data/gap-website.trigger
chown www-gap-dev:www-gap-dev /srv/www/www-gap-dev/data/gap-website.trigger
chmod 0644 /srv/www/www-gap-dev/data/gap-website.trigger

Next install and activate the systemd units:

cp /srv/www/www-gap-systems/data/GapWWW/etc/gap-website.* ~/.config/systemd/user/
cp /srv/www/www-gap-dev/data/GapWWW/etc/gap-website.* ~/.config/systemd/user/
systemctl --user enable gap-website.service gap-website.path
systemctl --user start gap-website.service gap-website.path

Expand Down
2 changes: 1 addition & 1 deletion etc/gap-website.path
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Description="Check whether GAP webhook requested update"

[Path]
PathChanged=/srv/www/www-gap-systems/data/gap-website.trigger
PathChanged=/srv/www/www-gap-dev/data/gap-website.trigger
Unit=gap-website.service

[Install]
Expand Down
4 changes: 2 additions & 2 deletions etc/gap-website.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Description="Update GAP website"

[Service]
Type=oneshot
ExecStart=/srv/www/www-gap-systems/data/GapWWW/etc/update.sh
WorkingDirectory=/srv/www/www-gap-systems/data/GapWWW/
ExecStart=/srv/www/www-gap-dev/data/GapWWW/etc/update.sh
WorkingDirectory=/srv/www/www-gap-dev/data/GapWWW/

[Install]
WantedBy=default.target
8 changes: 4 additions & 4 deletions etc/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
set -e

# fetch latest changes
cd /srv/www/www-gap-systems/data/GapWWW
cd /srv/www/www-gap-dev/data/GapWWW
git fetch --all --prune
git checkout --force dev
git reset --hard origin/dev

# add webhook secret
cat /srv/www/www-gap-systems/data/webhook.secret >> .htaccess
cat /srv/www/www-gap-dev/data/webhook.secret >> .htaccess

# install gems
bundle config set --local path 'vendor/bundle'
bundle install

# run jekyll
bundle exec jekyll build -d /srv/www/www-gap-systems/data/http
bundle exec jekyll build -d /srv/www/www-gap-dev/data/http

# ensure symlinks exist
cd /srv/www/www-gap-systems/data/http
cd /srv/www/www-gap-dev/data/http
ln -sf ../ForumArchive
ln -sf ../ForumArchive2
3 changes: 1 addition & 2 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ emphasis on
GAP provides a {% include ref.html label="The Programming Language"
text="programming language" %}, a library of thousands of functions
implementing algebraic algorithms written in the GAP language as well as
large
[data libraries]({{ site.baseurl }}/Datalib/datalib.html) of
large data libraries of
algebraic objects. See
[here]({{ site.baseurl }}/Overview/overview.html) for details of the mathematical capabilities.
The system, including source, is distributed
Expand Down
4 changes: 2 additions & 2 deletions webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
This finally executes `etc/update.sh`, which runs jekyll.
*/
$triggerfile = "/srv/www/www-gap-systems/data/gap-website.trigger";
$triggerfile = "/srv/www/www-gap-dev/data/gap-website.trigger";

/*
We set a secret token by adding a line of the form
SetEnv GITHUB_WEBHOOK_SECRET "MY_SECRET"
to the file /srv/www/www-gap-systems/data/webhook.secret
to the file /srv/www/www-gap-dev/data/webhook.secret
with the actual secret key taking the place of MY_SECRET.
The same value must be entered in the GitHub webhook settings.
*/
Expand Down

0 comments on commit 6eb62fa

Please sign in to comment.