Using Redux to serve images on myamiweb » History » Version 62
Anchi Cheng, 12/06/2017 05:34 PM
1 | 1 | Anchi Cheng | h1. Using Redux to serve images on myamiweb |
---|---|---|---|
2 | |||
3 | 52 | Amber Herold | These instructions cover installation of Leginon and Appion web tools for viewing images and performing image processing through the web server using Redux as an image server. |
4 | 21 | Amber Herold | Redux is new for CentOS 6 (PHP 5.3). |
5 | |||
6 | 1 | Anchi Cheng | h2. Installation |
7 | |||
8 | 33 | Amber Herold | * Install python filesystem abstraction for redux caching: |
9 | 1 | Anchi Cheng | <pre> |
10 | sudo easy_install fs |
||
11 | </pre> |
||
12 | 33 | Amber Herold | * Install Myami packages |
13 | <pre> |
||
14 | cd myami |
||
15 | ./pysetup.sh install |
||
16 | </pre> |
||
17 | 1 | Anchi Cheng | |
18 | 47 | Amber Herold | h2. Copy the myami/myamiweb directory to your Apache web directory |
19 | |||
20 | Example: |
||
21 | <pre> |
||
22 | cd myami |
||
23 | |||
24 | #CentOS example |
||
25 | sudo cp -vr myamiweb /var/www/html/ |
||
26 | |||
27 | #this is temporary for setup, revert to 755 when finished with this page |
||
28 | sudo chmod 777 /var/www/html/myamiweb |
||
29 | |||
30 | #if you have SELinux enabled this command will help |
||
31 | sudo chcon -R --type=httpd_sys_content_t /var/www/html |
||
32 | </pre> |
||
33 | |||
34 | |||
35 | |||
36 | |||
37 | 61 | Anchi Cheng | h2. Configuration Redux |
38 | 17 | Anchi Cheng | |
39 | 1 | Anchi Cheng | <pre> |
40 | 17 | Anchi Cheng | > cd /YourMyamDownload/redux |
41 | 16 | Anchi Cheng | > cp redux.cfg.template redux.cfg |
42 | 1 | Anchi Cheng | </pre> |
43 | 44 | Amber Herold | |
44 | 17 | Anchi Cheng | * You can also copy it to /etc/myami/redux.cfg if you prefer. |
45 | 1 | Anchi Cheng | * Set a writable log path by the user starting it. In this example, we start redux as root and save the log in /var/log/redux.log |
46 | 34 | Amber Herold | * Edit the redux.cfg file as follows: |
47 | 44 | Amber Herold | |
48 | 31 | Anchi Cheng | <pre> |
49 | [log] |
||
50 | file: /var/log/redux.log |
||
51 | </pre> |
||
52 | 44 | Amber Herold | |
53 | 43 | Amber Herold | * Turn on redux caching if desired: |
54 | 44 | Amber Herold | |
55 | 1 | Anchi Cheng | <pre> |
56 | 16 | Anchi Cheng | [cache] |
57 | enable: yes |
||
58 | path: /var/cache/myami/redux |
||
59 | disksize: 500 |
||
60 | 40 | Amber Herold | memsize: 500 |
61 | 1 | Anchi Cheng | </pre> |
62 | 44 | Amber Herold | |
63 | ** *You need to make sure the cache path exists and writable by the user that starts the redux server (reduxd)* |
||
64 | 1 | Anchi Cheng | ** Input the desired disk_cache_path, disk_cache_size, and mem_cache_size in the next few lines |
65 | 38 | Amber Herold | ** Create the disk_cache_path before running redux if cache will be used |
66 | 1 | Anchi Cheng | |
67 | 61 | Anchi Cheng | h2. Configure Web Interface (myamiweb) |
68 | 1 | Anchi Cheng | |
69 | 49 | Amber Herold | There is a setup wizard available to help you set the configuration parameters for your installation. If you prefer not to use the wizard, there are instructions for manually editing the configuration file. If this is your first time creating the web tool configuration file, we recommend using the setup wizard. |
70 | |||
71 | |||
72 | 61 | Anchi Cheng | h3. Configuration using the setup wizard |
73 | 49 | Amber Herold | |
74 | The setup wizard will check your database connection, create required database tables, and perform default data initialization. |
||
75 | |||
76 | * Run the online setup wizard by visiting http://yourhost/myamiweb/setup or http://localhost/myamiweb/setup to create the myami website’s config file. |
||
77 | |
||
78 | *Tips:* |
||
79 | # You need to know your database setup before you start. If you have been using the parameters in this instruction, here is a [[Explanation of Sample Names|summary]]. |
||
80 | # To discover what the Apache user is: |
||
81 | <pre> |
||
82 | sudo egrep -iw --color=auto '^(user|group)' /etc/httpd/conf/httpd.conf |
||
83 | </pre> |
||
84 | # You also need to decide whether you would like to enable the [[appion:What does User Authentication do to myamiweb|user management system]]. |
||
85 | |||
86 | +Manual configuration instructions (Advanced User)+ |
||
87 | |||
88 | Go to [[appion:Install the Web Interface Advanced]] for the advanced configuration. |
||
89 | |||
90 | h3. Revert permissions |
||
91 | |||
92 | <pre> |
||
93 | sudo chmod 755 /var/www/html/myamiweb |
||
94 | </pre> |
||
95 | 1 | Anchi Cheng | |
96 | 42 | Amber Herold | |
97 | 51 | Amber Herold | h2. Test Redux Installation |
98 | 1 | Anchi Cheng | |
99 | # Using Redux to do simple input output (simple client with no reduxd server needed):<pre>redux --filename=test.jpg --oformat=PNG > test.png</pre>Make sure the resulting test.png is in fact an image and not an error message. |
||
100 | # Run the server: run the following on a command line:<pre>reduxd</pre>leave it running for the following... |
||
101 | 60 | Anchi Cheng | # Test command line client connecting to the server<pre>redux --server_host=localhost --filename=/absolute_path/test.jpg --oformat=PNG > test.png</pre>Note: *The input file name is from the perspective of the reduxd server*, so be sure to give it an absolute path (unlike the first test, which was not accessing the server) |
102 | 31 | Anchi Cheng | # Check the redux.log created as configured in redux.cfg. This contains the port opened by redux server that will allow myamiweb to connect to. |
103 | 2 | Anchi Cheng | |
104 | 53 | Amber Herold | h2. Setup fftw to use wisdom |
105 | 25 | Anchi Cheng | |
106 | 27 | Anchi Cheng | *This applies only if you see the messge "*** Using custom copy of fftw3"* in the previous redux test. |
107 | |||
108 | 29 | Anchi Cheng | fftw runs much faster on odd image dimension if a wisdom is saved. It is best to create the wisdom ahead of time using the stand alone script pyami/fft/fftwsetup.py. It will store the wisdom you create in your home directory with a name like 'fftw3-wisdom-hostname'. If you only start reduxd as root and fftwsetup.py is run as root, this is enough. |
109 | 1 | Anchi Cheng | |
110 | 47 | Amber Herold | * Redux needs write permission at its installation location to write fftw wisdom file. |
111 | 29 | Anchi Cheng | * For developer only: you can copy the wisdom file to any other home directory that wants to use it, or copy it as root to a file called /etc/fftw/wisdom which any user can access. |
112 | |||
113 | 1 | Anchi Cheng | h3. Using fftwsetup.py: |
114 | 25 | Anchi Cheng | |
115 | 30 | Anchi Cheng | FIrst, you need to know the typical image dimension redux needs to process, especially the large ones and *ones that are not powers of 2 such as those produced by Gatan K2*. |
116 | 25 | Anchi Cheng | |
117 | <pre> |
||
118 | cd /YourMyamDownload/pyami/fft |
||
119 | ./fftwsetup.py 1 number_of_rows number_of_colums |
||
120 | </pre> |
||
121 | |||
122 | For example, for K2 summit super-resolution image there are 7676 rows and 7420 columns, therefore, the command line is |
||
123 | <pre> |
||
124 | ./fftwsetup.py 1 7676 7420 |
||
125 | </pre> |
||
126 | This may take a few minutes. |
||
127 | |||
128 | Run this for as many dimensions you know will be used and move it for general use as instructed above if preferred. |
||
129 | 1 | Anchi Cheng | |
130 | 54 | Amber Herold | h2. Start the Redux server for use with myamiweb |
131 | 14 | Jim Pulokas | |
132 | 55 | Amber Herold | Start reduxd server if not already running from the above test:<pre>reduxd</pre> |
133 | 11 | Neil Voss | |
134 | 55 | Amber Herold | h2. Starting reduxd at boot |
135 | 11 | Neil Voss | |
136 | 62 | Anchi Cheng | *CentOS6* |
137 | |||
138 | 11 | Neil Voss | <pre> |
139 | sudo cp -v myami/redux/init.d/reduxd /etc/init.d/ |
||
140 | 1 | Anchi Cheng | sudo service reduxd start |
141 | </pre> |
||
142 | 62 | Anchi Cheng | |
143 | *CentOS7 or Ubuntu* |
||
144 | |||
145 | Please follow [[start redux with systemd|this instruction]] provided by Partick Goetz |
||
146 | 1 | Anchi Cheng | |
147 | 54 | Amber Herold | h2. Test the myamiweb and Redux installation |
148 | |||
149 | 51 | Amber Herold | # Visit http://yourhost/myamiweb or http://localhost/myamiweb to confirm functionality of the myamiweb website. |
150 | # Browse to the automatic web server troubleshooter at: http://localhost/myamiweb/test/checkwebserver.php |
||
151 | 54 | Amber Herold | # Click on "[test dataset]" on your main myamiweb home page, or go directly to the URL: myamiweb/viewerxml.php |
152 | # Test by accessing your own images from Leginon in myamiweb/imageviewer.php |
||
153 | 51 | Amber Herold | |
154 | 56 | Amber Herold | h2. Turn off error checking in php.ini |
155 | 51 | Amber Herold | |
156 | Once functionality is confirmed, you may turn off the display of website errors. |
||
157 | Edit the following items in php.ini (found as /etc/php.ini on CentOS and /etc/php5/apache2/php.ini on SuSE) so that they look like the following: |
||
158 | |||
159 | bq. display_errors = Off |
||
160 | 18 | Anchi Cheng | |
161 | 57 | Amber Herold | |
162 | h2. Troubleshooting image display |
||
163 | |||
164 | 59 | Amber Herold | If you find that you have many users viewing images, and the images are taking too long to load, there are several ways to address this. |
165 | # [[leginon:Alternative reduxd installation on file server]] |
||
166 | 58 | Amber Herold | # [[leginon:Using imcache to cache mrc images as jpeg images of the default size on myamiweb]] |