Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic Service Restart (Debian) #4529

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,32 @@ if command -v systemd-tmpfiles > /dev/null; then
systemd-tmpfiles --create opensearch-dashboards.conf
fi

# Messages
echo "### NOT starting on installation, please execute the following statements to configure opensearch-dashboards service to start automatically using systemd"
echo " sudo systemctl daemon-reload"
echo " sudo systemctl enable opensearch-dashboards.service"
echo "### You can start opensearch-dashboards service by executing"
echo " sudo systemctl start opensearch-dashboards.service"
# Restart the service after an upgrade
if [ "$1" == "configure" ] && [ "$2" != "" ]; then
if command -v systemctl >/dev/null && systemctl is-enabled opensearch-dashboards.service >/dev/null; then
echo "Restarting opensearch-dashboards.service after upgrade"
systemctl start opensearch-dashboards.service
fi
else
# Messages
echo "### NOT starting on installation, please execute the following statements to configure opensearch-dashboards service to start automatically using systemd"
echo " sudo systemctl daemon-reload"
echo " sudo systemctl enable opensearch-dashboards.service"
echo "### You can start opensearch-dashboards service by executing"
echo " sudo systemctl start opensearch-dashboards.service"
fi

echo "### Upcoming breaking change in packaging"
echo " In a future release of OpenSearch Dashboards, we plan to change the permissions associated with access to installed files"
echo " If you are configuring tools that require read access to the OpenSearch Dashboards configuration files, we recommend you add the user that runs these tools to the 'opensearch-dashboards' group"
echo " For more information, see https://github.com/opensearch-project/opensearch-build/pull/4043"

# Set owner
chown -R opensearch-dashboards.opensearch-dashboards ${product_dir}
chown -R opensearch-dashboards.opensearch-dashboards ${config_dir}
chown -R opensearch-dashboards.opensearch-dashboards ${log_dir}
chown -R opensearch-dashboards.opensearch-dashboards ${data_dir}
chown -R opensearch-dashboards.opensearch-dashboards ${pid_dir}
chown -R opensearch-dashboards:opensearch-dashboards ${product_dir}
chown -R opensearch-dashboards:opensearch-dashboards ${config_dir}
chown -R opensearch-dashboards:opensearch-dashboards ${log_dir}
chown -R opensearch-dashboards:opensearch-dashboards ${data_dir}
chown -R opensearch-dashboards:opensearch-dashboards ${pid_dir}

exit 0

Expand Down
41 changes: 27 additions & 14 deletions scripts/pkg/build_templates/opensearch/deb/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ if ! grep -q '## OpenSearch Performance Analyzer' ${config_dir}/jvm.options; the
fi

# Set owner
chown -R opensearch.opensearch ${product_dir}
chown -R opensearch.opensearch ${config_dir}
chown -R opensearch.opensearch ${log_dir}
chown -R opensearch.opensearch ${data_dir}
chown -R opensearch.opensearch ${pid_dir}
chown -R opensearch:opensearch ${product_dir}
chown -R opensearch:opensearch ${config_dir}
chown -R opensearch:opensearch ${log_dir}
chown -R opensearch:opensearch ${data_dir}
chown -R opensearch:opensearch ${pid_dir}

# Reload systemctl daemon
if command -v systemctl > /dev/null; then
Expand All @@ -57,17 +57,30 @@ if command -v systemd-tmpfiles > /dev/null; then
systemd-tmpfiles --create opensearch.conf
fi

# Messages
echo "### NOT starting on installation, please execute the following statements to configure opensearch service to start automatically using systemd"
echo " sudo systemctl daemon-reload"
echo " sudo systemctl enable opensearch.service"
echo "### You can start opensearch service by executing"
echo " sudo systemctl start opensearch.service"
# Restart the services after an upgrade
if [ "$1" == "configure" ] && [ "$2" != "" ]; then
if command -v systemctl >/dev/null && systemctl is-enabled opensearch.service >/dev/null; then
echo "Restarting opensearch.service after upgrade"
systemctl start opensearch.service
fi
if command -v systemctl >/dev/null && systemctl is-enabled opensearch-performance-analyzer.service >/dev/null; then
echo "Restarting opensearch-performance-analyzer.service after upgrade"
systemctl start opensearch-performance-analyzer.service
fi
else
# Messages
echo "### NOT starting on installation, please execute the following statements to configure opensearch service to start automatically using systemd"
echo " sudo systemctl daemon-reload"
echo " sudo systemctl enable opensearch.service"
echo "### You can start opensearch service by executing"
echo " sudo systemctl start opensearch.service"

if [ -d ${product_dir}/plugins/opensearch-security ]; then
echo "### Create opensearch demo certificates in ${config_dir}/"
echo " See demo certs creation log in ${log_dir}/install_demo_configuration.log"
if [ -d ${product_dir}/plugins/opensearch-security ]; then
echo "### Create opensearch demo certificates in ${config_dir}/"
echo " See demo certs creation log in ${log_dir}/install_demo_configuration.log"
fi
fi

echo "### Upcoming breaking change in packaging"
echo " In a future release of OpenSearch, we plan to change the permissions associated with access to installed files"
echo " If you are configuring tools that require read access to the OpenSearch configuration files, we recommend you add the user that runs these tools to the 'opensearch' group"
Expand Down
Loading