Get some new READMEs in place. Add Ansible placeholder.
This commit is contained in:
parent
416dfc2cef
commit
d9d00aab93
82
README.md
82
README.md
@ -1,77 +1,23 @@
|
|||||||
# XPUB Library
|
# Varia's XPPL
|
||||||
Library running on Flask and SQLight (maybe to be replaced with a python shelve)
|
|
||||||
|
|
||||||
requirements.txt
|
The [XPUB] library living at [Varia].
|
||||||
$ pip3 install -r requirements.txt
|
|
||||||
|
|
||||||
install rqlite
|
> https://books.vvvvvvaria.org/
|
||||||
install pyrqlite
|
|
||||||
install sqlalchemy-rqlite
|
|
||||||
|
|
||||||
initialize rqlite database
|
[XPUB]: http://xpub.nl/#0/-128/128
|
||||||
$ ./rqlited ~.node
|
[Varia]: https://varia.zone/
|
||||||
|
|
||||||
initialise database
|
# Hack It
|
||||||
$ bash init_db.sh
|
|
||||||
|
|
||||||
run script
|
Install [Pipenv] and then run the development server with:
|
||||||
python3 run.py
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pipenv install --dev --three
|
||||||
|
$ pipenv run dev
|
||||||
|
```
|
||||||
|
|
||||||
## API
|
[Pipenv]: https://pipenv.readthedocs.io/en/latest/install/#pragmatic-installation-of-pipenv
|
||||||
|
|
||||||
has currently 2 entrypoints:
|
# Deploy It
|
||||||
|
|
||||||
/api/books
|
|
||||||
GETs all the books in the database
|
|
||||||
|
|
||||||
/api/book/id
|
|
||||||
GETs a specific book by its id
|
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
Further installnotes (bugs)
|
|
||||||
|
|
||||||
* create the covers folder inside the uploadsfolder
|
|
||||||
* don't forget to chmod the uploads and coverfolder ;-)
|
|
||||||
|
|
||||||
* For Macusers -> brew install imagemagick@6 in order to install wand
|
|
||||||
|
|
||||||
For those on mac and using homebrew, it seems like Wand doesn't support imagemagick 7 yet as mentioned in other answers.
|
|
||||||
There's a new brew formula for Imagemagick 6 which can be used to install the older version in the meanwhile:
|
|
||||||
brew install imagemagick@6
|
|
||||||
Create a symlink to this newly installed dylib file as mentioned in other answer to get things working.
|
|
||||||
ln -s /usr/local/Cellar/imagemagick@6/<your specific 6 version>/lib/libMagickWand-6.Q16.dylib /usr/local/lib/libMagickWand.dylib
|
|
||||||
|
|
||||||
|
|
||||||
## install rqlite
|
|
||||||
|
|
||||||
### Linux
|
|
||||||
To download and start rqlite on Linux, execute the following in a shell.
|
|
||||||
|
|
||||||
curl -L https://github.com/rqlite/rqlite/releases/download/v4.3.0/rqlite-v4.3.0-linux-amd64.tar.gz -o rqlite-v4.3.0-linux-amd64.tar.gz
|
|
||||||
tar xvfz rqlite-v4.3.0-linux-amd64.tar.gz
|
|
||||||
cd rqlite-v4.3.0-linux-amd64
|
|
||||||
./rqlited ~/node.1
|
|
||||||
|
|
||||||
### OSX
|
|
||||||
To download and start rqlite on OSX, execute the following in a shell.
|
|
||||||
|
|
||||||
curl -L https://github.com/rqlite/rqlite/releases/download/v4.3.0/rqlite-v4.3.0-darwin-amd64.tar.gz -o rqlite-v4.3.0-darwin-amd64.tar.gz
|
|
||||||
tar xvfz rqlite-v4.3.0-darwin-amd64.tar.gz
|
|
||||||
cd rqlite-v4.3.0-darwin-amd64
|
|
||||||
./rqlited ~/node.1
|
|
||||||
|
|
||||||
|
|
||||||
## install pyrqlite
|
|
||||||
|
|
||||||
git clone https://github.com/rqlite/pyrqlite.git
|
|
||||||
pip install ./pyrqlite
|
|
||||||
|
|
||||||
|
|
||||||
## install sqlalchemy-rqlite
|
|
||||||
|
|
||||||
git clone https://github.com/rqlite/sqlalchemy-rqlite.git
|
|
||||||
cd sqlalchemy-rqlite
|
|
||||||
sudo python3 ./setup.py install
|
|
||||||
|
|
||||||
|
See [ansible/README.md](ansible/README.md) for this.
|
||||||
|
24
ansible/README.md
Normal file
24
ansible/README.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# XPPL Ansible Automation
|
||||||
|
|
||||||
|
An automated deployment for the XPPL.
|
||||||
|
|
||||||
|
## Run It
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
[varia.zone]: https://varia.zone/
|
||||||
|
|
||||||
|
## What Does It Do?
|
||||||
|
|
||||||
|
* Clone the Python application into `/var/xppl/`.
|
||||||
|
* Get the RQLite database running managed under [Supervisord].
|
||||||
|
* Run the [Gunicorn] WSGI server to server the Python application.
|
||||||
|
* Proxy the WSGI server with an NGINX configuration.
|
||||||
|
|
||||||
|
[Gunicorn]: https://gunicorn.org/
|
||||||
|
[Supervisord]: http://supervisord.org/introduction.html#features
|
12
ansible/ansible.cfg
Normal file
12
ansible/ansible.cfg
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[defaults]
|
||||||
|
forks=10
|
||||||
|
internal_poll_interval=0.004
|
||||||
|
inventory=inventory
|
||||||
|
roles_path=roles
|
||||||
|
|
||||||
|
[privilege_escalation]
|
||||||
|
become=False
|
||||||
|
become_method=sudo
|
||||||
|
|
||||||
|
[ssh_connection]
|
||||||
|
pipelining=True
|
5
ansible/inventory
Normal file
5
ansible/inventory
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[dev]
|
||||||
|
localhost ansible_connection=local
|
||||||
|
|
||||||
|
[prod]
|
||||||
|
varia.zone ansible_ssh_port=12345
|
5
ansible/plays/main.yml
Normal file
5
ansible/plays/main.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- hosts: prod
|
||||||
|
roles:
|
||||||
|
- role: xppl
|
13
ansible/roles/xppl/.yamllint
Normal file
13
ansible/roles/xppl/.yamllint
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends: default
|
||||||
|
|
||||||
|
rules:
|
||||||
|
braces:
|
||||||
|
max-spaces-inside: 1
|
||||||
|
level: error
|
||||||
|
brackets:
|
||||||
|
max-spaces-inside: 1
|
||||||
|
level: error
|
||||||
|
line-length: disable
|
||||||
|
# NOTE(retr0h): Templates no longer fail this lint rule.
|
||||||
|
# Uncomment if running old Molecule templates.
|
||||||
|
# truthy: disable
|
48
ansible/roles/xppl/README.md
Normal file
48
ansible/roles/xppl/README.md
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
A brief description of the role goes here.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
Any pre-requisites that may not be covered by Ansible itself or the role should
|
||||||
|
be mentioned here. For instance, if the role uses the EC2 module, it may be a
|
||||||
|
good idea to mention in this section that the boto package is required.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
A description of the settable variables for this role should go here, including
|
||||||
|
any variables that are in defaults/main.yml, vars/main.yml, and any variables
|
||||||
|
that can/should be set via parameters to the role. Any variables that are read
|
||||||
|
from other roles and/or the global scope (ie. hostvars, group vars, etc.) should
|
||||||
|
be mentioned here as well.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
A list of other roles hosted on Galaxy should go here, plus any details in
|
||||||
|
regards to parameters that may need to be set for other roles, or variables that
|
||||||
|
are used from other roles.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables
|
||||||
|
passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { role: xppl, x: 42 }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
An optional section for the role authors to include contact information, or a
|
||||||
|
website (HTML is not allowed).
|
1
ansible/roles/xppl/defaults/main.yml
Normal file
1
ansible/roles/xppl/defaults/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
---
|
1
ansible/roles/xppl/handlers/main.yml
Normal file
1
ansible/roles/xppl/handlers/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
---
|
10
ansible/roles/xppl/meta/main.yml
Normal file
10
ansible/roles/xppl/meta/main.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
galaxy_info:
|
||||||
|
author: decentral1se
|
||||||
|
description: Ansible automation for the XPPL.
|
||||||
|
license: GPLv3
|
||||||
|
min_ansible_version: 2.7.2
|
||||||
|
galaxy_tags: []
|
||||||
|
|
||||||
|
dependencies: []
|
9
ansible/roles/xppl/molecule/default/Dockerfile.j2
Normal file
9
ansible/roles/xppl/molecule/default/Dockerfile.j2
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Molecule managed
|
||||||
|
|
||||||
|
{% if item.registry is defined %}
|
||||||
|
FROM {{ item.registry.url }}/{{ item.image }}
|
||||||
|
{% else %}
|
||||||
|
FROM {{ item.image }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean
|
26
ansible/roles/xppl/molecule/default/molecule.yml
Normal file
26
ansible/roles/xppl/molecule/default/molecule.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
dependency:
|
||||||
|
name: galaxy
|
||||||
|
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
|
||||||
|
lint:
|
||||||
|
name: yamllint
|
||||||
|
|
||||||
|
platforms:
|
||||||
|
- name: instance
|
||||||
|
image: debian:stretch
|
||||||
|
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
lint:
|
||||||
|
name: ansible-lint
|
||||||
|
|
||||||
|
scenario:
|
||||||
|
name: default
|
||||||
|
|
||||||
|
verifier:
|
||||||
|
name: testinfra
|
||||||
|
lint:
|
||||||
|
name: flake8
|
6
ansible/roles/xppl/molecule/default/playbook.yml
Normal file
6
ansible/roles/xppl/molecule/default/playbook.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- role: xppl
|
8
ansible/roles/xppl/tasks/main.yml
Normal file
8
ansible/roles/xppl/tasks/main.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
# create /var/xppl
|
||||||
|
# clone the latest source there
|
||||||
|
# get supervisord installed
|
||||||
|
# get the rqlite database setup with supervisor
|
||||||
|
# get the nginx certificate in place
|
||||||
|
# run the gunicorn server
|
1
ansible/roles/xppl/vars/main.yml
Normal file
1
ansible/roles/xppl/vars/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
---
|
Loading…
Reference in New Issue
Block a user