Skip to content

Deployment on RHEL based distro

Bhavyai Gupta edited this page May 21, 2022 · 1 revision

Make sure to follow the corresponding deployment guide for BudLib API, which is available at https://github.com/budlib/budlib-api/wiki/Deployment-on-RHEL-based-distro.

React setup

  1. Make sure you have nodejs installed and setup on your system. If not, you can get nodejs from https://nodejs.org/en/download/.

  2. Clone the budlib-web repository from https://github.com/budlib/budlib-web to your local system

    $ git clone https://github.com/budlib/budlib-web.git
    # mv budlib-web /usr/local/bin
    
  3. Navigate to the repository and run the following commands

    $ cd /usr/local/bin/budlib-web
    $ npm install
    $ npm run build
    $ npm install -g serve
    
  4. To start react server on port 80, install the dependency and give safe user permission to node

    # dnf install libcap-devel
    
    # setcap cap_net_bind_service=+ep `readlink -f \`which node\``
    
  5. Create a script that would start the server

    # touch /usr/local/bin/budlib-web.sh
    
    # chmod +x /usr/local/bin/budlib-web.sh
    
  6. Add the following content in the file created in Step 5. Make sure to update the path to your installed node in the below content (node path our case the path is /opt/node-v16.15.0/bin)

    #!/bin/bash
    
    export PATH="${PATH}:/opt/node-v16.15.0/bin"
    cd /usr/local/bin/budlib-web
    nohup `which serve` -s build -l 80
    
  7. Create a service file for the budlib-web, that would run the web server it on system start-up

    # touch /etc/systemd/system/budlib-web.service
    
  8. Add the content in the file created in Step 7, as shown:

    [Unit]
    Description=Web Interface for BudLib
    Wants=network.target budlib-api.service
    After=syslog.target network-online.target budlib-api.service
    
    [Service]
    Type=simple
    User=$USER
    ExecStart=/usr/local/bin/budlib-web.sh
    Restart=on-failure
    RestartSec=10
    KillMode=mixed
    
    [Install]
    WantedBy=multi-user.target
    

    Note: replace $USER with your system username, or root

  9. Enable the budlib-web to run on system startup

    # systemctl daemon-reload
    
    # systemctl enable budlib-web.service
    
Clone this wiki locally