Skip to content

Handle server setup

milanmajchrak edited this page Aug 2, 2024 · 13 revisions

Generating config & running

Handle server runs within backend container (dspace). In order to run the following script, dependecy host must be installed, like this: apt update && apt install host -y and for installing the stream run this command sudo apt -y install libnginx-mod-stream During installation, the config must be manually created by calling /dspace/bin/make-handle-config, see https://github.com/dataquest-dev/dspace-angular/blob/dtq-dev/.github/workflows/deploy.yml#L93-L101 for all the steps necessary. docker-compose-rest.yml is prepared, so that the handle folder is in volume and entrypoint is set, so that on restart, handle server starts.

It seems that in some cases, IPs in /dspace/handle-server/config.dct must be replace by IP from sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dspace0 (executed on host, not in container, obviously).

Exposing with Nginx

Ports according to official documentation https://www.handle.net/hnr_support.html (paragraph 5).

Add to /etc/nginx/nginx.conf:

stream {
    server {
    # for handle server
        listen 2641;
        proxy_pass localhost:2640;
    }
}

to /etc/nginx/nginx.conf:

Add to some site in /etc/nginx/sites-enabled.

# handle server HTTP
server {
    listen 8011;
    location / {
        proxy_pass http://localhost:8010;
    }
}

# handle server HTTPS
    server_name <SERVER_NAME>;
    listen 8011 ssl;
    ssl_certificate /etc/letsencrypt/live/<PATH_TO_CERT>/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/<PATH_TO_CERT>/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
    location / {
        proxy_pass http://localhost:8010;
    }

Allow the firewall

sudo iptables -I INPUT -p tcp --dport 8011 -j ACCEPT

Clone this wiki locally