Skip to content

Commit 2a3351e

Browse files
committed
[doc] Update on website and example docker image
1 parent 4f1628e commit 2a3351e

File tree

4 files changed

+139
-10
lines changed

4 files changed

+139
-10
lines changed

docker/rocky/Dockerfile

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# docker build -t rcdb-rocky:latest .
2+
# docker run --rm -it --init rcdb-rocky:latest
3+
# docker run --rm -it --init -p8888:8888 rcdb-rocky:latest
4+
5+
# ----------------------------------------------------
6+
# Dockerfile for running RCDB on Rocky Linux 9
7+
# ----------------------------------------------------
8+
FROM rockylinux:9
9+
10+
LABEL maintainer="Dmitry Romanov <romanov@jlab.org>"
11+
12+
# Enable EPEL and CRB
13+
RUN dnf install -y epel-release && \
14+
dnf config-manager --set-enabled epel && \
15+
dnf config-manager --set-enabled crb
16+
17+
18+
# Install system packages and rcdb dependendencies
19+
20+
RUN dnf install -y \
21+
httpd \
22+
git \
23+
# Python and RCDB deps \
24+
python3-devel \
25+
python3-pip \
26+
python3-mod_wsgi \
27+
python3-markupsafe \
28+
python3-click \
29+
python3-rich \
30+
python3-sqlalchemy \
31+
python3-mako \
32+
python3-ply \
33+
python3-PyMySQL \
34+
python3-pygments \
35+
python3-flask \
36+
&& dnf clean all \
37+
&& rm -rf /var/cache/yum
38+
39+
# ----------------------------------------------------
40+
# Clone RCDB repo and install Python library
41+
# ----------------------------------------------------
42+
RUN git clone --depth=1 https://github.com/JeffersonLab/rcdb.git /opt/rcdb
43+
WORKDIR /opt/rcdb/python
44+
45+
# Install RCDB *without* re-downloading dependencies (they are from RPM)
46+
# The --no-deps flag ensures pip won’t try to reinstall them.
47+
RUN pip3 install --no-cache-dir --no-deps .
48+
49+
# ----------------------------------------------------
50+
# Set up Apache config & WSGI script
51+
# ----------------------------------------------------
52+
# Make sure the directory for your WSGI script matches httpd config
53+
RUN mkdir -p /group/halld/www/halldwebdev/html/rcdb
54+
55+
# Copy WSGI script into place
56+
COPY rcdb_www.wsgi /group/halld/www/halldwebdev/html/rcdb/rcdb_www.wsgi
57+
58+
# Copy Apache config to conf.d
59+
COPY rcdb.conf /etc/httpd/conf.d/rcdb.conf
60+
61+
# ----------------------------------------------------
62+
# Expose port 80 and run Apache in the foreground
63+
# ----------------------------------------------------
64+
EXPOSE 80
65+
66+
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]

docker/rocky/rcdb.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<VirtualHost *:80>
2+
# Optionally, set ServerName e.g. rcdb.example.com
3+
WSGIScriptAlias /rcdb /group/halld/www/halldwebdev/html/rcdb/rcdb_www.wsgi
4+
5+
WSGIDaemonProcess rcdb_www threads=5
6+
WSGIProcessGroup rcdb_www
7+
WSGIApplicationGroup %{GLOBAL}
8+
9+
<Directory /group/halld/www/halldwebdev/html/rcdb>
10+
Require all granted
11+
</Directory>
12+
</VirtualHost>

docker/rocky/rcdb_www.wsgi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import rcdb.web
2+
3+
# Set the SQL connection string (edit as necessary)
4+
rcdb.web.app.config["SQL_CONNECTION_STRING"] = "mysql://rcdb@hallddb.jlab.org/rcdb2"
5+
6+
application = rcdb.web.app

docs/web_site_setup.md

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,83 @@
11
# Installing RCDB Website
22

3-
Here RHEL9 + Apache Server + mod_wsgi is considered as this setup is mainly used at Jefferson Lab.
3+
Here RHEL9 + Apache Server + mod_wsgi is considered as this setup is mainly used at Jefferson Lab.
44

5+
There is a dockerfile with example Rocky Linux 9 (binary compatible with RHEL9) setup with config files:
6+
7+
```bash
8+
# Assuming cwd is rcdb repo root:
9+
cd docker/rocky
10+
docker build -t rcdb-rocky:latest .
11+
docker run --rm -it --init -p 8888:80 rcdb-rocky:latest
12+
13+
# site should be seen on
14+
http://localhost:8888/rcdb/
15+
```
516

6-
## Prerequisites
717

8-
- RHEL9 server with Apache HTTP Server installed
18+
- RHEL9 (or compatible) server with Apache HTTP Server installed
919
- Root access or sudo privileges
1020
- Python 3.9+ (default on RHEL9)
1121
- `mod_wsgi` package for Apache
1222

13-
## 1. Install Required Packages
23+
## Install Required Packages
1424

1525
First, install the necessary packages:
1626

1727
```bash
1828
# Install Apache and mod_wsgi
19-
sudo dnf install httpd python3-mod_wsgi
20-
21-
# Install required Python packages
22-
sudo dnf install python3-pip python3-devel
29+
sudo dnf install httpd python3-mod_wsgi python3-pip python3-devel
2330

2431
# Start and enable Apache
2532
sudo systemctl enable --now httpd
2633
```
2734

28-
## 2. Install RCDB Library
35+
There are two ways of managing rcdb and dependencies:
36+
37+
- Install centrally on the server e.g. via RPM
38+
- Install venv and use mod_wsgi with python and packages from venv
39+
40+
Both have procs and cons.
41+
Using system-wide packages simplifies centralized updates across multiple RHEL servers;
42+
If you need specific package version and package isolation from system changes and
43+
e.g. when multiple sites on a server require different versions of the same packages,
44+
a dedicated Python virtual environment is preferable.
45+
46+
**If you choose to use route A - RPMs***
47+
48+
```
49+
# Enable EPEL and CRB
50+
dnf install -y epel-release
51+
dnf config-manager --set-enabled epel
52+
dnf config-manager --set-enabled crb
53+
54+
# Install rcdb dependendencies
55+
dnf install -y \
56+
python3-markupsafe \
57+
python3-click \
58+
python3-rich \
59+
python3-sqlalchemy \
60+
python3-mako \
61+
python3-ply \
62+
python3-PyMySQL \
63+
python3-pygments \
64+
python3-flask
65+
```
66+
67+
68+
## Install RCDB Library
2969

3070
You have two options for installing the RCDB library:
3171

3272
### Option A: System-wide Installation
3373

3474
```bash
35-
sudo pip3 install rcdb
75+
git clone --depth=1 https://github.com/JeffersonLab/rcdb.git /opt/rcdb
76+
77+
# Install RCDB *without* re-downloading dependencies (they are from RPM)
78+
# The --no-deps flag ensures pip won’t try to reinstall them.
79+
cd /opt/rcdb/python
80+
python3 -m pip install --no-cache-dir --no-deps .
3681
```
3782

3883
### Option B: Virtual Environment (Recommended)

0 commit comments

Comments
 (0)