Compare commits

..

No commits in common. "master" and "add-change-log" have entirely different histories.

9 changed files with 25 additions and 67 deletions

View File

@ -26,7 +26,8 @@ Deployed on:
* Bootstrap the application via [xppl/app.py](xppl/app.py).
* Added [Makefile](Makefile) targets for installing [RQLite](https://github.com/rqlite/rqlite).
* Run [isort](https://isort.readthedocs.io/en/latest/) and [pylava](https://github.com/pylava/pylava)
code audit tools over the source.
code audit tools over the source to use PEP 8 style, catch any erroneous
imports, unused variables etc. with some basic static analysis.
* Use a new [Hypothesis](https://web.hypothes.is/) API key.
### Fixed

View File

@ -7,7 +7,7 @@ The [XPUB] library living at [Varia].
[XPUB]: http://xpub.nl/
[Varia]: https://varia.zone/
# Run It Locally
# Change It
Please note, the following instructions have only been tested on the Debian Stretch OS.
@ -26,8 +26,6 @@ $ pipenv install --dev --three
$ pipenv run devserver
```
The local development web server will now be available.
If you need to check the database contents, run:
```bash
@ -58,11 +56,10 @@ The XPPL is made up of a few parts:
* The [Flask] application and it's dependencies.
* The [RQLite] database.
* The [Syncthing] integration for uploads.
* The [Nginx reverse proxy].
* The [Let's Encrypt web certificates].
* The Nginx reverse proxy.
* The Let's Encrypt web certificates.
If you know [Ansible](https://www.ansible.com/overview/how-ansible-works) (it's
just YAML), you can just [read the entire configuration].
If you know [Ansible] (it's just YAML), you can just [read the entire configuration].
On the varia.zone machine, you can check the running services with:
@ -88,7 +85,6 @@ No backups are configured right now.
[Flask]: http://flask.pocoo.org/
[RQLite]: https://github.com/rqlite/rqlite
[Syncthing]: https://docs.syncthing.net/
[Nginx reverse proxy]: https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
[Let's Encrypt web certificates]: https://certbot.eff.org/
[Syncthing UI]: https://vvvvvvaria.org/st/
[read the entire configuration]: ansible/plays/setup.yml
[read the entire configuration]: ansible/plays/main.yml
[Ansible]: https://www.ansible.com/overview/how-ansible-works

View File

@ -1,27 +1,14 @@
# XPPL Ansible Automation
An automated deployment for the XPPL. If you're running these scripts, you'll
need SSH access and Sudo permissions on the machines. It is already running
deployments for:
An automated deployment for the XPPL.
* [books.vvvvvvaria.org](https://books.vvvvvvaria.org/)
## Run It
## Prerequisites
You'll need to install [Ansible](https://docs.ansible.com).
You'll need to have SSH and Sudo access to [varia.zone] first.
```bash
$ sudo apt install -y ansible
$ ansible-playbook --ask-become-pass plays/main.yml
```
## Setup a New XPPL
```bash
$ ansible-playbook --limit varia.zone --ask-become-pass plays/setup.yml
```
## Deploy a New XPPL Version
```bash
$ ansible-playbook --limit varia.zone --ask-become-pass plays/deploy.yml
```
[varia.zone]: https://varia.zone/

View File

@ -1,2 +1,2 @@
[all]
[varia-zone]
varia.zone ansible_ssh_port=12345

View File

@ -1,23 +0,0 @@
---
# Just deploy a new version of the the XPPL.
# Depends on setup.yml being ran first to set things up.
- hosts: all
pre_tasks:
- name: Shutdown the running XPPL for the deployment.
become: true
supervisorctl:
name: 'xppl:'
state: stopped
roles:
- role: git # Clone the project source
- role: pipenv # Install Python dependencies
- role: env # Configure the application environment
- role: nginx # Setup the Nginx configuration
post_tasks:
- name: Start back up the XPPL after the deployment.
become: true
supervisorctl:
name: 'xppl:'
state: started

View File

@ -1,14 +1,11 @@
---
# Setup all necessary infrastructure for the project.
# Install the project and get it running under supervisor.
- hosts: all
- hosts: varia-zone
roles:
- role: perms # Setup users and groups
- role: git # Clone the project source
- role: pipenv # Install Python dependencies
- role: env # Configure the application environment
- role: env # Configure application environment
- role: rqlite # Install RQLite
- role: supervisor # Setup managed processes
- role: nginx # Setup the Nginx configuration
- role: nginx # Setup Nginx configuration

View File

@ -6,7 +6,7 @@ from flask import request
def get_annotations():
# TODO(decentral1se): remove this from the source
KEY = "6879-n8AksBoSB7kYoQ3eEwzpEr3nFQEmSp3XN-0PcKL_Sik"
KEY = "6879-H5GbA2KyFIeEUM1BubjVTLP8yM3GMyHgOAjjNe_GBxY"
# a dictionary containing necessary http headers
headers = {
@ -15,7 +15,7 @@ def get_annotations():
"Authorization": "Bearer %s" % KEY
}
base_url = "https://hypothes.is/api/search?user=xpub@hypothes.is"
base_url = "https://hypothes.is/api/search?user=varia_annotator@hypothes.is"
search_url = "".join([base_url])
@ -45,7 +45,7 @@ def get_annot_results(annot, name):
data = {
'text': item['text'],
'extract': item['target'][0]['selector'][2]['exact'],
'title': item['uri'][37:], 'url': item['uri']
'title': item['document']['title'], 'url': item['uri']
}
res.append(data)
else:
@ -54,7 +54,7 @@ def get_annot_results(annot, name):
data = {
'text': item['text'],
'extract': item['target'][0]['selector'][1]['exact'],
'title': item['uri'][37:], 'url': item['uri']
'title': item['document']['title'], 'url': item['uri']
}
res.append(data)
return res
@ -71,7 +71,7 @@ def get_annot_book(annot, name):
data = {
'text': item['text'],
'extract': item['target'][0]['selector'][2]['exact'],
'title': item['uri'][37:], 'url': item['uri']
'title': item['document']['title'], 'url': item['uri']
}
res.append(data)
else:
@ -80,7 +80,7 @@ def get_annot_book(annot, name):
data = {
'text': item['text'],
'extract': item['target'][0]['selector'][1]['exact'],
'title': item['uri'][37:], 'url': item['uri']
'title': item['document']['title'], 'url': item['uri']
}
res.append(data)
return res

View File

@ -11,7 +11,7 @@
{%for book in books%}
{%if book.file == row.uri%}
<p align="right" style="font-family:archivo narrow;font-size:10px;">Book</p>
<a href="books/{{book.id}}"><p align="right" style="font-family:archivo narrow;font-size:18px;">{{book.file}}</p></a><br>
<a href="books/{{book.id}}"><p align="right" style="font-family:archivo narrow;font-size:18px;">{{book.title}}</p></a><br>
{% endif %}
{% endfor %}

View File

@ -19,7 +19,7 @@
{% for book in stack.books %}
{% if loop.length >= 5 %}
{% if loop.index == 6 %}
<p style='color:red;'>Your stack is getting a little big. Proceed.</p>
<p style='color:red;'>Your stack is getting a little too big. Are these next books really relevant?</p>
<br>
<br>
{% endif %}