Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.
Production Deployment Guide: OpenSearch Dashboards Service#
This guide provides step-by-step instructions to deploy OpenSearch Dashboards as a systemd service on a production server. It covers configuration settings, directory permissions, service file configuration, and troubleshooting common issues like UUID file write errors.
Overview#
OpenSearch Dashboards is a powerful visualization tool for OpenSearch data. In a production environment, it is critical to run OpenSearch Dashboards as a managed systemd service with the proper permissions and configuration. This guide details how to configure the service, set up SSL (HTTPS on port 443), and resolve common permission issues that may arise during deployment.
Prerequisites#
Before proceeding with the deployment, ensure you have:
- A Linux server with OpenSearch Dashboards installed (using Tarball/RPM/Debian/Helm)
- Root access or sudo privileges
- SSL certificates (PEM format) available at the specified paths
- The opensearch-dashboards user is already created
If the opensearch-dashboards user doesn’t exist, create it with:
1sudo useradd -r -s /sbin/nologin opensearch-dashboardsYou’ll also need:
- OpenSearch Dashboards installation directory (default:
/usr/share/opensearch-dashboards) - Configuration directory (default:
/etc/opensearch-dashboards)
Directory and File Permissions#
Proper permissions are crucial for security and functionality. Follow these steps to set up the necessary permissions:
Set Ownership for Installation and Configuration Directories#
1sudo chown -R opensearch-dashboards:opensearch-dashboards /usr/share/opensearch-dashboards2sudo chown -R opensearch-dashboards:opensearch-dashboards /etc/opensearch-dashboardsCreate and Set Permissions for the Data Directory#
The UUID file is written in the data directory. Create it and set proper permissions:
1sudo mkdir -p /usr/share/opensearch-dashboards/data2sudo chown -R opensearch-dashboards:opensearch-dashboards /usr/share/opensearch-dashboards/data3sudo chmod -R 755 /usr/share/opensearch-dashboards/dataConfiguration File#
Edit the main configuration file located at /etc/opensearch-dashboards/opensearch_dashboards.yml. Below is an example configuration for a production environment:
1server.host: "0.0.0.0"2server.port: 4433server.ssl.enabled: true4server.ssl.certificate: "/etc/opensearch-dashboards/certs/dashboard.pem"5server.ssl.key: "/etc/opensearch-dashboards/certs/dashboard-key.pem"6
7opensearch.hosts:8 [9 "https://172.17.14.79:9200",10 "https://172.17.14.89:9200",11 "https://172.17.14.39:9200",12 ]13opensearch.ssl.verificationMode: certificate14opensearch.username: "admin"15opensearch.password: "Anubhav@321"16opensearch.requestHeadersAllowlist: ["securitytenant", "Authorization"]17
18opensearch_security.multitenancy.enabled: false19opensearch_security.readonly_mode.roles: ["kibana_read_only"]20
21uiSettings.overrides.defaultRoute: "/app/invinsense"Important Notes:
- Ensure the certificate files exist and are accessible by the opensearch-dashboards user
- Replace the OpenSearch hosts with your actual OpenSearch cluster nodes
- Update credentials to match your environment’s security configuration
- Consider storing passwords in a secure vault rather than in plaintext for production
Systemd Service File Configuration#
Create (or modify) the systemd service file at /etc/systemd/system/opensearch-dashboards.service with the following content:
1[Unit]2Description=OpenSearch Dashboards3Documentation=https://opensearch.org/docs/4Wants=network-online.target5After=network-online.target6
7[Service]8Type=simple9User=opensearch-dashboards10Group=opensearch-dashboards11Environment=NODE_ENV=production12WorkingDirectory=/usr/share/opensearch-dashboards13ExecStart=/usr/share/opensearch-dashboards/bin/opensearch-dashboards14Restart=on-failure15StandardOutput=journal16StandardError=inherit17LimitNOFILE=6553518
19[Install]20WantedBy=multi-user.targetKey Configuration Points:
- User and Group: The service runs as the opensearch-dashboards user
- WorkingDirectory: Must be set to the installation directory
- ExecStart: Path to the OpenSearch Dashboards startup script
- Restart: Set to restart on failure for improved reliability
- LimitNOFILE: Increased file descriptor limit for production workloads
After saving the file, reload systemd:
1sudo systemctl daemon-reloadThen enable and start the service:
1sudo systemctl enable opensearch-dashboards.service2sudo systemctl start opensearch-dashboards.serviceReloading and Restarting the Service#
After updating configurations or permissions, always reload the systemd daemon:
1sudo systemctl daemon-reloadThen restart the service:
1sudo systemctl restart opensearch-dashboards.serviceVerify service status:
1sudo systemctl status opensearch-dashboards.serviceTroubleshooting UUID File Write Errors#
A common error when starting OpenSearch Dashboards is: