Skip to content

phi-grib/permanens_docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Container for hosting the PERMANENS web-app

For building a suitable container for hosting the PERMANENS application in production mode follow the steps in order

Environment preparation

Copy inside the repositories of:

  • permanens
  • permanens_api
  • permanens_web

You can clone the repositories (recommended) or copy existing ones

Customizing BaseURL

Localize the file permanens_web/src/services/settingsDomain.ts and edit the baseURL string to '':

export const baseURL:string = "";
export const api:string = "/permanens/v1";

NB: this is not the best way to define development/production environments. A better approach is defined here: https://dat3cph.github.io/material/toolbox/react/baseurl

Build the frontend

Generate the frontend

cd permanens_web\permanens_web
npm instal --force
npm run build

Copy the distribution folder dist inside permanens_api\static

Customization of host address

The name of the host must be included in the file server-conf\flask-site-nginx.conf. For example, for address "https://permanens.upf.edu" enter it in the two server definitions within (one for ssl 443 port and and another for 80 port)

server {
    listen 443 ssl;
    server_name permanens.upf.edu;
    ssl_certificate /data/ssl/wildcard_upf_edu.pem;
    ssl_certificate_key /data/ssl/wildcard_upf.edu;

    root /opt/permanens_api/static/dist;

    location / {
        
        try_files $uri $uri/ /index.html;
    }
    
    location /permanens {
        include uwsgi_params;
        uwsgi_pass unix:///tmp/uwsgi.sock;
    }

    location /static {
        alias /opt/permanens_api/static/dist;
        expires 30d;
    }
}

server {
    listen 80;
    server_name permanens.upf.edu;
    return 301 https://permanens.edu$request_uri;
}

Note that this file also defines the location of the static frontend code (here in static/dist)

Image building and exporting

Build the docker image as usual:

docker build -t permanens_production .
docker login
docker tag permanens_production mpastorphi/permanens_production:latest
docker push mpastorphi/permanens_production:latest

Web server preparation

The web server host must have a /data folder owned by UID 1001 with the following structure: /data /data/models /data/consults /data/ssl

IMPORTANT: Copy the appropriate SSL certificates inside the ssl folder Copy models (*.dill files) and other relevant files typically found within permanens/models within folder /data/models

Import the image and run it with the following commands:

docker pull mpastorphi/permanens_production_latest
docker run --restart=always -d -p 80:80 -p 443:443 -v /data:/data mpastorphi/permanens_production:latest

Acknowledgments

Permanens has been developed for the project Permanens (https://www.permanens.eu/)

The PERMANENS project is supported by Instituto de Salud Carlos III (ISCIII) and by the European Union NextGenerationEU, Mecanismo para la Recuperación y la Resiliencia (AC22/00006; AC22/00045), the Swedish Innovation Agency (no. 2022-00549), the Research Council of Norway (project no. 342386) and the Health Research Board Ireland (ERAPERMED2022) under the frame of ERA PerMed.

About

Material for buidling the docker container hosting the permananent web application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors