Membuat systemd service dicomweb-proxy #1

Open
opened 2025-03-12 10:13:19 +07:00 by mario · 0 comments
Owner

Requirements

  1. Node.js (v20.x atau sesuai versi aplikasi).
  2. Aplikasi dicomweb-proxy sudah di-clone dan berjalan secara manual (npm start).
  3. Sistem operasi Linux dengan systemd (misalnya Ubuntu 20.04+).

Install Node.js via NVM

Jika Node.js belum terinstall, ikuti langkah berikut untuk menginstall menggunakan NVM:

# Install NVM (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash

# Muat ulang shell agar perubahan NVM diterapkan
source ~/.bashrc

# Install Node.js versi yang dibutuhkan (contoh: v20.18.3)
nvm install 20.18.3

# Set versi Node.js sebagai default
nvm use 20.18.3
nvm alias default 20.18.3

# Verifikasi instalasi
node -v && npm -v

Steps

  1. Buat Service File:

    • Buat file /etc/systemd/system/dicomweb-proxy.service:
      [Unit]
      Description=dicomweb-proxy Service
      After=network.target
      
      [Service]
      User=pacs
      Group=pacs
      WorkingDirectory=/home/pacs/dicomweb-proxy
      ExecStart=/home/pacs/.nvm/versions/node/v20.18.3/bin/npm start
      Restart=always
      Environment="PATH=/home/pacs/.nvm/versions/node/v20.18.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      
      [Install]
      WantedBy=multi-user.target
      
  2. Reload dan Enable Service:

    sudo systemctl daemon-reload
    sudo systemctl enable dicomweb-proxy
    sudo systemctl start dicomweb-proxy
    
  3. Periksa Status:

    sudo systemctl status dicomweb-proxy
    

Verification

  1. Pastikan service aktif:

    sudo systemctl is-active dicomweb-proxy
    

    Output: active.

  2. Cek log untuk memastikan tidak ada error:

    journalctl -u dicomweb-proxy --since "1 minute ago"
    
  3. Akses aplikasi di browser atau API endpoint untuk memastikan proxy berfungsi.


Dengan langkah ini, dicomweb-proxy akan berjalan otomatis saat server reboot.

#### **Requirements** 1. Node.js (v20.x atau sesuai versi aplikasi). 2. Aplikasi `dicomweb-proxy` sudah di-clone dan berjalan secara manual (`npm start`). 3. Sistem operasi Linux dengan systemd (misalnya Ubuntu 20.04+). --- #### **Install Node.js via NVM** Jika Node.js belum terinstall, ikuti langkah berikut untuk menginstall menggunakan NVM: ```bash # Install NVM (Node Version Manager) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash # Muat ulang shell agar perubahan NVM diterapkan source ~/.bashrc # Install Node.js versi yang dibutuhkan (contoh: v20.18.3) nvm install 20.18.3 # Set versi Node.js sebagai default nvm use 20.18.3 nvm alias default 20.18.3 # Verifikasi instalasi node -v && npm -v ``` --- #### **Steps** 1. **Buat Service File**: - Buat file `/etc/systemd/system/dicomweb-proxy.service`: ```ini [Unit] Description=dicomweb-proxy Service After=network.target [Service] User=pacs Group=pacs WorkingDirectory=/home/pacs/dicomweb-proxy ExecStart=/home/pacs/.nvm/versions/node/v20.18.3/bin/npm start Restart=always Environment="PATH=/home/pacs/.nvm/versions/node/v20.18.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" [Install] WantedBy=multi-user.target ``` 2. **Reload dan Enable Service**: ```bash sudo systemctl daemon-reload sudo systemctl enable dicomweb-proxy sudo systemctl start dicomweb-proxy ``` 3. **Periksa Status**: ```bash sudo systemctl status dicomweb-proxy ``` --- #### **Verification** 1. Pastikan service aktif: ```bash sudo systemctl is-active dicomweb-proxy ``` Output: `active`. 2. Cek log untuk memastikan tidak ada error: ```bash journalctl -u dicomweb-proxy --since "1 minute ago" ``` 3. Akses aplikasi di browser atau API endpoint untuk memastikan proxy berfungsi. --- Dengan langkah ini, `dicomweb-proxy` akan berjalan otomatis saat server reboot.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mario/dicom-proxy#1