forked from freifunk/meshkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
234 lines (172 loc) · 9.29 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
= Installation instructions =
== 1. Install web2py and meshkit ==
First you need to install the web2py framework and then the meshkit
application.
=== 1.1 Depencies ===
* python2.5 or python2.6
* If using python 2.5: python-simplejson
* OrderedDict
=== 1.2 install web2py ===
Fortunately web2py installation is documented really well so there is
not much to say here. Please consult the web2py documentation for general
web2py help: http://www.web2py.com/examples/default/documentation
First of all you need to download and extract the web2py source
code package:
$ cd; mkdir meshkit; cd meshkit
$ wget http://www.web2py.com/examples/static/web2py_src.zip
$ unzip web2py_src.zip
=== 1.3 Install the meshkit application ===
Now change into the just extracted web2py folder and checkout the meshkit
application into the applications folder:
$ cd web2py/applications
$ git clone https://github.com/freifunk/meshkit.git
==== 1.3.1 Configuration file ====
There is a sample configuration file in conf/meshkit_example.conf. Copy that to
conf/meshkit.conf and edit it accordingly:
$ cd meshkit/conf/
$ cp meshkit_example.conf meshkit.conf
==== 1.3.2 Configuration for Communities ====
There is a need for Community-Files and -Profiles:
$ cd ~/meshkit
$ git clone https://github.com/freifunk/openwrt-packages.git
$ git clone https://github.com/freifunk/meshkit-community_files.git
==== 1.3.3 Directory for Images====
Images will be built in these directories:
$ cd ~/meshkit
$ mkdir images
Link it to your local webserver to have downloadable files, do as root:
$root# ln -s /home/meshkitter/meshkit/images/ /var/www/meshkit-images
==== 1.3.4 Openwrt Imagebuilder Buildroots ====
You need to have some Openwrt Imagebuilders to compile firmware for. Download Imagebuilders from Openwrt Downloadsite, unpack it and rename it as your needs:
$ cd ~/meshkit
$ mkdir buildroots; cd buildroots
$ wget https://downloads.openwrt.org/releases/19.07.1/targets/ath79/generic/openwrt-imagebuilder-19.07.1-ath79-generic.Linux-x86_64.tar.xz
$ wget https://downloads.openwrt.org/releases/19.07.1/targets/ath79/tiny/openwrt-imagebuilder-19.07.1-ath79-tiny.Linux-x86_64.tar.xz
$ wget https://downloads.openwrt.org/releases/19.07.1/targets/x86/generic/openwrt-imagebuilder-19.07.1-x86-generic.Linux-x86_64.tar.xz
$ wget https://downloads.openwrt.org/releases/19.07.1/targets/ramips/mt7621/openwrt-imagebuilder-19.07.1-ramips-mt7621.Linux-x86_64.tar.xz
$ tar -xvf openwrt-imagebuilder-19.07.1-x86-generic.Linux-x86_64.tar.xz
$ tar -xvf openwrt-imagebuilder-19.07.1-ath79-generic.Linux-x86_64.tar.xz
$ tar -xvf openwrt-imagebuilder-19.07.1-ath79-tiny.Linux-x86_64.tar.xz
$ tar -xvf openwrt-imagebuilder-19.07.1-x86-generic.Linux-x86_64.tar.xz
$ mv openwrt-imagebuilder-19.07.1-x86-generic x86-19071-generic
==== 1.3.5 Starting/Deploying web2py ====
There are different options for deployment, but the easiest one is
to just run the web2py application with its integrated rocket webserver
directly. This can be done with the follwing command in the web2py folder:
$ cd; cd meshkit; cd web2py
$ python web2py.py --ip=0.0.0.0 --password=foobar --port=8000 --nogui
For other kinds of deployment and integration with different webservers
see http://web2py.com/books/default/chapter/29/13
The meshkit/examples/ folder contains a sample config for apache2 + wsgi.
=== 1.4. Rewrite routes.py ===
Assume you only run web2py for the meshkit application. Thats why you want
to make meshkit the default application. To do this change into the web2py
directory and copy router.example.py to routes.py. Now edit the following
section like this:
routers = dict(
# base router
BASE = dict(
default_application = 'meshkit',
),
)
=== 1.5 Login into Appadmin ===
Now it is time to login into appadmin of your freshly installed web2py
with your browser. Note: Login is only possible if you connect from 127.0.0.1 or
over a secured https connection, but the latter one would require to use the ssl
options when starting web2py in the last step.
So if your installation is not on localhost help yourself with ssh-tunneling:
$ ssh <serverip> -L 8000:127.0.0.1:8000
Now open the url http://127.0.0.1:8000/meshkit/admin/default/index and login with the
password you set when starting web2py.
You will see 4 applications now: admin, examples, meshkit and welcome. If you like
you can delete examples and welcome now or any time later.
=== 1.6 Configure meshkit ===
Now you need to configure meshkit. To do that go to:
http://127.0.0.1:8000/appadmin/select/db?query=db.config.id>0
Now click the "insert new config" link to create a new config database row.
Noconf: Globally disable configuration. Check this if you only
want to build images, but not configure anything.
Communitysupport: Check this if you want to use meshkit to create images
for wireless communities. It will support community
profiles then, taken from git and stored locally.
You should setup a cronjob to autoupdate them periodically.
Profiles: The path where the community profiles are stored locally.
You only need to set this if Communitysupport is enabled.
This must start end end with a slash ("/")
f.i. /home/meshkitter/meshkit/openwrt-packages/contrib/package/community-profiles/files/etc/config
Communityfiles Dir: Directory where custom files files for communities are stored
which will be copied into the generated firmware image.
You only need to set this if Communitysupport is enabled.
This must start end end with a slash ("/")
f.i. /home/meshkitter/meshkit/meshkit-community_files
Buildroots Dir: This is the directory where meshkit can find your
extracted OpenWrt imagebuilders. Make sure this path
exists and the user running web2py has read and write
access to everything inside it.
Web2py shows the single imagebuilders in this directory
with their full name in the dropdown selection. So you
may rename these to some nices names, e.g.
ar71xx-backfire-10.03.1
This must start end end with a slash ("/")
f.i. /home/meshkitter/meshkit/buildroots/
Images Output Dir: This is the local path where generated images should
be stored after they are generated. Make sure the
user running web2py has read and write access to it.
This must start end end with a slash ("/")
f.i. /home/meshkitter/meshkit/images/
Images Web Dir: The web accessible path where users can download the
generated images. I assume you have some webserver
running which allows access to this path. If you don't
you may set Images Web Dir to static/images
and use http://<url>/static/images here.
f.i. http://<url>/meshkit-images/
Add Defaultpackages: A space seperated list of packages that should be added
to all generated images
Keep Images: How long (in hours) generated images are kept in
"Images Output Dir" before they are deleted by the a regular
internal task. Set to 0 to never delete them.
Webifs: Webinterfaces to offer in the select field for webinterface
seperated by comma, e.g.
luci, none
IPv6Packages Packages to add to the package list if IPv6 is enabled.
Only used when Communitysupport is enabled.
Seperated by space.
Defaulttheme: Theme which should be preselected in the dropdown for theme
selection, e.g.: luci-theme-bootstrap
Adminmail: Your email. Mails about errors are sent there.
Lanprotos: Protocols to offer in the Protocol selectbox for LAN
configuration seperated by commas. Currently
static and olsr are possible values here. You should set
static first because thats the OpenWrt default, e.g.
static, olsr
Wanprotos: Protocols to offer in the Protocol selectbox for WAN
configuration seperated by commas. Currently
dhcp, static and olsr are possible values here. You should set
dhcp first because thats the OpenWrt default, e.g.
dhcp, static, olsr
Expandablehelp: If set helptexts will be expandable. If not they are always
shown.
Showexpertmode: Show a checkbox to enable expert mode in step 1
AutoSubmit: auto-submit the step 1 form after selection of a model from the list.
This will also hide the submit button in step 1
Click to delete: This would delete this config row. Do NOT check this!
== 2. Setup a scheduler worker for processing the build queue ==
Now you need to start/setup at least one worker, that will process the build
tasks using web2py's own scheduler. Starting a worker is easy:
$ python web2py.py -M -K meshkit
Hint: If you want to start more than one workers, simply repeat the meshkit
keyword like this (to start 3 workers):
$ python web2py.py -M -K meshkit,meshkit,meshkit
Of course you want to make that persistent and start the worker at boot time.
You may just insert a line in /etc/rc.local or, whats recommended, use your
systems init service.
For your convenience there are sample init files for systemd and system-v in
contrib/init-scripts/ that may help you to get started.
For upstart web2py brings its own example, see:
http://web2py.com/books/default/chapter/29/13/deployment-recipes#Start-the-scheduler-as-a-Linux-service--upstart-
== 3. Notes ==
* to speed things up some files like packagelists and output from "make info"
are permanantly cached. If you update the package lists of your imagebuilder
or change profiles you need to delete the static json files inside
applications/meshkit/static/package_lists
* if you want to use different favicons just replace the .ico and .png in static/