-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathinstallNotes.txt
313 lines (235 loc) · 10.5 KB
/
installNotes.txt
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# ----------------------------------------------------------
# New ubuntu server instance install script for Hand-o-matic
# ----------------------------------------------------------
sudo apt-get update
# install 3 critical components
sudo apt-get install xvfb vim git
# LAMP stack install
# ONLY run this following line if you don't have an html server / php / etc
# Agree until you get to password, do not leave password blank
sudo apt-get install apache2 mysql-server php5 php5-mysql libapache2-mod-php5 apache2-utils
# Since there may be personal and medical information communicated through
# this server, it's recommended to also install SSL.
# Use the apache documentation to install it. In short it comes down to:
# make sure you have a certificate from a certificate authority (costs
# involved but recommended) or sign-it yourself (free, not recommended).
## Install your certificate.
## Enable ssl:
# a2ensite default-ssl.conf
## Configure it:
# vi /etc/apache2/sites-enabled/default-ssl.conf
## restart Apache to make the change effective
# service apache2 restart
# Allow rewrites from .htaccess to secure log files
# and allow service calls without extensions
sudo a2enmod rewrite
cd /var/www/html/.htaccess
# <Files "*.txt">
# #Require all denied
# AuthType Basic
# AuthName "Members Only"
# #AuthUserFile /var/www/html/.htpasswd
# Require valid-user
# </Files>
# Generate htpasswd
# Replace KEY for username or meaningful replacement
# This will ask for a password twice for confirmation
# purposes
htpasswd -c ./.htpasswd KEY
# ############################################
# We want to make php files accessible without
# the extension for use of service calls -
# modify the following file and add the Directory
# tag inside VirtualHost:
# <Directory /var/www/html>
# Options +FollowSymLinks +MultiViews +Indexes
# DirectoryIndex index.php
# AddType application/x-httpd-php .php
# </Directory>
# vim edit command
sudo vi /etc/apache2/sites-available/000-default.conf
# install openScad latest dev snapshot manually
# source: http://www.openscad.org/downloads.html
cd /var/tmp/
wget http://files.openscad.org/snapshots/openscad-2014.10.02.x86-64.tar.gz
tar xvf openscad-2014.10.02.x86-64.tar.gz
cd openscad-2014.10.02
# just hit enter when asked where the lib should install
sudo ./install.sh
# Make directory where our code will live
sudo mkdir /var/code
# probably a bad idea but we're in a hurry
sudo chmod 777 /var/code
cd /var/code
# Clone the individual repos from git
sudo git clone https://github.com/e-nable/Assembler.git
sudo git clone https://github.com/e-nable/Service-Station.git
cd Service-Station
cp config_default.php config.php
# make sure and edit the config.php
# set enable_camera to TRUE
# set baseDNS to the full URL where the app is reached
# this value is used for webMail
# this helps when doing git diff / pull / check-ins
sudo git config core.fileMode false
# edit your config.php file. Change localhost to the publicly accessible
# hostname that can be used for using the web-enabled service
# e.g. e-nable.youmagine.com if the service lives at:
# http://e-nable.youmagine.com/
nano config.php
# this will prevent your config.php from blocking future updates
git update-index --assume-unchanged config.php
# link the open scad / assembler code
sudo ln -s ../Assembler e-NABLE
cd e-NABLE
# this helps when doing git diff / pull / check-ins
sudo git config core.fileMode false
cd ../..
# change execution permissions
sudo chmod 755 * -R
# create image cache directory and log file
sudo mkdir Service-Station/imagecache; sudo chmod 777 Service-Station/imagecache;
sudo touch Service-Station/log.txt; sudo chmod 777 Service-Station/log.txt;
sudo chmod 777 Service-Station/ticket;
# assumes apache2 - we're about to use the default html directory
cd /var/www
# move the default directory
sudo mv html html_old
# link from /var/code as our new html directory
sudo ln -s /var/code/Service-Station html
# Configure apache2 timeouts
# set value "Timeout" to "900" in the following:
sudo vi /etc/apache2/apache2.conf
# run this
# will allow openscad commands to run headless
# TODO: should force this to auto start with server
nohup Xvfb :5 -screen 0 800x600x24 &
export DISPLAY=:5
# restart our apache2 instance for kicks
sudo service apache2 restart
# All requirements should be there!
# ifconfig will give us the I.P. in case you don't know it
# following line gives you the address > inet addr:AAA.BBB.CC.DDD
# Go to http://AAA.BBB.CC.DDD/
# --------------------------------------------------------------------
# Continue with below instructions
# --------------------------------------------------------------------
#
# By this point we should have received the update.sh file
# move it to user's root directory and make it executable
mv /var/code/Service-Station/update.sh ~/updateProd.sh
vim ~/updateProd.sh
# line 14 contains the following:
# webDir=/var/www/html
# we want it to point to the location where our Service-Station is hosted
# edit or confirm the directory
# once completed, execute it with -s flag
# this should update both Service-Station and Assembler backend portions
chmod 555 ~/updateProd.sh
~/updateProd.sh -s
# After this, all hand-o-matic code would be updated
# and the permissions would be set as needed
# Configure the Web URL where the app is hosted, includng port
cd /var/code/Service-Station
vim config.php
# Change variable "baseDNS" to reflect the information
# this is critical as it'll be used to build the URLs for all email
# based on generated ticketing information. Leave as localhost
# for local implementations
# --------------------------------------------
# Mail configuration
# --------------------------------------------
# First, install all necessary packages:
sudo apt-get install php5-curl zip postfix mailutils libsasl2-2 ca-certificates libsasl2-modules
# If you do not have postfix installed before, postfix configuration wizard
# will ask you some questions. Select your server as 'Internet Site'
# and for FQDN use something like mail.example.com
#
# Then open your postfix config file:
vim /etc/postfix/main.cf
# configure it as below:
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
# save and move on
vim /etc/postfix/sasl_passwd
# And add following line:
[smtp.gmail.com]:587 [email protected]:PASSWORD
# Fix permission and update postfix config to use sasl_passwd file:
sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
# Next, validate certificates to avoid running into error.
# Just run following command:
cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem
# Finally, reload postfix config for changes to take effect:
sudo /etc/init.d/postfix reload
# Testing
# Check if mails are sent via Gmail SMTP server
# change the [email protected] address below per your test account
echo "Test mail from postfix" | mail -s "Test Postfix" [email protected]
# --------------------------------------------
# Testing / Debugging
# --------------------------------------------
# Walk through the app, enter a working email
# If the email is received and the URL works, we're done.
# The following is in case there are problems...
# NOTE THAT NO NEW EMAIL NOR WORK WILL BE DONE FOR TICKETS ALREADY COMPLETED
# Ticket IDs are unique by [server hash]-[user email hash]-[parameters hash]
# Next dev cycle will allow retreival of previously generated content
# through the use of the ticket number
# If subsequent tests with the same parameters needs to be built for testing,
# [ticket number].sh, [ticket number] directory, [ticket number].zip need to
# be removed if present.
# Generate and check the log.txt in the root of the app
# An entry such as the following should be seen:
# SAMPLE:
# ---------------------------------------------------
# Starting Full Assembly:
# Email: [email protected]
# Ticket: 7412225538-3017136727-39654222
#
# Params: 0 -D Left1=0 -D Left2=0 -D Left3=0 -D Left4=0 -D Left5=0 -D Left6=0 -D Left7=0 -D Left8=87 -D Left9=97 -D Left10=0 -D Right1=0 -D Right2=0 -D Right3=0 -D Right4=0 -D Right5=0 -D Right6=0 -D Right7=0 -D Right8=0 -D Right9=0 -D Right10=0-D prostheticHand=1 -D gauntletSelect=3 -D fingerSelect=4 -D palmSelect=5 -D Padding=5 -D WristBolt=0 -D KnuckleBolt=0 -D JointBolt=0 -D ThumbBolt=0
#
# Completed ([email protected]): Fri Oct 3 02:17:42 EDT 2014
# ---------------------------------------------------
# ./ticket should contain a .zip file after completion
# If not, permissions for ticket directory should be read write exectute
# for www-data or equivalent apache user service
# If the Complete message is logged and tickets directory
# contains the associated ticket directory and or sh file
# (same as noted ticket) then there might have been a problem executing
# either all or part of the script.
# General workflow for each ticket is:
# - Directory created
# - Script created with all openscad commands for each part
# - Script is execture
# + Each command executes
# + Logging information is added
# + Email template is used, data is seeded, html file is created
# + Directory is zipped
# + Email is sent
# + sh script is removed
# If a directory is left, it should contain on completion:
# - log.txt
# - README.html
# - STL files
# -------------------------------------------------
# To check that the service is working:
# -------------------------------------------------
# change the below [email protected]
# and WEB_URL
# ... use the following in your browser
http://WEB_URL/[email protected]&part=1&type=make&gauntletSelect=3&fingerSelect=4&palmSelect=5&Padding=5&prostheticHand=0&Right1=62.67&Right2=65.62&Right3=59.14&Right4=48.78&Right5=51.85&Right6=16.4&Right7=0&Right8=72.52&Right9=72.23&Right10=230.6&Left1=66.47&Left2=64.04&Left3=46.95&Left4=35.14&Left5=35.97&Left6=27.27&Left7=31.80&Left8=40.97&Left9=31.06&Left10=147.5
# There will be four states which can be matched by the description for each status update:
# - "Initiated" returned when a new item is requested
# After the directory is made:
# - "In Progress": when the ticket is in the process of being executed
# It is possible that it may never complete - check the associated directory
# to see how far it progressed
# Once it's completed:
# - "Completed" ... which should contain the url: "http://domain.com/ticket/3153980626.zip"
# And the error state which is only returned if there are validation issues:
# - "Email Error", url: ""}