Skip to content

Commit

Permalink
Switch to Hugo site generator
Browse files Browse the repository at this point in the history
  • Loading branch information
cal0pteryx committed Sep 7, 2021
1 parent 7952165 commit de3d825
Show file tree
Hide file tree
Showing 257 changed files with 11,378 additions and 5,921 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.css diff=css
*.html diff=html
*.xhtml diff=html
*.py diff=python
*.md diff=markdown
8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
*.pid
.DS_Store
.project
.sass-cache/
.vagrant/
output/
bower_components
node_modules
content/extensions
resources/
public/
data/xeplist.json
34 changes: 20 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
language: python
dist: focal
cache: apt
language: python
python:
- "3.9"

notifications:
email: false

jobs:
include:
- python: 2.7
name: "Website Build"
- python: 3.7
name: "Data Linting"
env:
- HUGO_VERSION="0.80.0"

install:
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install pelican==3.3 ghp-import markdown; fi
- wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz
- tar xf hugo_${HUGO_VERSION}_Linux-64bit.tar.gz
- mv hugo ~/bin/
- hugo version
- pip3 install requests

script:
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/dist-packages; fi
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then make html; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.7 ]]; then ./data/lint-list.py clients.json; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.7 ]]; then ./data/lint-list.py servers.json; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.7 ]]; then ./data/lint-list.py libraries.json; fi
jobs:
include:
- stage: Prepare XEP list
script: python3 ./tools/prepare_xep_list.py
- stage: Software list linting
script: python3 ./tools/lint-list.py clients.json && python3 ./tools/lint-list.py servers.json && python3 ./tools/lint-list.py libraries.json
- stage: Generate pages
script: hugo
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# 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 AUTHORS 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 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

FROM debian
FROM debian:bullseye
MAINTAINER Dave Cridland <[email protected]>

# Set environment variables
Expand All @@ -20,7 +20,7 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get clean

# Install dependencies.
RUN apt-get install -y python-pip git && pip install pelican==3.3 markdown==2.6.11 ghp-import
RUN apt-get install -y hugo python3 python3-pip && pip3 install requests

# Build and copy in place.
WORKDIR /var/tmp/src/xmpp.org
Expand All @@ -29,5 +29,4 @@ RUN cd /var/tmp/src/xmpp.org && make publish

FROM nginx
COPY deploy/xsf.conf /etc/nginx/conf.d/default.conf
COPY --from=0 /var/tmp/src/xmpp.org/output/ /var/www/html/

COPY --from=0 /var/tmp/src/xmpp.org/public/ /var/www/html/
58 changes: 17 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
PY=python
PELICAN=pelican
PELICANOPTS=
PY=python3
HUGO=hugo

BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
OUTPUTDIR=$(BASEDIR)/output
CONFFILE=$(BASEDIR)/pelicanconf.py
PUBLISHCONF=$(BASEDIR)/publishconf.py
OUTPUTDIR=$(BASEDIR)/public
TOOLSDIR=$(BASEDIR)/tools

FTP_HOST=localhost
FTP_USER=anonymous
Expand All @@ -25,22 +23,14 @@ CLOUDFILES_CONTAINER=my_cloudfiles_container

DROPBOX_DIR=~/Dropbox/Public/

DEBUG ?= 0
ifeq ($(DEBUG), 1)
PELICANOPTS += -D
endif

help:
@echo 'Makefile for a pelican Web site '
@echo 'Makefile for a hugo web site '
@echo ' '
@echo 'Usage: '
@echo ' make html (re)generate the web site '
@echo ' make clean remove the generated files '
@echo ' make regenerate regenerate files upon modification '
@echo ' make publish generate using production settings '
@echo ' make serve [PORT=8000] serve site at http://localhost:8000'
@echo ' make devserver [PORT=8000] start/restart develop_server.sh '
@echo ' make stopserver stop local server '
@echo ' make serve serve site at http://localhost:1313'
@echo ' make ssh_upload upload the web site via SSH '
@echo ' make rsync_upload upload the web site via rsync+ssh '
@echo ' make dropbox_upload upload the web site via Dropbox '
Expand All @@ -49,39 +39,25 @@ help:
@echo ' make cf_upload upload the web site via Cloud Files'
@echo ' make github upload the web site via gh-pages '
@echo ' '
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
@echo ' '

