|
1 | 1 | # vue-pybossa-frontend |
2 | 2 |
|
3 | | -[](http://forthebadge.com) |
4 | | -[](http://forthebadge.com) |
| 3 | +[](https://travis-ci.org/LibCrowds/vue-pybossa-frontend) |
| 4 | +[](https://zenodo.org/badge/latestdoi/92406558) |
5 | 5 |
|
6 | 6 | > A Vue.js frontend for PyBossa (>=2.6.1). |
7 | 7 |
|
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: |
87 | 9 |
|
88 | | -``` bash |
89 | | -# serve with hot reload at 127.0.0.1:8080 |
90 | | -npm run dev |
91 | | -``` |
| 10 | +[](https://www.libcrowds.com) |
92 | 11 |
|
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 | | -[](https://travis-ci.org/LibCrowds/vue-pybossa-frontend) |
| 12 | +[**Read the documentation**](https://libcrowds.gitbooks.io/vue-pybossa-frontend/content/) |
0 commit comments