@@ -38,17 +38,10 @@ sudo pip3 install rcdb
3838### Option B: Virtual Environment (Recommended)
3939
4040``` bash
41- # Create a virtual environment
42- cd /group/halld/www/halldwebdev/html/rcdb
43- python3 -m venv venv
44-
45- # Activate the virtual environment
46- source venv/bin/activate
47-
48- # Install RCDB within the virtual environment
41+ # Create a virtual environment, activate, install rcdb, exit
42+ python3 -m venv /opt/venvs/rcdb
43+ source /opt/venvs/rcdb/bin/activate
4944pip install rcdb
50-
51- # Deactivate when you're done
5245deactivate
5346```
5447
@@ -75,27 +68,16 @@ If venv is used library:
7568import sys
7669import os
7770
78- # ===== CHOOSE ONE OF THE FOLLOWING OPTIONS =====
79-
80- # OPTION A: For system-wide installation
81- # No additional path manipulation needed if RCDB is installed system-wide
82-
83- # OPTION B: For virtual environment
84- venv_path = ' /group/halld/www/halldwebdev/html/rcdb/venv'
71+ # Add where to look for RCDB
72+ venv_path = ' /opt/venvs/rcdb/'
8573site_packages = os.path.join(venv_path, ' lib' , ' python3.9' , ' site-packages' )
8674sys.path.insert(0 , site_packages)
8775
88- # =====
89-
9076# Import and configure the RCDB web application
9177import rcdb.web
9278
93- # Set the database connection string
94- if " RCDB_CONNECTION" in os.environ:
95- rcdb.web.app.config[" SQL_CONNECTION_STRING" ] = os.environ[" RCDB_CONNECTION" ]
96- else :
97- # Default connection string - adjust as needed
98- rcdb.web.app.config[" SQL_CONNECTION_STRING" ] = " mysql://rcdb@hallddb.jlab.org/rcdb2"
79+ # Default connection string - adjust as needed
80+ rcdb.web.app.config[" SQL_CONNECTION_STRING" ] = " mysql://rcdb@hallddb.jlab.org/rcdb2"
9981
10082# This is what mod_wsgi looks for
10183application = rcdb.web.app
@@ -118,7 +100,7 @@ Create an Apache configuration file at `/etc/httpd/conf.d/rcdb.conf`:
118100
119101 # If using a virtual environment, specify the python-home
120102 # Uncomment the line below if using Option B (virtual environment)
121- # WSGIDaemonProcess rcdb_www python-home=/group/halld/www/halldwebdev/html/ rcdb/venv threads=5
103+ # WSGIDaemonProcess rcdb_www python-home=/opt/venvs/ rcdb/ threads=5
122104
123105 # If using system-wide installation, use this instead
124106 WSGIDaemonProcess rcdb_www threads=5
@@ -132,92 +114,13 @@ Create an Apache configuration file at `/etc/httpd/conf.d/rcdb.conf`:
132114</VirtualHost>
133115```
134116
135- ## 5. Set Permissions
136117
137- Ensure Apache can access the RCDB files:
138-
139- ``` bash
140- # Check ownership of the directory
141- ls -la /group/halld/www/halldwebdev/html/rcdb/
142-
143- # Set appropriate permissions
144- sudo chown -R apache:apache /group/halld/www/halldwebdev/html/rcdb/
145- # OR add read permissions for others
146- sudo chmod -R o+r /group/halld/www/halldwebdev/html/rcdb/
147- sudo chmod o+x /group/halld/www/halldwebdev/html/rcdb/
148- ```
149-
150- ## 6. Configure SELinux (if enabled)
151-
152- If SELinux is enabled on your system:
153-
154- ``` bash
155- # Allow Apache to connect to the database
156- sudo setsebool -P httpd_can_network_connect_db 1
157-
158- # Set proper context for the WSGI file
159- sudo chcon -t httpd_sys_content_t /group/halld/www/halldwebdev/html/rcdb/rcdb_www.wsgi
160- ```
161-
162- ## 7. Restart Apache
118+ ## 5. Restart Apache
163119
164120``` bash
165121sudo systemctl restart httpd
166122```
167123
168- ## 8. Test the Installation
169-
170- Visit ` http://your-server/rcdb ` in your web browser.
171-
172- If you encounter issues, check the Apache error logs:
173-
174- ``` bash
175- sudo tail -f /var/log/httpd/error_log
176- ```
177-
178- ## Troubleshooting
179-
180- ### Missing Modules
181-
182- If you encounter missing module errors, install them with pip:
183-
184- ``` bash
185- # For system-wide installation
186- sudo pip3 install flask sqlalchemy pymysql
187-
188- # For virtual environment
189- source /group/halld/www/halldwebdev/html/rcdb/venv/bin/activate
190- pip install flask sqlalchemy pymysql
191- deactivate
192- ```
193-
194- ### Permissions Issues
195-
196- If you see permission denied errors:
197-
198- ``` bash
199- # Check SELinux status
200- sestatus
201-
202- # If SELinux is enforcing, try setting it to permissive temporarily for testing
203- sudo setenforce 0
204-
205- # After testing, remember to set it back to enforcing
206- sudo setenforce 1
207- ```
208-
209- ### Database Connection Issues
210-
211- If the website loads but database connection fails:
212-
213- 1 . Verify your connection string in the Apache config and WSGI script
214- 2 . Check if the database server allows connections from your web server
215- 3 . Test the connection manually:
216-
217- ``` bash
218- python3 -c " import pymysql; pymysql.connect(host='hallddb.jlab.org', user='rcdb', db='rcdb2')"
219- ```
220-
221124## Additional Notes
222125
223126- The RCDB web interface requires the proper database schema to be installed
0 commit comments