html:
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
$(HUGO)

clean:
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)

regenerate:
$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)

serve:
ifdef PORT
cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)
else
cd $(OUTPUTDIR) && $(PY) -m pelican.server
endif

devserver:
ifdef PORT
$(BASEDIR)/develop_server.sh restart $(PORT)
else
$(BASEDIR)/develop_server.sh restart
endif

stopserver:
kill -9 `cat pelican.pid`
kill -9 `cat srv.pid`
@echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
$(PY) $(TOOLSDIR)/prepare_xep_list.py
$(HUGO) version
$(HUGO) server --bind=0.0.0.0

publish:
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
$(PY) $(TOOLSDIR)/prepare_xep_list.py
$(PY) $(TOOLSDIR)/lint-list.py clients.json
$(PY) $(TOOLSDIR)/lint-list.py servers.json
$(PY) $(TOOLSDIR)/lint-list.py libraries.json
$(HUGO) version
$(HUGO)

ssh_upload: publish
scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
Expand Down Expand Up @@ -113,4 +89,4 @@ ifeq ($(TRAVIS_PULL_REQUEST), false)
/tmp/xsf-tools/build.py -d -x /tmp/xeps -o /home/travis/build/xsf/xmpp.org/output/extensions --imagespath /tmp/xep-images
@git push -fq https://${GH_TOKEN}@github.com/$(TRAVIS_REPO_SLUG).git gh-pages > /dev/null
endif
.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github
.PHONY: html help clean serve publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github
3 changes: 1 addition & 2 deletions MakefileDocker
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ all:
docker build -t xmpp-org/latest .

serve:
docker run -p 8080:80 -t -i xmpp-org/latest

