Skip to content

Commit fa7e4f9

Browse files
Merge pull request #280 from LibCrowds/dev
v1.0.0-beta.1
2 parents 00a2d80 + 1bf3e2b commit fa7e4f9

37 files changed

+836
-1489
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ selenium-debug.log
1010
src/siteConfig.js
1111
src/custom/*
1212
deploy-key
13+
_book/*

README.md

Lines changed: 5 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -1,162 +1,12 @@
11
# vue-pybossa-frontend
22

3-
[![forthebadge](http://forthebadge.com/images/badges/gluten-free.svg)](http://forthebadge.com)
4-
[![forthebadge](http://forthebadge.com/images/badges/built-with-science.svg)](http://forthebadge.com)
3+
[![Build Status](https://travis-ci.org/LibCrowds/vue-pybossa-frontend.svg?branch=master)](https://travis-ci.org/LibCrowds/vue-pybossa-frontend)
4+
[![DOI](https://zenodo.org/badge/92406558.svg)](https://zenodo.org/badge/latestdoi/92406558)
55

66
> A Vue.js frontend for PyBossa (>=2.6.1).
77
8-
This frontend to PyBossa is a little different in that meta-categories can be
9-
defined to more easily group together large groups of similar projects. For
10-
example, on the [LibCrowds](www.libcrowds.com) site we define a meta-category for
11-
two of our major projects, *Convert-a-Card* and *In the Spotlight*.
12-
13-
Each meta-category is presented as if it were a separate site (with it's own
14-
landing, about and data pages etc.) yet only requires a single PyBossa backend.
15-
A core page provides routes into each meta-category site, along with the
16-
statistics, admin and project configuration pages.
17-
18-
## Installing
19-
20-
Install [Node.js >=5.0.0](https://nodejs.org/en/), then:
21-
22-
``` bash
23-
# install dependencies
24-
npm install
25-
```
26-
27-
## Configuring
28-
29-
Site settings can be found in [src/siteConfig.js.tmpl](src/siteConfig.js.tmpl).
30-
To use this theme you will need to make a copy of the settings file and edit locally.
31-
32-
``` bash
33-
# create local configuration file
34-
cp src/siteConfig.js.tmpl src/siteConfig.js
35-
```
36-
37-
On your PyBossa server, you will need to update the `CORS_RESOURCES` settings
38-
to allow requests from vue-pybossa-frontend. Something like this (modify
39-
origins according to your environement):
40-
41-
``` python
42-
CORS_RESOURCES = {
43-
r"/*": {
44-
"origins": [
45-
"http://127.0.0.1:8080"
46-
],
47-
"allow_headers": [
48-
'Content-Type',
49-
'Authorization',
50-
'X-CSRFToken'
51-
],
52-
"supports_credentials": True
53-
}
54-
}
55-
```
56-
57-
For a full list of options see the
58-
[Flask-CORS documentation](https://flask-cors.readthedocs.io/en/latest/).
59-
60-
61-
## Building
62-
63-
``` bash
64-
# build for production with minification
65-
npm run build
66-
67-
# build for production and view the bundle analyzer report
68-
npm run build --report
69-
```
70-
71-
## Testing
72-
73-
``` bash
74-
# run unit tests
75-
npm unit
76-
77-
# run e2e tests
78-
npm run e2e
79-
80-
# run all tests
81-
npm test
82-
```
83-
84-
## Developing
85-
86-
Start up a local PyBossa instance using the default settings, then:
8+
Configurable PyBossa frontend with a microsite-based structure; as used by LibCrowds:
879

88-
``` bash
89-
# serve with hot reload at 127.0.0.1:8080
90-
npm run dev
91-
```
10+
[![Example of vue-pybossa-frontend](./docs/assets/site-homepage.png?raw=true "Example of vue-pybossa-frontend")](https://www.libcrowds.com)
9211

93-
Note that for cookies to be read properly you must access the website at
94-
127.0.0.1:8080, rather than localhost:8080.
95-
96-
# Deploying
97-
98-
We're running a continuous deployment process to push vue-pybossa-frontend
99-
updates out to all LibCrowds servers that use it. To configure a new server:
100-
101-
``` bash
102-
# install node and npm
103-
sudo apt-get install python-software-properties
104-
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
105-
sudo apt-get install nodejs
106-
107-
# install nginx
108-
sudo apt-get install nginx
109-
110-
# remove default nginx config
111-
sudo rm /etc/nginx/sites-available/default
112-
113-
# create nginx config (copy /contrib/frontend)
114-
vim /etc/nginx/sites-available/frontend
115-
116-
# enable nginx config
117-
sudo ln -s /etc/nginx/sites-available/frontend /etc/nginx/sites-enabled/frontend
118-
119-
# restart nginx
120-
sudo service nginx restart
121-
122-
# create an empty repo
123-
mkdir -p /var/www/deployment/.git
124-
cd /var/www/deployment/.git
125-
git init --bare
126-
127-
# create an empty directory for deployments
128-
mkdir /var/www/frontend
129-
130-
# create a post-receive hook (copy /contrib/post-receive)
131-
cd hooks
132-
vim post-receive
133-
134-
# make the script executable
135-
chmod +x /var/www/deployment/.git/hooks/post-receive
136-
137-
# create a user with restricted access
138-
adduser deploy
139-
140-
# give that user ownership
141-
chown -R deploy:deploy /var/www/deployment/.git
142-
chown -R deploy:deploy /var/www/frontend
143-
144-
# switch to that user
145-
su - deploy
146-
147-
# create the public key (copy /contrib/deploy-key.pub)
148-
mkdir ~/.ssh
149-
vim ~/.ssh/authorized_keys
150-
151-
# restrict permissions
152-
chmod 700 .ssh
153-
chmod 600 .ssh/authorized_keys
154-
```
155-
156-
You can now exit the server and add the site to the `SITES` variable at the
157-
top of [/bin/deploy.sh](/bin/deploy.sh).
158-
159-
Once the master branch has been updated with this change it will be deployed to
160-
the new site for the first time.
161-
162-
[![Build Status](https://travis-ci.org/LibCrowds/vue-pybossa-frontend.svg?branch=master)](https://travis-ci.org/LibCrowds/vue-pybossa-frontend)
12+
[**Read the documentation**](https://libcrowds.gitbooks.io/vue-pybossa-frontend/content/)

bin/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Deployments
2+
3+
We're running a continuous deployment process to push vue-pybossa-frontend
4+
updates out to all specified LibCrowds servers.
5+
6+
Here are some notes to help configure a new server:
7+
8+
``` bash
9+
# install node and npm
10+
sudo apt-get install python-software-properties
11+
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
12+
sudo apt-get install nodejs
13+
14+
# install nginx
15+
sudo apt-get install nginx
16+
17+
# remove default nginx config
18+
sudo rm /etc/nginx/sites-available/default
19+
20+
# create nginx config (copy /contrib/frontend)
21+
vim /etc/nginx/sites-available/frontend
22+
23+
# enable nginx config
24+
sudo ln -s /etc/nginx/sites-available/frontend /etc/nginx/sites-enabled/frontend
25+
26+
# restart nginx
27+
sudo service nginx restart
28+
29+
# create an empty repo
30+
mkdir -p /var/www/deployment/.git
31+
cd /var/www/deployment/.git
32+
git init --bare
33+
34+
# create an empty directory for deployments
35+
mkdir /var/www/frontend
36+
37+
# create a post-receive hook (copy /contrib/post-receive)
38+
cd hooks
39+
vim post-receive
40+
41+
# make the script executable
42+
chmod +x /var/www/deployment/.git/hooks/post-receive
43+
44+
# create a user with restricted access
45+
adduser deploy
46+
47+
# give that user ownership
48+
chown -R deploy:deploy /var/www/deployment/.git
49+
chown -R deploy:deploy /var/www/frontend
50+
51+
# switch to that user
52+
su - deploy
53+
54+
# create the public key (copy /contrib/deploy-key.pub)
55+
mkdir ~/.ssh
56+
vim ~/.ssh/authorized_keys
57+
58+
# restrict permissions
59+
chmod 700 .ssh
60+
chmod 600 .ssh/authorized_keys
61+
```
62+
63+
You can now exit the server and modify [/bin/deploy.sh](/bin/deploy.sh) accordingly.

bin/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
MASTER='www.libcrowds.com'
44
STAGING='dev.libcrowds.com'
55

6-
if [ "${TRAVIS_BRANCH}" == "master" ] || [ "${TRAVIS_BRANCH}" == "dev" ] ; then
6+
if [ "${TRAVIS_BRANCH}" == "master" -a "$TRAVIS_PULL_REQUEST" = "false" ] || [ "${TRAVIS_BRANCH}" == "dev" ] ; then
77

88
# Configure
99
bin/configure.sh

docs/README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# vue-pybossa-frontend
2+
3+
[![Build Status](https://travis-ci.org/LibCrowds/vue-pybossa-frontend.svg?branch=master)](https://travis-ci.org/LibCrowds/vue-pybossa-frontend)
4+
[![DOI](https://zenodo.org/badge/92406558.svg)](https://zenodo.org/badge/latestdoi/92406558)
5+
6+
> A Vue.js frontend for PyBossa (>=2.6.1).
7+
8+
This frontend to PyBossa is a little different in that microsites can be defined to more easily group together large groups of similar projects. For example, on the [LibCrowds](www.libcrowds.com) site we define a meta-category for two of our major projects, *Convert-a-Card* and *In the Spotlight*.
9+
10+
Each microsite is presented as if it were a separate site (with it's own landing, about and data pages etc.) yet only requires a single PyBossa backend.
11+
12+
## Installation
13+
14+
Install [Node.js >=5.0.0](https://nodejs.org/en/), then:
15+
16+
``` bash
17+
# install dependencies
18+
npm install
19+
```
20+
21+
## Usage
22+
23+
On your PyBossa server, you will need to update the `CORS_RESOURCES` settings to allow requests from vue-pybossa-frontend. Something like this (modify origins according to your environement):
24+
25+
``` python
26+
CORS_RESOURCES = {
27+
r"/*": {
28+
"origins": [
29+
"http://127.0.0.1:8080"
30+
],
31+
"allow_headers": [
32+
'Content-Type',
33+
'Authorization',
34+
'X-CSRFToken'
35+
],
36+
"supports_credentials": True
37+
}
38+
}
39+
```
40+
41+
For a full list of options see the [Flask-CORS documentation](https://flask-cors.readthedocs.io/en/latest/).
42+
43+
Now, see the [Configuration](configuration.md) section for details of how to configure the site and each microsite.
44+
45+
## Building
46+
47+
To build locally:
48+
49+
``` bash
50+
# build for production with minification
51+
npm run build
52+
53+
# build for production and view the bundle analyzer report
54+
npm run build --report
55+
```
56+
57+
## Testing
58+
59+
To run tests:
60+
61+
``` bash
62+
# run unit tests
63+
npm unit
64+
65+
# run e2e tests
66+
npm run e2e
67+
68+
# run all tests
69+
npm test
70+
```
71+
72+
## Developing
73+
74+
Start up a local PyBossa instance using the default settings, then:
75+
76+
``` bash
77+
# serve with hot reload at 127.0.0.1:8080
78+
npm run dev
79+
```
80+
81+
Note that for cookies to be read properly you must access the website at http://127.0.0.1:8080, rather than http://localhost:8080.

docs/SUMMARY.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1+
* [Introduction](README.md)
2+
* [Installation](README.md#installation)
3+
* [Usage](README.md#usage)
4+
* [Building](README.md#building)
5+
* [Testing](README.md#testing)
6+
* [Developing](README.md#developing)
17
* [Configuration](configuration.md)
8+
* [Directory Structure](configuration.md#directory-structure)
9+
* [Site Configuration](configuration.md#site-configuration)
10+
* [Microsite Configuration](configuration.md#microsite-configuration)

docs/assets/site-homepage.png

750 KB
Loading

0 commit comments

Comments
 (0)