Commit c2bd5d8d authored by Robert Butora's avatar Robert Butora
Browse files

update README to new API args

parent 22b008e7
Loading
Loading
Loading
Loading
+26 −88
Original line number Diff line number Diff line
@@ -11,47 +11,21 @@ container to help maintenance.

## Deploy SEDModS

### Pull repo
When pulling this repo you'll end up with

    |-- Dockerfile (container description)
    |-- README.md (this text)
    |-- sed-data
    |   `-- link.to.hdf5 (dummy data file, see later)
    |-- wsgi.conf (WSGI configuration for the http server)
    `-- wsgi-scripts (actual service business logic)
        |-- hdf_query.py
        |-- query-server_d.py
        |-- wsgid.py
        `-- wsgi.py

### Project content description
The `Dockerfile` cotains instructions to build the container that
includes:
The `Dockerfile` uses::
 - an httpd server (running on container's port 80)
 - python and WSGI packages to be able to run the service
 - python and WSGI packages
It needs a properly configured `wsgi.conf` that will be loaded within
the `http/conf.d` of the container.
The base container is a _fedora:latest_ environment.

Besides the instructions to build the container and the WSGI
configuration, the container, to properly run, needs two further pieces,
two folders:
 - the `sed-data` one that contains the SED Models HDF5 file
 - the `wsgi-scripts` that actually contains the business logic of the
   service itself

(The actual HDF5 file is not kept in this repo, because it's too large
and because it's not a wise choice to store byte-blobs in a versioning
system).
Used folders:
 - `sed-data` : place to store the SED Models HDF5 file
 - `wsgi-scripts` : business logic of the service itself

The `wsgi-scripts` is provided and maintained in this repo, the
`sed-data` one can be anywhere else, in reach of the host system.
If the location of these these pieces has to be changed, it suffices to
update accordingly the run command of the container (see below).
The `sed-data` must be visible to the application on the host.

### Build the container image
To build the container image, simply run 
To build the container image:

    podman build --tag vlkb-sedmods -f ./Dockerfile

@@ -80,53 +54,31 @@ within the `sed-data` folder.
Also, _-p_ maps the 80 port of the container onto the 8080 port on the
host server, this must be changed if the host's 8080 is already in use.

### Service(s) in the container

Two flavours of the _SEDModS_ service can run with the repo content:
 - one that reads the HDF5 at each query
 - one that reads the HDF5 once and works as a _system daemon_

#### Single query service mode
This mode is directly available when the cotainer is run. It uses the
following code files:

    wsgi.py
    hdf_query.py

If you run on the host server 

    curl localhost:8080/sedsearch/?'clump_mass<10.005' > output.dat

you should get the response in the `output.dat` file, or you can point
the browser to
### Service endpoints

    http://host.server:8080/sedsearch/?'clump_mass<10.005'
How to start service is descripbed [here](README_implementation.md).

and see the response directly.
Then the service presents the endpoint:
 - searchd

#### Daemon service mode
This mode uses the code in:
Access the service by: 

    wsgid.py
    query_server_d.py
    curl localhost:8080/searchd/?arg1_arg2_...-_arg9 > output.json

It requires a couple of processes to run before the deamonised service
can work. These processes run within the container, so, after running
it, one can launch them attaching to the running container with
Response is in JSON format. And the arguments are as in this C++ code fragment:

    podman exec -it sedmod-test /bin/bash

and within it run

    python -m Pyro4.naming &
		python query-server_d.py &

After that, on can exit the shell and the daemon-based service should be
reachable at

    http://host.server:8080/seddaemon

with the same usage of the single query one.
```cpp
 QString args = QString("'%1_%2_%3_%4_%5_%6_%7_0_%8_%9'")
                           .arg(sedFitInputW)
                           .arg(sedFitInputF)
                           .arg(sedFitInputErrF)
                           .arg(sedFitInputFflag)
                           .arg(ui->distTheoLineEdit->text())
                           .arg(ui->prefilterLineEdit->text())
                           .arg(sedWeights)
                           .arg(sedFitInputW)
                           .arg(ui->delta_chi2_lineEdit->text());
```

### Network Proxy
Since it could be annoying to explitly use port 8080 on the host, the
@@ -140,18 +92,4 @@ server's http using the httpd _ProxyPass_ directive, like
where _/sedmods_ is an example and the _8080_ port depends on the passed
parameters to the podman run command (see above).

## SED Models HDF5 file
This is preserved, currently, on the INAF ICT Owncloud instance.

## Dependencies

On the host:
 - podman
 - httpd
Within the container (i.e. provided in the build):
 - httpd with python3-mod\_wsgi
 - python 3.x
 - pandas
 - Pyro4 (deamon mode)
 - (py)tables
+63 −0
Original line number Diff line number Diff line
### Service(s) in the container

Two flavours of the _SEDModS_ service can run with the repo content:
 - one that reads the HDF5 at each query
 - one that reads the HDF5 once and works as a _system daemon_

#### Single query service mode
This mode is directly available when the cotainer is run. It uses the
following code files:

    wsgi.py
    hdf_query.py

If you run on the host server 

    curl localhost:8080/sedsearch/?'clump_mass<10.005' > output.dat

you should get the response in the `output.dat` file, or you can point
the browser to

    http://host.server:8080/sedsearch/?'clump_mass<10.005'

and see the response directly.

#### Daemon service mode
This mode uses the code in:

    wsgid.py
    query_server_d.py

It requires a couple of processes to run before the deamonised service
can work. These processes run within the container, so, after running
it, one can launch them attaching to the running container with

    podman exec -it sedmod-test /bin/bash

and within it run

    python -m Pyro4.naming &
		python query-server_d.py &

After that, on can exit the shell and the daemon-based service should be
reachable at

    http://host.server:8080/seddaemon

with the same usage of the single query one.

## SED Models HDF5 file
This is preserved, currently, on the INAF ICT Owncloud instance.

## Dependencies

On the host:
 - podman
 - httpd

Within the container (i.e. provided in the build):
 - httpd with python3-mod\_wsgi
 - python 3.x
 - pandas
 - Pyro4 (deamon mode)
 - (py)tables