docker run -p 80:80 -t -i xmpp-org/latest
111 changes: 55 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,130 +1,129 @@
xmpp.org
========
[![Build Status](https://travis-ci.org/xsf/xmpp.org.png?branch=master)](https://travis-ci.org/xsf/xmpp.org)
# xmpp.org

[![Build Status](https://travis-ci.com/xsf/xmpp.org.png?branch=master)](https://travis-ci.com/xsf/xmpp.org)
[![Docker Build Status](https://img.shields.io/docker/cloud/build/xmppxsf/xmpp.org)](https://hub.docker.com/r/xmppxsf/xmpp.org/builds/)

Please log any [issues](https://github.com/xsf/xmpp.org/issues/new).

Contributing new content and updates
------------------------------------

## Contributing new content and updates

* Fork the [code](https://github.com/xsf/xmpp.org/fork) to your own git repository.
* Make your changes in `/content/pages` or [directly](https://github.com/xsf/xmpp.org/tree/master/content/pages) in GitHub.
* Make your changes in `/content` or [directly](https://github.com/xsf/xmpp.org/tree/master/content) in GitHub.
* When you are happy with your updates, submit a [pull request](https://github.com/xsf/xmpp.org/pulls) describing the changes.
* **IMPORTANT** :- Before sending a **Pull Request** make sure that your forked repo is in sync with the base repo.
* **IMPORTANT:** Before sending a **Pull Request** make sure that your forked repo is in sync with the base repo.
* The updates will be reviewed and merged in.

Communication forum
-------------------
## Communication forum

Please use [[email protected]](xmpp:[email protected]?join) for discussions about the site, content, generation etc.

Site generation
---------------
## Site generation

* Commits to the master branch generate a new build.
* Builds are visible at https://travis-ci.org/xsf/xmpp.org/builds
* Changes will be visible on http://xmpp.org after the next update
* Builds are visible at [Travis-CI](https://travis-ci.com/xsf/xmpp.org/builds)
* Changes will be visible on [xmpp.org](https://xmpp.org) after the next update

## Software Requirements

* Pelican 3.3
* ghp-import
* Markdown 2.3.1
* Hugo
* Python

## Gentle introduction to Pelican
## Introduction to Hugo

Pelican's [QUICKSTART](http://docs.getpelican.com/en/latest/quickstart.html) page is a good place to learn about the basics of Pelican (installation, project skeleton, development cycle, etc.).
Hugo’s [quickstart](https://gohugo.io/getting-started/quick-start/) page is a good place to learn about the basics of Hugo (installation, project skeleton, development cycle, etc.).

## Installation instructions
## Installation instructions

Two types of installations are documented: a regular one, and one that creates a virtual environment via Vagrant.
Multiple types of installations are documented:

* Local (regular)
* Docker container
* Vagrant virtual machine

### Regular installation

To run a development server on your local computer, follow these basic steps:

```bash
git clone ssh://[email protected]/xsf/xmpp.org.git
# install Pelican and dependencies
# install Hugo
cd xmpp.org
```

Running the server in development mode:
Running the server in development mode (reloads whenever a file is changed):

```bash
make serve
```

If you want the server to autoreload whenever a file change, you can instead do:
View at `http://localhost:1313`

### Docker-based installation

The Makefile will build the website completely by running:

```bash
make devserver
make -f MakefileDocker
```

View at `http://localhost:8000`

### Docker-based installation
It'll do the following:

The Makefile will build the website completely by running `make -f MakefileDocker`. It'll do
the following:
* Create a build Docker image (`make builder`) which is a development environment with a complete set of dependencies ready.

* Create a build Docker image (`make builder`) which is a development
environment with a complete set of dependencies ready.
* Run this docker image on the xmpp.org directory locally. This directory is presumed to contain a checked out repository for the website. (`make site`)

* Run this docker image on the xmpp.org directory locally. This directory
is presumed to contain a checked out repository for the website. (`make site`)
* From the newly created static files in `deploy/output`, it will then create a minimalist docker image to actually serve the website. (`make deployer`)

* From the newly created static files in `deploy/output`, it will then create
a minimalist docker image to actually serve the website. (`make deployer`)
For development convenience, you can run the website on port 80:

For development convenience, you can run the website on port 8080 by `make -f MakefileDocker serve`
```bash
make -f MakefileDocker serve
```

### Vagrant-based installation

For your convenience, this repository ships with a basic Vagrantfile, which allows you to create virtual machine with all the dependencies required for local development.

Assuming your computer has [Vagrant](https://www.vagrantup.com/) installed, the following will get you a running server:

```bash
git clone ssh://[email protected]/xsf/xmpp.org.git
cd xmpp.org
vagrant up
vagrant ssh
cd /vagrant/
make devserver
make serve
```

Now, the wesite should be available at `http://localhost:8000`
Now, the website should be available at `http://localhost:1313`

## Configuration

```
<repo>
Dockerfile
fabfile.py
develop_server.sh
MakefileDocker
Makefile
README.md
pelicanconf.py (development configuration)
publishconf.py (production configuration)
output
<generated files - published to gh-pages branch>
public
<generated files>
content
pages
<website page files>
pelican-bootstrap3
<website page files>
themes
<website theme>
```

## Site generation
## Local site generation

To just generate a new version (without starting up a local webserver) just do:

`make html`


Theme development
-----------------
```bash
make publish
```

You can modify the theme (layout and styling) in the [xmpp.org-theme](https://github.com/xsf/xmpp.org/tree/master/xmpp.org-theme/sass) directory.
Pages will be available in the /public folder.

Make changes to Sass files, *not* compiled CSS.
## Theme development

`npm i` then run `grunt` to compile Sass.
You can directly modify the theme (layout and styling) in the [themes/xmpp.org](https://github.com/xsf/xmpp.org/tree/master/themes/xmpp.org/static/css/) directory.
Loading

0 comments on commit de3d825

Please sign in to comment.