Merge branch 'modularize-ansible-roles'
This commit is contained in:
commit
9e1cc2fb90
|
@ -1,8 +1,8 @@
|
|||
.idea/
|
||||
vagrant/.vagrant/
|
||||
vagrant/hosts_vagrant
|
||||
vagrant/playbooks/*.retry
|
||||
vagrant/playbooks/extern_roles/
|
||||
vagrant/*.retry
|
||||
vagrant/external_ansible_roles/
|
||||
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
|
|
File diff suppressed because it is too large
Load Diff
13
package.json
13
package.json
|
@ -22,16 +22,15 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"chai": "1.9.2",
|
||||
"mocha": "2.0.1",
|
||||
"sinon-chai": "2.7.0",
|
||||
"react-tools": "0.13.3",
|
||||
"rewireify": "0.2.1",
|
||||
"karma": "0.12.24",
|
||||
"karma-browserify": "4.1.2",
|
||||
"karma-browserify": "^5.0.5",
|
||||
"karma-chai": "0.1.0",
|
||||
"karma-phantomjs-launcher": "0.1.4",
|
||||
"karma-mocha": "0.1.9",
|
||||
"karma-coverage": "0.2.6",
|
||||
"karma-mocha": "^1.0.1",
|
||||
"karma-phantomjs-launcher": "^1.0.0",
|
||||
"mocha": "^2.4.5",
|
||||
"rewireify": "0.2.1",
|
||||
"sinon-chai": "2.7.0",
|
||||
"watchify": "3.2.2"
|
||||
},
|
||||
"repository": {
|
||||
|
|
52
readme.md
52
readme.md
|
@ -6,9 +6,59 @@ A developer and designer friendly web platform for building gorgeous blogs and p
|
|||
|
||||
- Powered by Python on the server side using Flask and CouchDB.
|
||||
- Uses React, Reflux, CoffeeScript and LESS to build responsive single page apps.
|
||||
- Licensed under the Affero GNU Genearal Public License (AGPL) version 3.0.
|
||||
- Licensed under the Affero GNU General Public License (AGPL) version 3.0.
|
||||
- Heavily inspired by the [Ghost blogging platform](https://ghost.org/about/).
|
||||
|
||||
**Status**
|
||||
|
||||
- Builds: [ ](https://codeship.com/projects/77461)
|
||||
|
||||
## Installation
|
||||
|
||||
*Rookeries* is heavily under development and once things stabilize there will be a user friendly installation guide.
|
||||
In the meantime, please refer to the development guide below.
|
||||
|
||||
## Development
|
||||
|
||||
*Rookeries* uses the following technologies:
|
||||
- Python
|
||||
- NodeJS
|
||||
- CoffeeScript
|
||||
- GCC (for compiling some dependencies)
|
||||
|
||||
Make sure you have the following installed and setup before continuing:
|
||||
- git
|
||||
- pip
|
||||
- virtualenv
|
||||
- npm
|
||||
|
||||
comfortable using the bash shell on Linux or Mac OS X. (Window users should install bash using
|
||||
[cygwin](http://cygwin.com/) or the Windows App store.)
|
||||
|
||||
For development and deployment you'll also need [Vagrant](https://www.vagrantup.com/) and
|
||||
[Ansible](http://ansible.com/).
|
||||
|
||||
### Getting Started
|
||||
|
||||
1. Clone this repository: `git clone https://bitbucket.org/dorianpula/rookeries.git`
|
||||
1. Create a virtualenv and source it: `virtualenv rookeries && source rookeries/bin/activate`
|
||||
1. Install the Python/PIP dependencies: `pip install -r requirement/development.txt`
|
||||
- *Ubuntu Linux*: You may need to install via `apt-get install` the following dependencies:
|
||||
- python-dev
|
||||
- libffi-dev
|
||||
- libssl-dev
|
||||
1. Install the Node/NPM dependencies: `npm install`
|
||||
1. Install the global Node/NPM dependencies: `npm install -g coffee-script browserify less karma-cli`
|
||||
1. Run the invoke build script to run the application: `inv server.run`
|
||||
1. Navigate to the main Rookeries page in a browser: [http://localhost:5000/](http://localhost:5000/)
|
||||
|
||||
Use `inv -l` to list all the available commands.
|
||||
|
||||
### Test Deployment
|
||||
|
||||
You can also test the deployment of *Rookeries* to local server. You'll need to install to have
|
||||
[Vagrant](https://www.vagrantup.com/). [Ansible](http://ansible.com/) should be installed in your virtualenv if
|
||||
you followed the instructions above.
|
||||
|
||||
1. Install the Rookeries to a local Vagrant box with: `inv vagrant.install`
|
||||
1. The application will be accessible via port 8080 locally: [http://localhost:8080/](http://localhost:8080/)
|
||||
|
|
|
@ -19,7 +19,9 @@ pytest-bdd>=2.15.0
|
|||
pytest-splinter>=1.7.0
|
||||
|
||||
# Deployment and Automation
|
||||
ansible>=1.8.0,<2.0.0
|
||||
ansible>=2.0.0.0,<2.1.0
|
||||
#http://releases.ansible.com/ansible/ansible-2.1.0.0-0.1.rc1.tar.gz
|
||||
#-e git+git://github.com/ansible/ansible.git@devel#egg=ansible
|
||||
ansible-vagrant>=1.2.1
|
||||
invoke==0.11.1
|
||||
virtualenv>=1.11.0
|
||||
|
|
|
@ -37,7 +37,7 @@ def package(ctx, add_date_suffix=False, package_suffix=''):
|
|||
ctx.run('ln -s ../package.json {}/package.json'.format(packaging_dir))
|
||||
|
||||
ctx.run('tar zcvhf {} {}'.format(deployable_package, packaging_dir), echo=True)
|
||||
ctx['deployable'] = pathlib.Path(deployable_package).absolute()
|
||||
ctx['deployable'] = pathlib.Path(deployable_package)
|
||||
|
||||
|
||||
def generate_package_name(add_date_suffix=False, pkg_suffix=''):
|
||||
|
|
|
@ -5,6 +5,8 @@ Tasks for working with a vagrant installation for testing and development.
|
|||
:license: AGPL v3+
|
||||
"""
|
||||
|
||||
import pathlib
|
||||
|
||||
import invoke as inv
|
||||
from invoke import tasks
|
||||
|
||||
|
@ -39,7 +41,7 @@ def recreate(nuke_the_box=False):
|
|||
def install(ctx, verbose=0):
|
||||
"""Provision the vagrant box and deploy the Rookeries on the box."""
|
||||
install_ansible_roles()
|
||||
run_ansible_vagrant_playbook('playbooks/provision.yaml', verbose, deployable=ctx.get('deployable'))
|
||||
run_ansible_vagrant_playbook('provision.yaml', verbose, deployable=ctx.get('deployable'))
|
||||
|
||||
|
||||
def generate_verbosity_tag(verbosity=0):
|
||||
|
@ -51,7 +53,9 @@ def generate_verbosity_tag(verbosity=0):
|
|||
def run_ansible_vagrant_playbook(playbook, verbose, deployable=None):
|
||||
options = generate_verbosity_tag(verbose)
|
||||
if deployable:
|
||||
options += ' --extra-vars "rookeries_package_path={}"'.format(deployable)
|
||||
deploy_source = deployable.name.replace('.tar.bz2', '')
|
||||
options += ' --extra-vars "rookeries_deploy_source={} rookeries_package_path={} rookeries_"'.format(
|
||||
deploy_source, deployable.absolute())
|
||||
ansible_cmd = 'ansible-playbook-vagrant {playbook} {extra_opts}'.format(playbook=playbook, extra_opts=options)
|
||||
|
||||
with utils.cd('vagrant'):
|
||||
|
@ -60,10 +64,27 @@ def run_ansible_vagrant_playbook(playbook, verbose, deployable=None):
|
|||
|
||||
|
||||
def install_ansible_roles():
|
||||
ANSIBLE_ROLE_PATH = '--roles-path=playbooks/extern_roles/'
|
||||
ANSIBLE_ROOKERIES_SCM = 'git+https://bitbucket.org/dorianpula/ansible-rookeries'
|
||||
EXTERNAL_ROLES_PATH = 'external_ansible_roles'
|
||||
ANSIBLE_ROLE_PATH_PARAM = '--roles-path={}'.format(EXTERNAL_ROLES_PATH)
|
||||
DEPENDENT_ROLES = {
|
||||
'rookeries': 'breakout-nodejs-role',
|
||||
'uwsgi-nginx-supervisor': 'split-out-nginx-supervisor-role',
|
||||
'nginx-supervisor': 'split-out-nginx-supervisor-role',
|
||||
'nodejs': 'master',
|
||||
}
|
||||
|
||||
with utils.cd('vagrant'):
|
||||
listing_result = inv.run('ansible-galaxy list {}'.format(ANSIBLE_ROLE_PATH))
|
||||
if 'ansible-rookeries' not in listing_result.stdout:
|
||||
inv.run('ansible-galaxy install {} {}'.format(ANSIBLE_ROLE_PATH, ANSIBLE_ROOKERIES_SCM))
|
||||
external_role_folder = pathlib.Path(EXTERNAL_ROLES_PATH)
|
||||
if not external_role_folder.exists():
|
||||
external_role_folder.mkdir()
|
||||
listing_result = inv.run('ansible-galaxy list {}'.format(ANSIBLE_ROLE_PATH_PARAM))
|
||||
|
||||
# if 'rookeries' not in listing_result.stdout:
|
||||
# TODO Fix once either ansible galaxy 2.1.0 works properly or role changes merged into master branches.
|
||||
# TODO See https://github.com/ansible/ansible/pull/10620 & https://github.com/ansible/ansible/issues/10477
|
||||
# inv.run('ansible-galaxy install {} -r role_requirements.yml'.format(ANSIBLE_ROLE_PATH_PARAM))
|
||||
|
||||
for (role, branch) in DEPENDENT_ROLES.items():
|
||||
if role not in listing_result.stdout:
|
||||
git_cmd = 'git clone --branch {branch} https://bitbucket.org/dorianpula/ansible-{role} {path}/{role}'
|
||||
inv.run(git_cmd.format(branch=branch, role=role, path=EXTERNAL_ROLES_PATH))
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[defaults]
|
||||
roles_path = playbooks/extern_roles
|
||||
roles_path = external_ansible_roles
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
- hosts: all
|
||||
sudo: yes
|
||||
roles:
|
||||
- role: ansible-rookeries
|
||||
rookeries_package: rookeries-0.5.0-alpha.tar.bz2
|
||||
rookeries_package_path: "../../{{ rookeries_package }}"
|
||||
rookeries_deploy_source: rookeries-0.5.0-alpha
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
- hosts: all
|
||||
sudo: yes
|
||||
roles:
|
||||
- role: rookeries
|
||||
rookeries_deploy_source: rookeries-0.5.0-alpha
|
||||
rookeries_package: "{{ rookeries_deploy_source }}.tar.bz2"
|
||||
rookeries_package_path: "../{{ rookeries_package }}"
|
|
@ -0,0 +1,4 @@
|
|||
- src: https://bitbucket.org/dorianpula/ansible-rookeries
|
||||
scm: git
|
||||
name: rookeries
|
||||
version: "breakout-nodejs-role"
|
Loading…
Reference in New Issue